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

[libvirt] libvirt and clustered volume group problems



Hello,

Description of problem:
a) libvirt should use vgchange -aly/-aln instead of vgchange -ay/-an for clustered volume groups b) libvirt should skip not activated/suspended volumes during pool-create/pool-refresh for logical pools

Version-Release number of selected component (if applicable):
libvirt-0.9.6

How reproducible:
always

Steps to Reproduce:

a) vgchange -ay/-an
1. Build 2-node cluster
2. Create clustered volume group
3. Create logical storage pool in libvirt
4. Open/mount any volume on the first node
5. Try to destroy storage pool on the second node

b) not activated volumes:
1. Build 2-node cluster
2. Create clustered volume group
3. Activate exclusively any volume on the first node
4. Try to create pool on the second node

Actual results:

a) vgchange -ay/-an
# virsh pool-destroy vg
error: Failed to destroy pool vg
error: internal error '/sbin/vgchange -an vg' exited with non-zero status 5 and
signal 0:   Error locking on node node1: LV vg/lv1 in use: not deactivating

b) not activated volumes:
# virsh pool-create vg.xml
error: Failed to create pool from vg.xml
error: internal error lvs command failed

Expected results:

a) vgchange -ay/-an
# virsh pool-destroy vg
Pool vg destroyed

b) not activated volumes:
# virsh pool-create vg.xml
Pool vg created from vg.xml

Additional info:
Attached patch fix problem for me.
Original bug report: https://bugzilla.redhat.com/show_bug.cgi?id=748437
a) https://bugzilla.redhat.com/show_bug.cgi?id=748248
b) https://bugzilla.redhat.com/show_bug.cgi?id=748282

--
С уважением,
Роман Шишнёв,
CTO | ActiveCloud | http://www.active.by
Т +375 17 2 911 511 доб. 308 | rommer active by
Облачные решения | Серверы и инфраструктура | IaaS | SaaS | Хостинг
diff -Nru a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
--- a/src/storage/storage_backend_logical.c	2011-10-23 22:18:31.493895652 +0400
+++ b/src/storage/storage_backend_logical.c	2011-10-23 22:29:42.849896160 +0400
@@ -51,7 +51,7 @@
     const char *cmdargv[4];
 
     cmdargv[0] = VGCHANGE;
-    cmdargv[1] = on ? "-ay" : "-an";
+    cmdargv[1] = on ? "-aly" : "-aln";
     cmdargv[2] = pool->def->source.name;
     cmdargv[3] = NULL;
 
@@ -70,6 +70,19 @@
     virStorageVolDefPtr vol = NULL;
     unsigned long long offset, size, length;
 
+    /* Check volume attributes */
+    if (strlen(groups[7]) < 6) {
+        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+                              "%s", _("malformed volume attributes"));
+        return -1;
+    } else {
+        char const *attrs = groups[7];
+
+        /* Skip not activated volume */
+        if (attrs[4] != 'a')
+            return 0;
+    }
+
     /* See if we're only looking for a specific volume */
     if (data != NULL) {
         vol = data;
@@ -176,14 +189,14 @@
                                 virStorageVolDefPtr vol)
 {
     /*
-     *  # lvs --separator , --noheadings --units b --unbuffered --nosuffix --options "lv_name,origin,uuid,devices,seg_size,vg_extent_size" VGNAME
-     *  RootLV,,06UgP5-2rhb-w3Bo-3mdR-WeoL-pytO-SAa2ky,/dev/hda2(0),5234491392,33554432
-     *  SwapLV,,oHviCK-8Ik0-paqS-V20c-nkhY-Bm1e-zgzU0M,/dev/hda2(156),1040187392,33554432
-     *  Test2,,3pg3he-mQsA-5Sui-h0i6-HNmc-Cz7W-QSndcR,/dev/hda2(219),1073741824,33554432
-     *  Test3,,UB5hFw-kmlm-LSoX-EI1t-ioVd-h7GL-M0W8Ht,/dev/hda2(251),2181038080,33554432
-     *  Test3,Test2,UB5hFw-kmlm-LSoX-EI1t-ioVd-h7GL-M0W8Ht,/dev/hda2(187),1040187392,33554432
+     *  # lvs --separator , --noheadings --units b --unbuffered --nosuffix --options "lv_name,origin,uuid,devices,seg_size,vg_extent_size,lv_attr" VGNAME
+     *  RootLV,,06UgP5-2rhb-w3Bo-3mdR-WeoL-pytO-SAa2ky,/dev/hda2(0),5234491392,33554432,-wi-ao
+     *  SwapLV,,oHviCK-8Ik0-paqS-V20c-nkhY-Bm1e-zgzU0M,/dev/hda2(156),1040187392,33554432,-wi-ao
+     *  Test2,,3pg3he-mQsA-5Sui-h0i6-HNmc-Cz7W-QSndcR,/dev/hda2(219),1073741824,33554432,owi-a-
+     *  Test3,,UB5hFw-kmlm-LSoX-EI1t-ioVd-h7GL-M0W8Ht,/dev/hda2(251),2181038080,33554432,-wi-a-
+     *  Test4,Test2,djm6EV-Cndf-UCUS-EiPr-i2IT-jbGr-6i6vhf,/dev/hda2(187),1040187392,33554432,swi-a-
      *
-     * Pull out name, origin, & uuid, device, device extent start #, segment size, extent size.
+     * Pull out name, origin, uuid, device, device extent start #, segment size, extent size, attrs.
      *
      * NB can be multiple rows per volume if they have many extents
      *
@@ -193,15 +206,15 @@
      *    not a suitable separator (rhbz 470693).
      */
     const char *regexes[] = {
-        "^\\s*(\\S+),(\\S*),(\\S+),(\\S+)\\((\\S+)\\),(\\S+),([0-9]+),?\\s*$"
+        "^\\s*(\\S+),(\\S*),(\\S+),(\\S+)\\((\\S+)\\),(\\S+),([0-9]+),(\\S+),?\\s*$"
     };
     int vars[] = {
-        7
+        8
     };
     const char *prog[] = {
         LVS, "--separator", ",", "--noheadings", "--units", "b",
         "--unbuffered", "--nosuffix", "--options",
-        "lv_name,origin,uuid,devices,seg_size,vg_extent_size",
+        "lv_name,origin,uuid,devices,seg_size,vg_extent_size,lv_attr",
         pool->def->source.name, NULL
     };
 

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