Re: [libvirt] [PATCH 4/9] virstoragefile: Always use virStorageSourceSetBackingStore to set backing store

2015-01-13 Thread Michal Privoznik

On 08.12.2014 19:31, Matthias Gatto wrote:

Replace the parts of the code where a backing store is set manually
with virStorageSourceSetBackingStore

Signed-off-by: Matthias Gatto matthias.ga...@outscale.com
---
  src/conf/domain_conf.c   | 2 +-
  src/qemu/qemu_domain.c   | 1 -
  src/qemu/qemu_driver.c   | 4 ++--
  src/storage/storage_backend_fs.c | 2 +-
  src/storage/storage_driver.c | 2 +-
  src/util/virstoragefile.c| 8 +---
  tests/virstoragetest.c   | 4 ++--
  7 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b790fc5..00e0470 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5523,7 +5523,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
  virDomainDiskBackingStoreParse(ctxt, backingStore)  0)
  goto cleanup;

-src-backingStore = backingStore;
+virStorageSourceSetBackingStore(src, backingStore, 0);
  ret = 0;

   cleanup:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9157e4d..458ceb0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2534,7 +2534,6 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
  int ret = -1;
  size_t i;

-VIR_DEBUG(Checking for disk presence);


This is rather unrelated.


  for (i = vm-def-ndisks; i  0; i--) {
  size_t idx = i - 1;
  virDomainDiskDefPtr disk = vm-def-disks[idx];


Michal

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


[libvirt] [PATCH 4/9] virstoragefile: Always use virStorageSourceSetBackingStore to set backing store

2014-12-08 Thread Matthias Gatto
Replace the parts of the code where a backing store is set manually
with virStorageSourceSetBackingStore

Signed-off-by: Matthias Gatto matthias.ga...@outscale.com
---
 src/conf/domain_conf.c   | 2 +-
 src/qemu/qemu_domain.c   | 1 -
 src/qemu/qemu_driver.c   | 4 ++--
 src/storage/storage_backend_fs.c | 2 +-
 src/storage/storage_driver.c | 2 +-
 src/util/virstoragefile.c| 8 +---
 tests/virstoragetest.c   | 4 ++--
 7 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b790fc5..00e0470 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5523,7 +5523,7 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ctxt,
 virDomainDiskBackingStoreParse(ctxt, backingStore)  0)
 goto cleanup;
 
-src-backingStore = backingStore;
+virStorageSourceSetBackingStore(src, backingStore, 0);
 ret = 0;
 
  cleanup:
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 9157e4d..458ceb0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2534,7 +2534,6 @@ qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
 int ret = -1;
 size_t i;
 
-VIR_DEBUG(Checking for disk presence);
 for (i = vm-def-ndisks; i  0; i--) {
 size_t idx = i - 1;
 virDomainDiskDefPtr disk = vm-def-disks[idx];
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9ed5035..8e3a492 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13497,13 +13497,13 @@ 
qemuDomainSnapshotUndoSingleDiskActive(virQEMUDriverPtr driver,
 /* Update vm in place to match changes. */
 tmp = disk-src;
 disk-src = virStorageSourceGetBackingStore(tmp, 0);
-tmp-backingStore = NULL;
+virStorageSourceSetBackingStore(tmp, NULL, 0);
 virStorageSourceFree(tmp);
 
 if (persistDisk) {
 tmp = persistDisk-src;
 persistDisk-src = virStorageSourceGetBackingStore(tmp, 0);
-tmp-backingStore = NULL;
+virStorageSourceSetBackingStore(tmp, NULL, 0);
 virStorageSourceFree(tmp);
 }
 }
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index d7bd1fb..07fd6ee 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -96,7 +96,7 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
 goto cleanup;
 
 if (meta-backingStoreRaw) {
-if (!(target-backingStore = virStorageSourceNewFromBacking(meta)))
+if (!virStorageSourceSetBackingStore(target, 
virStorageSourceNewFromBacking(meta), 0))
 goto cleanup;
 
 target-backingStore-format = backingStoreFormat;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 66dc994..eeb2a4c 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2899,7 +2899,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
 goto cleanup;
 }
 
-src-backingStore = backingStore;
+virStorageSourceSetBackingStore(src, backingStore, 0);
 backingStore = NULL;
 ret = 0;
 
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 88b0ce6..20f45f3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1906,8 +1906,10 @@ virStorageSourceCopy(const virStorageSource *src,
 goto error;
 
 if (backingChain  virStorageSourceGetBackingStore(src, 0)) {
-if (!(ret-backingStore = 
virStorageSourceCopy(virStorageSourceGetBackingStore(src, 0),
-   true)))
+if (!virStorageSourceSetBackingStore(ret,
+ 
virStorageSourceCopy(virStorageSourceGetBackingStore(src, 0),
+  true),
+ 0))
 goto error;
 }
 
@@ -2044,7 +2046,7 @@ virStorageSourceBackingStoreClear(virStorageSourcePtr def)
 
 /* recursively free backing chain */
 virStorageSourceFree(virStorageSourceGetBackingStore(def, 0));
-def-backingStore = NULL;
+virStorageSourceSetBackingStore(def, NULL, 0);
 }
 
 
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index 12670da..b7820d4 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -583,9 +583,9 @@ testPathRelativePrepare(void)
 
 for (i = 0; i  ARRAY_CARDINALITY(backingchain); i++) {
 if (i  ARRAY_CARDINALITY(backingchain) - 1)
-backingchain[i].backingStore = backingchain[i + 1];
+virStorageSourceSetBackingStore(backingchain[i], backingchain[i 
+ 1], 0);
 else
-backingchain[i].backingStore = NULL;
+virStorageSourceSetBackingStore(backingchain[i], NULL, 0);
 
 backingchain[i].relPath = NULL;
 }
-- 
1.8.3.1

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