mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
qemu: check for active domain after agent interaction
Commit b606bbb41
reminded me that any time we drop locks to run
back-to-back guest interaction commands, we have to check that
the guest didn't disappear in between the two commands. A quick
audit found a couple of spots that were missing this check.
* src/qemu/qemu_driver.c (qemuDomainShutdownFlags)
(qemuDomainSetVcpusFlags): Check that domain is still up.
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
c585334bdd
commit
2c551d34a9
@ -1921,6 +1921,13 @@ static int qemuDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
|
||||
(ret < 0 && (acpiRequested || !flags))) {
|
||||
qemuDomainSetFakeReboot(driver, vm, isReboot);
|
||||
|
||||
/* Even if agent failed, we have to check if guest went away
|
||||
* by itself while our locks were down. */
|
||||
if (useAgent && !virDomainObjIsActive(vm)) {
|
||||
ret = 0;
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitor(driver, vm);
|
||||
ret = qemuMonitorSystemPowerdown(priv->mon);
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
@ -4360,6 +4367,12 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
if (ncpuinfo < 0)
|
||||
goto endjob;
|
||||
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("domain is not running"));
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0)
|
||||
goto endjob;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user