>From 052a5b1a87c090093fda1d6591fb4d37a1cb8c3c Mon Sep 17 00:00:00 2001
From: Matthias Gatto <matthias.ga...@outscale.com>
Date: Tue, 17 Mar 2015 20:25:36 +0100
Subject: [PATCH 3/5] virstoragefile: Add virStorageSourceSetBackingStore

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.ga...@outscale.com>
Signed-off-by: John Ferlan <jfer...@redhat.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 f3f956e..aa14f19 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2125,6 +2125,7 @@ virStorageSourceParseRBDColonString;
 virStorageSourcePoolDefFree;
 virStorageSourcePoolModeTypeFromString;
 virStorageSourcePoolModeTypeToString;
+virStorageSourceSetBackingStore;
 virStorageTypeFromString;
 virStorageTypeToString;
 
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index dcaf67b..ded02f3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1806,6 +1806,16 @@ virStorageSourceGetBackingStore(const virStorageSource *src,
 }
 
 
+bool
+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 4262b36..5f76324 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -289,6 +289,9 @@ struct _virStorageSource {
 #  define DEV_BSIZE 512
 # endif
 
+bool virStorageSourceSetBackingStore(virStorageSourcePtr src,
+                                                    virStorageSourcePtr backingStore,
+                                                    size_t pos);
 virStorageSourcePtr virStorageSourceGetBackingStore(const virStorageSource *src,
                                                     size_t pos);
 
-- 
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to