[libvirt] [PATCH 3/5]: Set format type to LVM2 on NULL format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Again because of my generic VIR_ENUM_IMPL patch last week, I unwittingly caused
a regression in the storage_backend_logical driver.  Previously, if you
submitted logical pool XML that had no <source><format type='lvm2'/> string, it
would just default to VIR_STORAGE_POOL_LOGICAL_LVM2.  This would succeed just
fine and go on with life.  This is no longer the case, and now XML without the
format tag fails to define.  To maintain backwards compatibility with already
existing XML that expects this, add a compatibility wrapper to return
VIR_STORAGE_POOL_LOGICAL_LVM2 on an empty format tag.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
diff -up ./src/storage_backend_logical.c.p2 ./src/storage_backend_logical.c
--- ./src/storage_backend_logical.c.p2	2008-10-21 14:53:16.000000000 +0200
+++ ./src/storage_backend_logical.c	2008-10-21 14:53:59.000000000 +0200
@@ -49,6 +49,19 @@ VIR_ENUM_IMPL(virStorageBackendLogicalPo
               VIR_STORAGE_POOL_LOGICAL_LAST,
               "unknown", "lvm2");
 
+static int virStorageBackendLogicalFormatFromStringWrap(const char *format)
+{
+    /* 
+     * Sigh.  For compatibility purposes, we need to return
+     * VIR_STORAGE_POOL_LOGICAL_LVM2 when we get a NULL format
+     */
+
+    if (format == NULL)
+        return VIR_STORAGE_POOL_LOGICAL_LVM2;
+
+    return virStorageBackendLogicalPoolTypeFromString(format);
+}
+
 static int
 virStorageBackendLogicalSetActive(virConnectPtr conn,
                                   virStoragePoolObjPtr pool,
@@ -616,7 +629,7 @@ virStorageBackend virStorageBackendLogic
     .poolOptions = {
         .flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_NAME |
                   VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
-        .formatFromString = virStorageBackendLogicalPoolTypeFromString,
+        .formatFromString = virStorageBackendLogicalFormatFromStringWrap,
         .formatToString = virStorageBackendLogicalPoolTypeToString,
     },
 
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]