]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
storage: Add gluster pool filter and fix virsh pool listing
authorPeter Krempa <pkrempa@redhat.com>
Fri, 13 Dec 2013 09:31:50 +0000 (10:31 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 19 Dec 2013 10:01:50 +0000 (11:01 +0100)
Recent addition of the gluster pool type omitted fixing the virsh and
virConnectListAllStoragePool filters. A typecast of the converting
function in virsh showed that also the sheepdog pool was omitted in the
command parser.

This patch adds gluster pool filtering support and fixes virsh to
properly convert all supported storage pool types. The added typecast
should avoid doing such mistakes in the future.

include/libvirt/libvirt.h.in
src/conf/storage_conf.c
tools/virsh-pool.c
tools/virsh.pod

index 6f79c49359c298aa386510e38c2ada244ca27e29..aa042b472975a98ae3dae4dcf7217a8809f68979 100644 (file)
@@ -3056,6 +3056,7 @@ typedef enum {
     VIR_CONNECT_LIST_STORAGE_POOLS_MPATH         = 1 << 13,
     VIR_CONNECT_LIST_STORAGE_POOLS_RBD           = 1 << 14,
     VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG      = 1 << 15,
+    VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER       = 1 << 16,
 } virConnectListAllStoragePoolsFlags;
 
 int                     virConnectListAllStoragePools(virConnectPtr conn,
index 22e38c13ee02932affba0882c9007623865beaec..ed492cfde28c0f0aef1d4067c80c7e4be65d82b9 100644 (file)
@@ -2217,7 +2217,9 @@ virStoragePoolMatch(virStoragePoolObjPtr poolobj,
               (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_RBD) &&
                (poolobj->def->type == VIR_STORAGE_POOL_RBD))     ||
               (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG) &&
-               (poolobj->def->type == VIR_STORAGE_POOL_SHEEPDOG))))
+               (poolobj->def->type == VIR_STORAGE_POOL_SHEEPDOG)) ||
+              (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER) &&
+               (poolobj->def->type == VIR_STORAGE_POOL_GLUSTER))))
             return false;
     }
 
index 18fe242a3f41f57474a2b8f719a9fac7555c8160..ac645eabc4a4f27cb8b836ca7eb45f977b9d1097 100644 (file)
@@ -1006,7 +1006,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
                 return false;
             }
 
-            switch (poolType) {
+            switch ((enum virStoragePoolType) poolType) {
             case VIR_STORAGE_POOL_DIR:
                 flags |= VIR_CONNECT_LIST_STORAGE_POOLS_DIR;
                 break;
@@ -1034,7 +1034,13 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
             case VIR_STORAGE_POOL_RBD:
                 flags |= VIR_CONNECT_LIST_STORAGE_POOLS_RBD;
                 break;
-            default:
+            case VIR_STORAGE_POOL_SHEEPDOG:
+                flags |= VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG;
+                break;
+            case VIR_STORAGE_POOL_GLUSTER:
+                flags |= VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER;
+                break;
+            case VIR_STORAGE_POOL_LAST:
                 break;
             }
         }
index 59213c69df9d50ee135d781f49c5d274143b3e88..3534b5402ba6b3913f235dc68f494fa84f26a9cd 100644 (file)
@@ -2589,7 +2589,7 @@ with autostarting disabled.
 You may also want to list pools with specified types using I<type>, the
 pool types must be separated by comma, e.g. --type dir,disk. The valid pool
 types include 'dir', 'fs', 'netfs', 'logical', 'disk', 'iscsi', 'scsi',
-'mpath', 'rbd', and 'sheepdog'.
+'mpath', 'rbd', 'sheepdog' and 'gluster'.
 
 The I<--details> option instructs virsh to additionally
 display pool persistence and capacity related information where available.