qemu: Rename qemuDomainDiskChainElement(Revoke|Prepare)

Use qemuDomainStorageSourceAccess(Allow|Revoke) instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-04-18 09:41:38 +02:00
parent 8a1179831b
commit 1a828a578e
3 changed files with 30 additions and 30 deletions

View File

@ -9212,15 +9212,15 @@ qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
/** /**
* qemuDomainDiskChainElementRevoke: * qemuDomainStorageSourceAccessRevoke:
* *
* Revoke access to a single backing chain element. This restores the labels, * Revoke access to a single backing chain element. This restores the labels,
* removes cgroup ACLs for devices and removes locks. * removes cgroup ACLs for devices and removes locks.
*/ */
void void
qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, qemuDomainStorageSourceAccessRevoke(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virStorageSourcePtr elem) virStorageSourcePtr elem)
{ {
if (qemuTeardownImageCgroup(vm, elem) < 0) if (qemuTeardownImageCgroup(vm, elem) < 0)
VIR_WARN("Failed to teardown cgroup for disk path %s", VIR_WARN("Failed to teardown cgroup for disk path %s",
@ -9238,7 +9238,7 @@ qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
/** /**
* qemuDomainDiskChainElementPrepare: * qemuDomainStorageSourceAccessAllow:
* @driver: qemu driver data * @driver: qemu driver data
* @vm: domain object * @vm: domain object
* @elem: source structure to set access for * @elem: source structure to set access for
@ -9253,11 +9253,11 @@ qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
* backing chain) @newSource needs to be set to false. * backing chain) @newSource needs to be set to false.
*/ */
int int
qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver, qemuDomainStorageSourceAccessAllow(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virStorageSourcePtr elem, virStorageSourcePtr elem,
bool readonly, bool readonly,
bool newSource) bool newSource)
{ {
bool was_readonly = elem->readonly; bool was_readonly = elem->readonly;
virQEMUDriverConfigPtr cfg = NULL; virQEMUDriverConfigPtr cfg = NULL;

View File

@ -770,14 +770,14 @@ int qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK; ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
void qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver, void qemuDomainStorageSourceAccessRevoke(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virStorageSourcePtr elem); virStorageSourcePtr elem);
int qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver, int qemuDomainStorageSourceAccessAllow(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virStorageSourcePtr elem, virStorageSourcePtr elem,
bool readonly, bool readonly,
bool newSource); bool newSource);
int qemuDomainCleanupAdd(virDomainObjPtr vm, int qemuDomainCleanupAdd(virDomainObjPtr vm,
qemuDomainCleanupCallback cb); qemuDomainCleanupCallback cb);

View File

@ -15022,7 +15022,7 @@ struct _qemuDomainSnapshotDiskData {
virStorageSourcePtr src; virStorageSourcePtr src;
bool initialized; /* @src was initialized in the storage driver */ bool initialized; /* @src was initialized in the storage driver */
bool created; /* @src was created by the snapshot code */ 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; virDomainDiskDefPtr disk;
char *relPath; /* relative path component to fill into original disk */ char *relPath; /* relative path component to fill into original disk */
@ -15053,7 +15053,7 @@ qemuDomainSnapshotDiskDataFree(qemuDomainSnapshotDiskDataPtr data,
virStorageFileDeinit(data[i].src); virStorageFileDeinit(data[i].src);
if (data[i].prepared) if (data[i].prepared)
qemuDomainDiskChainElementRevoke(driver, vm, data[i].src); qemuDomainStorageSourceAccessRevoke(driver, vm, data[i].src);
virObjectUnref(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 */ /* set correct security, cgroup and locking options on the new image */
if (qemuDomainDiskChainElementPrepare(driver, vm, dd->src, false, true) < 0) { if (qemuDomainStorageSourceAccessAllow(driver, vm, dd->src, false, true) < 0) {
qemuDomainDiskChainElementRevoke(driver, vm, dd->src); qemuDomainStorageSourceAccessRevoke(driver, vm, dd->src);
goto cleanup; goto cleanup;
} }
@ -15311,7 +15311,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
continue; continue;
if (diskdata[i].prepared) if (diskdata[i].prepared)
qemuDomainDiskChainElementRevoke(driver, vm, diskdata[i].src); qemuDomainStorageSourceAccessRevoke(driver, vm, diskdata[i].src);
if (diskdata[i].created && if (diskdata[i].created &&
virStorageFileUnlink(diskdata[i].src) < 0) virStorageFileUnlink(diskdata[i].src) < 0)
@ -17749,8 +17749,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
qemuSecuritySetImageLabel(driver, vm, mirror, true) < 0) qemuSecuritySetImageLabel(driver, vm, mirror, true) < 0)
goto endjob; goto endjob;
} else { } else {
if (qemuDomainDiskChainElementPrepare(driver, vm, mirror, false, true) < 0) { if (qemuDomainStorageSourceAccessAllow(driver, vm, mirror, false, true) < 0) {
qemuDomainDiskChainElementRevoke(driver, vm, mirror); qemuDomainStorageSourceAccessRevoke(driver, vm, mirror);
goto endjob; goto endjob;
} }
} }
@ -17771,7 +17771,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm,
ret = -1; ret = -1;
if (ret < 0) { if (ret < 0) {
monitor_error = virSaveLastError(); monitor_error = virSaveLastError();
qemuDomainDiskChainElementRevoke(driver, vm, mirror); qemuDomainStorageSourceAccessRevoke(driver, vm, mirror);
goto endjob; goto endjob;
} }
@ -18146,9 +18146,9 @@ qemuDomainBlockCommit(virDomainPtr dom,
* operation succeeds, but doing that requires tracking the * operation succeeds, but doing that requires tracking the
* operation in XML across libvirtd restarts. */ * operation in XML across libvirtd restarts. */
clean_access = true; 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 && (top_parent && top_parent != disk->src &&
qemuDomainDiskChainElementPrepare(driver, vm, top_parent, false, false) < 0)) qemuDomainStorageSourceAccessAllow(driver, vm, top_parent, false, false) < 0))
goto endjob; goto endjob;
if (!(job = qemuBlockJobDiskNew(disk, jobtype, device))) if (!(job = qemuBlockJobDiskNew(disk, jobtype, device)))
@ -18189,9 +18189,9 @@ qemuDomainBlockCommit(virDomainPtr dom,
if (ret < 0 && clean_access) { if (ret < 0 && clean_access) {
virErrorPtr orig_err = virSaveLastError(); virErrorPtr orig_err = virSaveLastError();
/* Revert access to read-only, if possible. */ /* 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) if (top_parent && top_parent != disk->src)
qemuDomainDiskChainElementPrepare(driver, vm, top_parent, true, false); qemuDomainStorageSourceAccessAllow(driver, vm, top_parent, true, false);
if (orig_err) { if (orig_err) {
virSetError(orig_err); virSetError(orig_err);