STORAGE_POOL_DISK_LVM2 can't be created by "parted mklabel", so report an error when build such type pool Signed-off-by: Shanzhi Yu <shyu@xxxxxxxxxx> --- src/storage/storage_backend_disk.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 8e12974..5b5a1fa 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -414,13 +414,21 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED, goto error; } - if (flags & VIR_STORAGE_POOL_BUILD_OVERWRITE) + if (flags & VIR_STORAGE_POOL_BUILD_OVERWRITE && + pool->def->source.format != VIR_STORAGE_POOL_DISK_LVM2) ok_to_mklabel = true; else { int check; check = virStorageBackendDiskFindLabel( pool->def->source.devices[0].path); + + if (pool->def->source.format == VIR_STORAGE_POOL_DISK_LVM2){ + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Invalid disk label: lvm2")); + goto error; + } + if (check > 0) { ok_to_mklabel = true; } else if (check < 0) { -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list