https://bugzilla.redhat.com/show_bug.cgi?id=
1373711
Add support and documentation for the [NO_]OVERWRITE flags for the
logical backend.
Update virsh.pod with a description of the process for usage of
the flags and building of the pool's volume group.
Signed-off-by: John Ferlan <jferlan@redhat.com>
virStoragePoolFormatDiskTypeToString;
virStoragePoolFormatFileSystemNetTypeToString;
virStoragePoolFormatFileSystemTypeToString;
+virStoragePoolFormatLogicalTypeToString;
virStoragePoolGetVhbaSCSIHostParent;
virStoragePoolLoadAllConfigs;
virStoragePoolLoadAllState;
virStoragePoolObjPtr pool,
unsigned int flags)
{
- virCommandPtr vgcmd;
+ virCommandPtr vgcmd = NULL;
int ret = -1;
- size_t i;
+ size_t i = 0;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
+ VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
+
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_STORAGE_POOL_BUILD_OVERWRITE,
+ VIR_STORAGE_POOL_BUILD_NO_OVERWRITE,
+ cleanup);
vgcmd = virCommandNewArgList(VGCREATE, pool->def->source.name, NULL);
for (i = 0; i < pool->def->source.ndevice; i++) {
const char *path = pool->def->source.devices[i].path;
+ /* The blkid FS and Part probing code doesn't know "lvm2" (this
+ * pool's only format type), but it does know "LVM2_member", so
+ * we'll pass that here */
+ if (!(flags & VIR_STORAGE_POOL_BUILD_OVERWRITE) &&
+ !virStorageBackendDeviceIsEmpty(path, "LVM2_member", true))
+ goto cleanup;
+
if (virStorageBackendLogicalInitializeDevice(path) < 0)
goto cleanup;
Build a given pool.
Options I<--overwrite> and I<--no-overwrite> can only be used for
-B<pool-build> a filesystem or disk pool.
+B<pool-build> a filesystem, disk, or logical pool.
For a file system pool if neither flag is specified, then B<pool-build>
just makes the target path directory and no attempt to run mkfs on the
a new label. Writing of the label uses the pool source format type
or "dos" if not specified.
+For a logical pool, if neither of them is specified or I<--no-overwrite>
+is specified, B<pool-build> will check the target volume devices for
+existing filesystems or partitions before attempting to initialize
+and format each device for usage by the logical pool. If any target
+volume device already has a label, the command will fail. If
+I<--overwrite> is specified, then no check will be made on the target
+volume devices prior to initializing and formatting each device. Once
+all the target volume devices are properly formatted via pvcreate,
+the volume group will be created using all the devices.
+
=item B<pool-create> I<file>
[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]]