[libvirt] [PATCH 3/9] virstoragefile: Add virStorageSourceSetBackingStore

Matthias Gatto matthias.gatto at outscale.com
Mon Dec 8 18:31:05 UTC 2014


As explained for virStorageSourceGetBackingStore, quorum allows
multiple backing store, this make the operation to set bs complex
because we have to check if the backingStore is used as an array
or a pointer, and set it differently in both case.

In order to help the manipulation of backing store, I've added a
function virStorageSourceSetBackingStore.

For now virStorageSourceSetBackingStore don't handle the case where
we have more than one backing store in virStorageSource.

Signed-off-by: Matthias Gatto <matthias.gatto at outscale.com>
---
 src/libvirt_private.syms  |  1 +
 src/util/virstoragefile.c | 10 ++++++++++
 src/util/virstoragefile.h |  3 +++
 3 files changed, 14 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 12dd399..dd83518 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2002,6 +2002,7 @@ virStorageSourceParseRBDColonString;
 virStorageSourcePoolDefFree;
 virStorageSourcePoolModeTypeFromString;
 virStorageSourcePoolModeTypeToString;
+virStorageSourceSetBackingStore;
 virStorageTypeFromString;
 virStorageTypeToString;
 
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index fd0e68c..88b0ce6 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1822,6 +1822,16 @@ virStorageSourceGetBackingStore(const virStorageSource *src,
 }
 
 
+virStorageSourcePtr
+virStorageSourceSetBackingStore(virStorageSourcePtr src,
+                                virStorageSourcePtr backingStore,
+                                size_t pos ATTRIBUTE_UNUSED)
+{
+    src->backingStore = backingStore;
+    return src->backingStore;
+}
+
+
 /**
  * virStorageSourcePtr:
  *
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index fe07dde..4cba66b 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -288,6 +288,9 @@ struct _virStorageSource {
 #  define DEV_BSIZE 512
 # endif
 
+virStorageSourcePtr virStorageSourceSetBackingStore(virStorageSourcePtr src,
+                                                    virStorageSourcePtr backingStore,
+                                                    size_t pos);
 virStorageSourcePtr virStorageSourceGetBackingStore(const virStorageSource *src,
                                                     size_t pos);
 
-- 
1.8.3.1




More information about the libvir-list mailing list