提交 b9c09f80 编写于 作者: J John Ferlan

qemu: Add job for qemuDomain{Add|Del}TLSObjects

Add an asyncJob argument for add/delete TLS Objects. A future patch will
add/delete TLS objects from a migration which may have a job to join.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 3d06cb96
...@@ -1531,6 +1531,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, ...@@ -1531,6 +1531,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
void void
qemuDomainDelTLSObjects(virQEMUDriverPtr driver, qemuDomainDelTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
const char *secAlias, const char *secAlias,
const char *tlsAlias) const char *tlsAlias)
{ {
...@@ -1542,7 +1543,8 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, ...@@ -1542,7 +1543,8 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver,
orig_err = virSaveLastError(); orig_err = virSaveLastError();
qemuDomainObjEnterMonitor(driver, vm); if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
if (tlsAlias) if (tlsAlias)
ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias)); ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
...@@ -1552,6 +1554,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, ...@@ -1552,6 +1554,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver,
ignore_value(qemuDomainObjExitMonitor(driver, vm)); ignore_value(qemuDomainObjExitMonitor(driver, vm));
cleanup:
if (orig_err) { if (orig_err) {
virSetError(orig_err); virSetError(orig_err);
virFreeError(orig_err); virFreeError(orig_err);
...@@ -1562,6 +1565,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver, ...@@ -1562,6 +1565,7 @@ qemuDomainDelTLSObjects(virQEMUDriverPtr driver,
int int
qemuDomainAddTLSObjects(virQEMUDriverPtr driver, qemuDomainAddTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
const char *secAlias, const char *secAlias,
virJSONValuePtr *secProps, virJSONValuePtr *secProps,
const char *tlsAlias, const char *tlsAlias,
...@@ -1574,7 +1578,8 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver, ...@@ -1574,7 +1578,8 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver,
if (!tlsAlias && !secAlias) if (!tlsAlias && !secAlias)
return 0; return 0;
qemuDomainObjEnterMonitor(driver, vm); if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
if (secAlias) { if (secAlias) {
rc = qemuMonitorAddObject(priv->mon, "secret", rc = qemuMonitorAddObject(priv->mon, "secret",
...@@ -1601,7 +1606,7 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver, ...@@ -1601,7 +1606,7 @@ qemuDomainAddTLSObjects(virQEMUDriverPtr driver,
virSetError(orig_err); virSetError(orig_err);
virFreeError(orig_err); virFreeError(orig_err);
} }
qemuDomainDelTLSObjects(driver, vm, secAlias, tlsAlias); qemuDomainDelTLSObjects(driver, vm, asyncJob, secAlias, tlsAlias);
return -1; return -1;
} }
...@@ -1682,8 +1687,8 @@ qemuDomainAddChardevTLSObjects(virConnectPtr conn, ...@@ -1682,8 +1687,8 @@ qemuDomainAddChardevTLSObjects(virConnectPtr conn,
goto cleanup; goto cleanup;
dev->data.tcp.tlscreds = true; dev->data.tcp.tlscreds = true;
if (qemuDomainAddTLSObjects(driver, vm, *secAlias, &secProps, if (qemuDomainAddTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE,
*tlsAlias, &tlsProps) < 0) *secAlias, &secProps, *tlsAlias, &tlsProps) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -1773,7 +1778,8 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn, ...@@ -1773,7 +1778,8 @@ int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
virSetError(orig_err); virSetError(orig_err);
virFreeError(orig_err); virFreeError(orig_err);
} }
qemuDomainDelTLSObjects(driver, vm, secAlias, tlsAlias); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE,
secAlias, tlsAlias);
goto audit; goto audit;
} }
...@@ -2034,7 +2040,8 @@ int qemuDomainAttachChrDevice(virConnectPtr conn, ...@@ -2034,7 +2040,8 @@ int qemuDomainAttachChrDevice(virConnectPtr conn,
virFreeError(orig_err); virFreeError(orig_err);
} }
qemuDomainDelTLSObjects(driver, vm, secAlias, tlsAlias); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE,
secAlias, tlsAlias);
goto audit; goto audit;
} }
...@@ -2186,7 +2193,8 @@ qemuDomainAttachRNGDevice(virConnectPtr conn, ...@@ -2186,7 +2193,8 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
virFreeError(orig_err); virFreeError(orig_err);
} }
qemuDomainDelTLSObjects(driver, vm, secAlias, tlsAlias); qemuDomainDelTLSObjects(driver, vm, QEMU_ASYNC_JOB_NONE,
secAlias, tlsAlias);
goto audit; goto audit;
} }
......
...@@ -36,11 +36,13 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver, ...@@ -36,11 +36,13 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
void qemuDomainDelTLSObjects(virQEMUDriverPtr driver, void qemuDomainDelTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
const char *secAlias, const char *secAlias,
const char *tlsAlias); const char *tlsAlias);
int qemuDomainAddTLSObjects(virQEMUDriverPtr driver, int qemuDomainAddTLSObjects(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainAsyncJob asyncJob,
const char *secAlias, const char *secAlias,
virJSONValuePtr *secProps, virJSONValuePtr *secProps,
const char *tlsAlias, const char *tlsAlias,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册