From 1a828a578e03b9b7a298c92af43b6bc17c240470 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 18 Apr 2019 09:41:38 +0200 Subject: [PATCH] qemu: Rename qemuDomainDiskChainElement(Revoke|Prepare) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use qemuDomainStorageSourceAccess(Allow|Revoke) instead. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/qemu/qemu_domain.c | 20 ++++++++++---------- src/qemu/qemu_domain.h | 16 ++++++++-------- src/qemu/qemu_driver.c | 24 ++++++++++++------------ 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index db67fe2193..7f5264acad 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9212,15 +9212,15 @@ qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk, /** - * qemuDomainDiskChainElementRevoke: + * qemuDomainStorageSourceAccessRevoke: * * Revoke access to a single backing chain element. This restores the labels, * removes cgroup ACLs for devices and removes locks. */ void -qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virStorageSourcePtr elem) +qemuDomainStorageSourceAccessRevoke(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virStorageSourcePtr elem) { if (qemuTeardownImageCgroup(vm, elem) < 0) VIR_WARN("Failed to teardown cgroup for disk path %s", @@ -9238,7 +9238,7 @@ qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, /** - * qemuDomainDiskChainElementPrepare: + * qemuDomainStorageSourceAccessAllow: * @driver: qemu driver data * @vm: domain object * @elem: source structure to set access for @@ -9253,11 +9253,11 @@ qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, * backing chain) @newSource needs to be set to false. */ int -qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virStorageSourcePtr elem, - bool readonly, - bool newSource) +qemuDomainStorageSourceAccessAllow(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virStorageSourcePtr elem, + bool readonly, + bool newSource) { bool was_readonly = elem->readonly; virQEMUDriverConfigPtr cfg = NULL; diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 06640a9510..9a48b5b69d 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -770,14 +770,14 @@ int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK; -void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virStorageSourcePtr elem); -int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver, - virDomainObjPtr vm, - virStorageSourcePtr elem, - bool readonly, - bool newSource); +void qemuDomainStorageSourceAccessRevoke(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virStorageSourcePtr elem); +int qemuDomainStorageSourceAccessAllow(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virStorageSourcePtr elem, + bool readonly, + bool newSource); int qemuDomainCleanupAdd(virDomainObjPtr vm, qemuDomainCleanupCallback cb); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 27be173e46..91b709141f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15022,7 +15022,7 @@ struct _qemuDomainSnapshotDiskData { virStorageSourcePtr src; bool initialized; /* @src was initialized in the storage driver */ bool created; /* @src was created by the snapshot code */ - bool prepared; /* @src was prepared using qemuDomainDiskChainElementPrepare */ + bool prepared; /* @src was prepared using qemuDomainStorageSourceAccessAllow */ virDomainDiskDefPtr disk; char *relPath; /* relative path component to fill into original disk */ @@ -15053,7 +15053,7 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshotDiskDataPtr data, virStorageFileDeinit(data[i].src); if (data[i].prepared) - qemuDomainDiskChainElementRevoke(driver, vm, data[i].src); + qemuDomainStorageSourceAccessRevoke(driver, vm, data[i].src); virObjectUnref(data[i].src); } @@ -15213,8 +15213,8 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver, } /* set correct security, cgroup and locking options on the new image */ - if (qemuDomainDiskChainElementPrepare(driver, vm, dd->src, false, true) < 0) { - qemuDomainDiskChainElementRevoke(driver, vm, dd->src); + if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, true) < 0) { + qemuDomainStorageSourceAccessRevoke(driver, vm, dd->src); goto cleanup; } @@ -15311,7 +15311,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver, continue; if (diskdata[i].prepared) - qemuDomainDiskChainElementRevoke(driver, vm, diskdata[i].src); + qemuDomainStorageSourceAccessRevoke(driver, vm, diskdata[i].src); if (diskdata[i].created && virStorageFileUnlink(diskdata[i].src) < 0) @@ -17749,8 +17749,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, qemuSecuritySetImageLabel(driver, vm, mirror, true) < 0) goto endjob; } else { - if (qemuDomainDiskChainElementPrepare(driver, vm, mirror, false, true) < 0) { - qemuDomainDiskChainElementRevoke(driver, vm, mirror); + if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, true) < 0) { + qemuDomainStorageSourceAccessRevoke(driver, vm, mirror); goto endjob; } } @@ -17771,7 +17771,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, ret = -1; if (ret < 0) { monitor_error = virSaveLastError(); - qemuDomainDiskChainElementRevoke(driver, vm, mirror); + qemuDomainStorageSourceAccessRevoke(driver, vm, mirror); goto endjob; } @@ -18146,9 +18146,9 @@ qemuDomainBlockCommit(virDomainPtr dom, * operation succeeds, but doing that requires tracking the * operation in XML across libvirtd restarts. */ clean_access = true; - if (qemuDomainDiskChainElementPrepare(driver, vm, baseSource, false, false) < 0 || + if (qemuDomainStorageSourceAccessAllow(driver, vm, baseSource, false, false) < 0 || (top_parent && top_parent != disk->src && - qemuDomainDiskChainElementPrepare(driver, vm, top_parent, false, false) < 0)) + qemuDomainStorageSourceAccessAllow(driver, vm, top_parent, false, false) < 0)) goto endjob; if (!(job = qemuBlockJobDiskNew(disk, jobtype, device))) @@ -18189,9 +18189,9 @@ qemuDomainBlockCommit(virDomainPtr dom, if (ret < 0 && clean_access) { virErrorPtr orig_err = virSaveLastError(); /* Revert access to read-only, if possible. */ - qemuDomainDiskChainElementPrepare(driver, vm, baseSource, true, false); + qemuDomainStorageSourceAccessAllow(driver, vm, baseSource, true, false); if (top_parent && top_parent != disk->src) - qemuDomainDiskChainElementPrepare(driver, vm, top_parent, true, false); + qemuDomainStorageSourceAccessAllow(driver, vm, top_parent, true, false); if (orig_err) { virSetError(orig_err);