Re: [libvirt] [PATCH 2/9] virstoragefile: Always use virStorageSourceGetBackingStore to get backing store

2015-01-13 Thread Michal Privoznik

On 08.12.2014 19:31, Matthias Gatto wrote:

Uniformize backing store usage by calling virStorageSourceGetBackingStore
instead of setting backing store manually.

Signed-off-by: Matthias Gatto matthias.ga...@outscale.com
---
  src/conf/domain_conf.c|  7 ---
  src/conf/storage_conf.c   |  4 ++--
  src/qemu/qemu_cgroup.c|  4 ++--
  src/qemu/qemu_domain.c|  2 +-
  src/qemu/qemu_driver.c| 12 ++--
  src/security/security_dac.c   |  2 +-
  src/security/security_selinux.c   |  4 ++--
  src/security/virt-aa-helper.c |  2 +-
  src/storage/storage_backend.c | 12 ++--
  src/storage/storage_backend_fs.c  |  8 
  src/storage/storage_backend_logical.c |  2 +-
  src/util/virstoragefile.c | 20 ++--
  tests/virstoragetest.c| 14 +++---
  13 files changed, 47 insertions(+), 46 deletions(-)




diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 869bf18..3bd82bb 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -941,7 +941,7 @@ get_files(vahControl * ctl)
  /* XXX - if we knew the qemu user:group here we could send it in
   *so that the open could be re-tried as that user:group.
   */
-if (!disk-src-backingStore) {
+if (!virStorageSourceGetBackingStore(disk-src)) {


s/disk-src/disk-src, 0/


  bool probe = ctl-allowDiskFormatProbing;
  virStorageFileGetMetadata(disk-src, -1, -1, probe, false);
  }


Michal

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


[libvirt] [PATCH 2/9] virstoragefile: Always use virStorageSourceGetBackingStore to get backing store

2014-12-08 Thread Matthias Gatto
Uniformize backing store usage by calling virStorageSourceGetBackingStore
instead of setting backing store manually.

Signed-off-by: Matthias Gatto matthias.ga...@outscale.com
---
 src/conf/domain_conf.c|  7 ---
 src/conf/storage_conf.c   |  4 ++--
 src/qemu/qemu_cgroup.c|  4 ++--
 src/qemu/qemu_domain.c|  2 +-
 src/qemu/qemu_driver.c| 12 ++--
 src/security/security_dac.c   |  2 +-
 src/security/security_selinux.c   |  4 ++--
 src/security/virt-aa-helper.c |  2 +-
 src/storage/storage_backend.c | 12 ++--
 src/storage/storage_backend_fs.c  |  8 
 src/storage/storage_backend_logical.c |  2 +-
 src/util/virstoragefile.c | 20 ++--
 tests/virstoragetest.c| 14 +++---
 13 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 2d81c37..b790fc5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16473,7 +16473,7 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf,
 /* We currently don't output seclabels for backing chain element */
 if (virDomainDiskSourceFormatInternal(buf, backingStore, 0, 0, true)  0 ||
 virDomainDiskBackingStoreFormat(buf,
-backingStore-backingStore,
+
virStorageSourceGetBackingStore(backingStore, 0),
 backingStore-backingStoreRaw,
 idx + 1)  0)
 return -1;
@@ -16595,7 +16595,8 @@ virDomainDiskDefFormat(virBufferPtr buf,
 /* Don't format backingStore to inactive XMLs until the code for
  * persistent storage of backing chains is ready. */
 if (!(flags  VIR_DOMAIN_XML_INACTIVE) 
-virDomainDiskBackingStoreFormat(buf, def-src-backingStore,
+virDomainDiskBackingStoreFormat(buf,
+
virStorageSourceGetBackingStore(def-src, 0),
 def-src-backingStoreRaw, 1)  0)
 return -1;
 
@@ -20554,7 +20555,7 @@ virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
 }
 }
 
-for (tmp = disk-src; tmp; tmp = tmp-backingStore) {
+for (tmp = disk-src; tmp; tmp = virStorageSourceGetBackingStore(tmp, 0)) {
 int actualType = virStorageSourceGetActualType(tmp);
 /* execute the callback only for local storage */
 if (actualType != VIR_STORAGE_TYPE_NETWORK 
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3987470..a8a90b4 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1642,9 +1642,9 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
  def-target, target)  0)
 goto cleanup;
 
-if (def-target.backingStore 
+if (virStorageSourceGetBackingStore((def-target), 0) 
 virStorageVolTargetDefFormat(options, buf,
- def-target.backingStore,
+ 
virStorageSourceGetBackingStore((def-target), 0),
  backingStore)  0)
 goto cleanup;
 
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 0e94cae..f878f4b 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -120,7 +120,7 @@ qemuSetupDiskCgroup(virDomainObjPtr vm,
 virStorageSourcePtr next;
 bool forceReadonly = false;
 
-for (next = disk-src; next; next = next-backingStore) {
+for (next = disk-src; next; next = virStorageSourceGetBackingStore(next, 
0)) {
 if (qemuSetImageCgroupInternal(vm, next, false, forceReadonly)  0)
 return -1;
 
@@ -138,7 +138,7 @@ qemuTeardownDiskCgroup(virDomainObjPtr vm,
 {
 virStorageSourcePtr next;
 
-for (next = disk-src; next; next = next-backingStore) {
+for (next = disk-src; next; next = virStorageSourceGetBackingStore(next, 
0)) {
 if (qemuSetImageCgroup(vm, next, true)  0)
 return -1;
 }
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 220304f..9157e4d 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2708,7 +2708,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
 if (virStorageSourceIsEmpty(disk-src))
 goto cleanup;
 
-if (disk-src-backingStore) {
+if (virStorageSourceGetBackingStore(disk-src, 0)) {
 if (force_probe)
 virStorageSourceBackingStoreClear(disk-src);
 else
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 9152cf5..9ed5035 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13496,13 +13496,13 @@ 
qemuDomainSnapshotUndoSingleDiskActive(virQEMUDriverPtr driver,
 
 /* Update vm in place to match changes. */
 tmp = disk-src;
-disk-src = tmp-backingStore;
+disk-src =