qemuDomainGetImageIds: pass domain definition directly

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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Pavel Hrdina 2023-08-11 14:49:21 +02:00
parent f879eae3e7
commit 47821b2ff5
4 changed files with 7 additions and 7 deletions

View File

@ -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'",

View File

@ -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)",

View File

@ -7762,7 +7762,7 @@ qemuDomainCleanupRun(virQEMUDriver *driver,
void
qemuDomainGetImageIds(virQEMUDriverConfig *cfg,
virDomainObj *vm,
virDomainDef *def,
virStorageSource *src,
virStorageSource *parentSrc,
uid_t *uid, gid_t *gid)
@ -7783,7 +7783,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);
@ -7808,7 +7808,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;
@ -8001,7 +8001,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,

View File

@ -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,