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(a)redhat.com>
---
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
Show replies by date