[libvirt PATCH v3 21/25] qemuDomainGetImageIds: pass domain definition directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We only need the domain definition from domain object. This will allow
us to use it from snapshot code where we need to pass different domain
definition.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/qemu/qemu_backup.c   | 2 +-
 src/qemu/qemu_blockjob.c | 2 +-
 src/qemu/qemu_domain.c   | 8 ++++----
 src/qemu/qemu_domain.h   | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c
index 3be33193f4..a94869522d 100644
--- a/src/qemu/qemu_backup.c
+++ b/src/qemu/qemu_backup.c
@@ -586,7 +586,7 @@ qemuBackupJobTerminate(virDomainObj *vm,
             if (!cfg)
                 cfg = virQEMUDriverGetConfig(priv->driver);
 
-            qemuDomainGetImageIds(cfg, vm, backupdisk->store, NULL, &uid, &gid);
+            qemuDomainGetImageIds(cfg, vm->def, backupdisk->store, NULL, &uid, &gid);
 
             if (virFileRemove(backupdisk->store->path, uid, gid) < 0)
                 VIR_WARN("failed to remove scratch file '%s'",
diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c
index 1cac17c5c0..f1d22df59f 100644
--- a/src/qemu/qemu_blockjob.c
+++ b/src/qemu/qemu_blockjob.c
@@ -932,7 +932,7 @@ qemuBlockJobDeleteImages(virQEMUDriver *driver,
     for (; p != NULL; p = p->backingStore) {
         if (virStorageSourceGetActualType(p) == VIR_STORAGE_TYPE_FILE) {
 
-            qemuDomainGetImageIds(cfg, vm, p, disk->src, &uid, &gid);
+            qemuDomainGetImageIds(cfg, vm->def, p, disk->src, &uid, &gid);
 
             if (virFileRemove(p->path, uid, gid) < 0) {
                 VIR_WARN("Unable to remove snapshot image file '%s' (%s)",
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 029238a9d7..0bb1fafdec 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -7719,7 +7719,7 @@ qemuDomainCleanupRun(virQEMUDriver *driver,
 
 void
 qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
-                      virDomainObj *vm,
+                      virDomainDef *def,
                       virStorageSource *src,
                       virStorageSource *parentSrc,
                       uid_t *uid, gid_t *gid)
@@ -7740,7 +7740,7 @@ qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
             *gid = cfg->group;
     }
 
-    if (vm && (vmlabel = virDomainDefGetSecurityLabelDef(vm->def, "dac")) &&
+    if ((vmlabel = virDomainDefGetSecurityLabelDef(def, "dac")) &&
         vmlabel->label)
         virParseOwnershipIds(vmlabel->label, uid, gid);
 
@@ -7765,7 +7765,7 @@ qemuDomainStorageFileInit(virQEMUDriver *driver,
     uid_t uid;
     gid_t gid;
 
-    qemuDomainGetImageIds(cfg, vm, src, parent, &uid, &gid);
+    qemuDomainGetImageIds(cfg, vm->def, src, parent, &uid, &gid);
 
     if (virStorageSourceInitAs(src, uid, gid) < 0)
         return -1;
@@ -7958,7 +7958,7 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver,
         return 0;
     }
 
-    qemuDomainGetImageIds(cfg, vm, src, disksrc, &uid, &gid);
+    qemuDomainGetImageIds(cfg, vm->def, src, disksrc, &uid, &gid);
 
     if (virStorageSourceGetMetadata(src, uid, gid,
                                     QEMU_DOMAIN_STORAGE_SOURCE_CHAIN_MAX_DEPTH,
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 999190e381..7ac1cdd6be 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -738,7 +738,7 @@ bool qemuDomainDiskChangeSupported(virDomainDiskDef *disk,
                                    virDomainDiskDef *orig_disk);
 
 void qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
-                           virDomainObj *vm,
+                           virDomainDef *def,
                            virStorageSource *src,
                            virStorageSource *parentSrc,
                            uid_t *uid,
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux