[libvirt] [PATCH 1/2] storage: Directory shouldn't be listed as type 'file'

Peter Krempa pkrempa at redhat.com
Thu Aug 11 09:37:17 UTC 2011


Fix internals of libvirt for new storage volume type.
Libvirt reported an invalid type of the volume.

BZ #727088
---
 include/libvirt/libvirt.h.in     |    1 +
 src/storage/storage_backend_fs.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index b1bda31..aa29fb6 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1705,6 +1705,7 @@ typedef virStorageVol *virStorageVolPtr;
 typedef enum {
   VIR_STORAGE_VOL_FILE = 0,     /* Regular file based volumes */
   VIR_STORAGE_VOL_BLOCK = 1,    /* Block based volumes */
+  VIR_STORAGE_VOL_DIR = 2,      /* Directory-passthrough based volume */
 } virStorageVolType;

 typedef enum {
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 058e00c..ff5afaa 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -675,6 +675,10 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
                 goto cleanup;
         }

+        /* directory based volume */
+        if (vol->target.format == VIR_STORAGE_FILE_DIR)
+            vol->type = VIR_STORAGE_VOL_DIR;
+
         if (backingStore != NULL) {
             vol->backingStore.path = backingStore;
             vol->backingStore.format = backingStoreFormat;
-- 
1.7.6




More information about the libvir-list mailing list