提交 1a828a57 编写于 作者: P Peter Krempa

qemu: Rename qemuDomainDiskChainElement(Revoke|Prepare)

Use qemuDomainStorageSourceAccess(Allow|Revoke) instead.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 8a117983
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册