[libvirt] [PATCH 5/6] storage: fs: Properly parse backing store info

Peter Krempa pkrempa at redhat.com
Tue Jul 15 13:25:18 UTC 2014


Use the backing store parser to properly create the information about a
volume's backing store. Unfortunately as the storage driver isn't
perpared to allow volumes backed by networked filesystems add a
workaroud that will avoid changing the XML output.
---
 src/storage/storage_backend_fs.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 0d01dca..728e640 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -96,16 +96,27 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
         goto cleanup;

     if (meta->backingStoreRaw) {
-        if (VIR_ALLOC(target->backingStore) < 0)
+        if (!(target->backingStore = virStorageSourceNewFromBacking(meta)))
             goto cleanup;

-        target->backingStore->path = meta->backingStoreRaw;
-        meta->backingStoreRaw = NULL;
         target->backingStore->format = backingStoreFormat;

+        /* XXX: Remote storage doesn't play nicely with volumes backed by
+         * remote storage. To avoid trouble, just fake the ou */
+        if (!virStorageSourceIsLocalStorage(target->backingStore)) {
+            virStorageSourceFree(target->backingStore);
+
+            if (VIR_ALLOC(target->backingStore) < 0)
+                goto cleanup;
+
+            target->backingStore->type = VIR_STORAGE_TYPE_FILE;
+            target->backingStore->path = meta->backingStoreRaw;
+            meta->backingStoreRaw = NULL;
+            target->backingStore->format = VIR_STORAGE_FILE_RAW;
+        }
+
         if (target->backingStore->format == VIR_STORAGE_FILE_AUTO) {
-            if (!virStorageIsFile(target->backingStore->path) ||
-                (rc = virStorageFileProbeFormat(target->backingStore->path,
+                if ((rc = virStorageFileProbeFormat(target->backingStore->path,
                                                     -1, -1)) < 0) {
                 /* If the backing file is currently unavailable or is
                  * accessed via remote protocol only log an error, fake the
-- 
2.0.0




More information about the libvir-list mailing list