[libvirt] [PATCH]: Add default pool types

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

 



As suggested by danpb, to fix up the regression caused by last week's VIR_ENUM
cleanup patch, add a ".defaultFormat" member to .poolOptions.  In
storage_conf.c, if virXPathString(/pool/source/format/@type) returns NULL, then
set the pool type to .defaultFormat; otherwise, lookup the type via
formatFromString.

Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
Index: src/storage_backend.h
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend.h,v
retrieving revision 1.8
diff -u -r1.8 storage_backend.h
--- a/src/storage_backend.h	16 Oct 2008 15:06:03 -0000	1.8
+++ b/src/storage_backend.h	22 Oct 2008 13:59:03 -0000
@@ -77,6 +77,7 @@
 typedef virStorageBackendPoolOptions *virStorageBackendPoolOptionsPtr;
 struct _virStorageBackendPoolOptions {
     int flags;
+    int defaultFormat;
     virStoragePoolFormatToString formatToString;
     virStoragePoolFormatFromString formatFromString;
 };
Index: src/storage_backend_disk.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend_disk.c,v
retrieving revision 1.15
diff -u -r1.15 storage_backend_disk.c
--- a/src/storage_backend_disk.c	16 Oct 2008 15:06:03 -0000	1.15
+++ b/src/storage_backend_disk.c	22 Oct 2008 13:59:03 -0000
@@ -448,6 +448,7 @@
 
     .poolOptions = {
         .flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
+        .defaultFormat = VIR_STORAGE_POOL_DISK_UNKNOWN,
         .formatFromString = virStorageBackendPartTableTypeFromString,
         .formatToString = virStorageBackendPartTableTypeToString,
     },
Index: src/storage_backend_fs.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend_fs.c,v
retrieving revision 1.16
diff -u -r1.16 storage_backend_fs.c
--- a/src/storage_backend_fs.c	16 Oct 2008 15:06:04 -0000	1.16
+++ b/src/storage_backend_fs.c	22 Oct 2008 13:59:04 -0000
@@ -1083,6 +1083,7 @@
     .poolOptions = {
         .flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_HOST |
                   VIR_STORAGE_BACKEND_POOL_SOURCE_DIR),
+        .defaultFormat = VIR_STORAGE_POOL_FS_AUTO,
         .formatFromString = virStorageBackendFileSystemNetPoolTypeFromString,
         .formatToString = virStorageBackendFileSystemNetPoolTypeToString,
     },
Index: src/storage_backend_logical.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend_logical.c,v
retrieving revision 1.19
diff -u -r1.19 storage_backend_logical.c
--- a/src/storage_backend_logical.c	16 Oct 2008 15:06:04 -0000	1.19
+++ b/src/storage_backend_logical.c	22 Oct 2008 13:59:04 -0000
@@ -616,6 +616,7 @@
     .poolOptions = {
         .flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_NAME |
                   VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
+        .defaultFormat = VIR_STORAGE_POOL_LOGICAL_LVM2,
         .formatFromString = virStorageBackendLogicalPoolTypeFromString,
         .formatToString = virStorageBackendLogicalPoolTypeToString,
     },
Index: src/storage_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_conf.c,v
retrieving revision 1.21
diff -u -r1.21 storage_conf.c
--- a/src/storage_conf.c	21 Oct 2008 17:23:38 -0000	1.21
+++ b/src/storage_conf.c	22 Oct 2008 13:59:04 -0000
@@ -275,7 +275,12 @@
 
     if (options->formatFromString) {
         char *format = virXPathString(conn, "string(/pool/source/format/@type)", ctxt);
-        if ((ret->source.format = (options->formatFromString)(format)) < 0) {
+        if (format == NULL)
+            ret->source.format = options->defaultFormat;
+	else
+            ret->source.format = options->formatFromString(format);
+
+        if (ret->source.format < 0) {
             virStorageReportError(conn, VIR_ERR_XML_ERROR,
                                   _("unknown pool format type %s"), format);
             VIR_FREE(format);
--
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]