Use qemuDomainStorageSourceAccess(Allow|Revoke) instead.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
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 960aaff3c7..ce8f4a0dca 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 c443c881d5..b038bfc360 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15025,7 +15025,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 */
@@ -15056,7 +15056,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);
}
@@ -15216,8 +15216,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;
}
@@ -15314,7 +15314,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)
@@ -17752,8 +17752,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;
}
}
@@ -17774,7 +17774,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
ret = -1;
if (ret < 0) {
monitor_error = virSaveLastError();
- qemuDomainDiskChainElementRevoke(driver, vm, mirror);
+ qemuDomainStorageSourceAccessRevoke(driver, vm, mirror);
goto endjob;
}
@@ -18149,9 +18149,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)))
@@ -18192,9 +18192,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);
--
2.20.1