[libvirt] [PATCH]Fix minor issues in logical storage backend

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

 



Hi All!

I came across some problems trying to create a new LVM-based storage
pool using this config

<pool type="logical">
  <name>test_vg</name>
  <source>
    <device path="/dev/sdb1"/>
  </source>
  <target>
    <path>/dev/test_vg</path>
  </target>
</pool>

Volume group did not previously exist so I did
virsh pool-define <above.xml>
virsh pool-build test_vg

pool-build failed since the backend logical storage driver does not have
VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE set in flags.  Without this flag
set, the device element is never parsed in virStoragePoolDefParseDoc()
(storage_conf.c), causing pvcreate to fail since no physical volume is
specified.

After this problem was memory corruption cause by miscalculating the
size of vgcreate command line :-).

This patch fixes both issues.

Regards,
Jim
 
Index: src/storage_backend_logical.c
===================================================================
RCS file: /data/cvs/libvirt/src/storage_backend_logical.c,v
retrieving revision 1.11
diff -u -r1.11 storage_backend_logical.c
--- src/storage_backend_logical.c	27 Aug 2008 20:05:59 -0000	1.11
+++ src/storage_backend_logical.c	28 Aug 2008 23:58:54 -0000
@@ -351,7 +351,7 @@
     memset(zeros, 0, sizeof(zeros));
 
     /* XXX multiple pvs */
-    if (VIR_ALLOC_N(vgargv, 1) < 0) {
+    if (VIR_ALLOC_N(vgargv, 3 + pool->def->source.ndevice) < 0) {
         virStorageReportError(conn, VIR_ERR_NO_MEMORY, "%s", _("command line"));
         return -1;
     }
@@ -618,6 +618,7 @@
     .deleteVol = virStorageBackendLogicalDeleteVol,
 
     .poolOptions = {
+        .flags = (VIR_STORAGE_BACKEND_POOL_SOURCE_DEVICE),
         .formatFromString = virStorageBackendLogicalPoolFormatFromString,
         .formatToString = virStorageBackendLogicalPoolFormatToString,
     },
--
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]