Also add qemuDomainChangeGraphicsPasswords,
qemuProcessVerifyGuestCPU and qemuProcessInitPCIAddresses.
Replace tabs by spaces.
---
I'll do some testing on the patch and push it later with this squashed in
if it works well.
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_hotplug.c | 12 ++++++++----
src/qemu/qemu_hotplug.h | 3 ++-
src/qemu/qemu_process.c | 33 ++++++++++++++++++++-------------
4 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 59b2647..e9506e0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2507,7 +2507,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver,
return 0;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- return -1;
+ return -1;
if (qemuMonitorGetDeviceAliases(priv->mon, &aliases) < 0) {
qemuDomainObjExitMonitor(driver, vm);
return -1;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 004b6a4..f7e223a 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2357,7 +2357,8 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
VIR_DOMAIN_GRAPHICS_TYPE_VNC,
&dev->data.vnc.auth,
- cfg->vncPassword);
+ cfg->vncPassword,
+ QEMU_ASYNC_JOB_NONE);
if (ret < 0)
goto cleanup;
@@ -2407,7 +2408,8 @@ qemuDomainChangeGraphics(virQEMUDriverPtr driver,
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
&dev->data.spice.auth,
- cfg->spicePassword);
+ cfg->spicePassword,
+ QEMU_ASYNC_JOB_NONE);
if (ret < 0)
goto cleanup;
@@ -3517,7 +3519,8 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int type,
virDomainGraphicsAuthDefPtr auth,
- const char *defaultPasswd)
+ const char *defaultPasswd,
+ int asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
time_t now = time(NULL);
@@ -3534,7 +3537,8 @@ qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
if (auth->connected)
connected = virDomainGraphicsAuthConnectedTypeToString(auth->connected);
- qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ goto cleanup;
ret = qemuMonitorSetPassword(priv->mon,
type,
auth->passwd ? auth->passwd : defaultPasswd,
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index 6192973..f626c0a 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -61,7 +61,8 @@ int qemuDomainChangeGraphicsPasswords(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int type,
virDomainGraphicsAuthDefPtr auth,
- const char *defaultPasswd);
+ const char *defaultPasswd,
+ int asyncJob);
int qemuDomainChangeNet(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainPtr dom,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 17f65b4..13c396f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1559,7 +1559,7 @@ qemuConnectMonitor(virQEMUDriverPtr driver, virDomainObjPtr vm, int
asyncJob,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- goto error;
+ goto error;
ret = qemuMonitorSetCapabilities(priv->mon);
if (ret == 0 &&
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
@@ -2004,7 +2004,7 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
priv = vm->privateData;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- goto cleanup;
+ goto cleanup;
ret = qemuMonitorGetPtyPaths(priv->mon, paths);
qemuDomainObjExitMonitor(driver, vm);
@@ -2057,7 +2057,7 @@ qemuProcessDetectVcpuPIDs(virQEMUDriverPtr driver,
qemuDomainObjPrivatePtr priv = vm->privateData;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- return -1;
+ return -1;
/* failure to get the VCPU<-> PID mapping or to execute the query
* command will not be treated fatal as some versions of qemu don't
* support this command */
@@ -2293,12 +2293,14 @@ qemuProcessInitPasswords(virConnectPtr conn,
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
VIR_DOMAIN_GRAPHICS_TYPE_VNC,
&graphics->data.vnc.auth,
- cfg->vncPassword);
+ cfg->vncPassword,
+ asyncJob);
} else if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
ret = qemuDomainChangeGraphicsPasswords(driver, vm,
VIR_DOMAIN_GRAPHICS_TYPE_SPICE,
&graphics->data.spice.auth,
- cfg->spicePassword);
+ cfg->spicePassword,
+ asyncJob);
}
if (ret < 0)
@@ -2706,14 +2708,16 @@ qemuProcessDetectPCIAddresses(virDomainObjPtr vm,
static int
qemuProcessInitPCIAddresses(virQEMUDriverPtr driver,
- virDomainObjPtr vm)
+ virDomainObjPtr vm,
+ int asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int naddrs;
int ret;
qemuMonitorPCIAddress *addrs = NULL;
- qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ return -1;
naddrs = qemuMonitorGetAllPCIAddresses(priv->mon,
&addrs);
qemuDomainObjExitMonitor(driver, vm);
@@ -3661,7 +3665,9 @@ qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
static bool
-qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
+qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ int asyncJob)
{
virDomainDefPtr def = vm->def;
virArch arch = def->os.arch;
@@ -3674,7 +3680,8 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr
vm)
switch (arch) {
case VIR_ARCH_I686:
case VIR_ARCH_X86_64:
- qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ return false;
rc = qemuMonitorGetGuestCPU(priv->mon, arch, &guestcpu);
qemuDomainObjExitMonitor(driver, vm);
@@ -4230,7 +4237,7 @@ int qemuProcessStart(virConnectPtr conn,
}
VIR_DEBUG("Detecting if required emulator features are present");
- if (!qemuProcessVerifyGuestCPU(driver, vm))
+ if (!qemuProcessVerifyGuestCPU(driver, vm, asyncJob))
goto cleanup;
VIR_DEBUG("Setting up post-init cgroup restrictions");
@@ -4265,7 +4272,7 @@ int qemuProcessStart(virConnectPtr conn,
* If not, then we have to detect dynamic ones here */
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
VIR_DEBUG("Determining domain device PCI addresses");
- if (qemuProcessInitPCIAddresses(driver, vm) < 0)
+ if (qemuProcessInitPCIAddresses(driver, vm, asyncJob) < 0)
goto cleanup;
}
@@ -4299,7 +4306,7 @@ int qemuProcessStart(virConnectPtr conn,
goto cleanup;
}
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
- goto cleanup;
+ goto cleanup;
if (vm->def->memballoon && vm->def->memballoon->period)
qemuMonitorSetMemoryStatsPeriod(priv->mon,
vm->def->memballoon->period);
if (qemuMonitorSetBalloon(priv->mon, cur_balloon) < 0) {
@@ -4866,7 +4873,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
* If not, then we have to detect dynamic ones here */
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
VIR_DEBUG("Determining domain device PCI addresses");
- if (qemuProcessInitPCIAddresses(driver, vm) < 0)
+ if (qemuProcessInitPCIAddresses(driver, vm, QEMU_ASYNC_JOB_NONE) < 0)
goto error;
}
--
1.8.5.5