[libvirt] [PATCH 11/11] storage: Validate the device formats at logical startup

Ján Tomko jtomko at redhat.com
Wed Jan 11 14:39:23 UTC 2017


On Thu, Dec 15, 2016 at 04:42:16PM -0500, John Ferlan wrote:
>At startup time, rather than blindly trusting the target devices are
>still properly formatted, let's check to make sure the pool's target
>devices are all properly formatted before attempting to start the pool.
>
>Signed-off-by: John Ferlan <jferlan at redhat.com>
>---
> src/storage/storage_backend_logical.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
>diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
>index f128941..a433e61 100644
>--- a/src/storage/storage_backend_logical.c
>+++ b/src/storage/storage_backend_logical.c
>@@ -743,6 +743,19 @@ static int
> virStorageBackendLogicalStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
>                                   virStoragePoolObjPtr pool)
> {
>+    size_t i;
>+
>+    /* Let's make sure the pool's devices are properly formatted */
>+    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 (!virStorageBackendDeviceProbeEmpty(path, "LVM2_member", false))
>+            return -1;
>+    }

This seems pointless.

Is there any chance where this check would fail but the (arguably
also pointless) virStorageBackendLogicalMatchPoolSource
check below would succeed?

Jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170111/dca89f06/attachment-0001.sig>


More information about the libvir-list mailing list