mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: process: Ignore 'RESET' event during startup
In cases when we are adding a <transient/> disk with sharing backend (and thus hotplugging it) we need to re-initialize ACPI tables so that the VM boots from the correct device. This has a side-effect of emitting the RESET event and forwarding it to the clients which is not correct. Fix this by ignoring RESET events during startup of the VM. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
526cff4f03
commit
9eef395fcc
@ -429,12 +429,24 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
void *opaque)
|
void *opaque)
|
||||||
{
|
{
|
||||||
virQEMUDriver *driver = opaque;
|
virQEMUDriver *driver = opaque;
|
||||||
virObjectEvent *event;
|
virObjectEvent *event = NULL;
|
||||||
qemuDomainObjPrivate *priv;
|
qemuDomainObjPrivate *priv;
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
|
virDomainState state;
|
||||||
|
int reason;
|
||||||
|
|
||||||
virObjectLock(vm);
|
virObjectLock(vm);
|
||||||
|
|
||||||
|
state = virDomainObjGetState(vm, &reason);
|
||||||
|
|
||||||
|
/* ignore reset events on VM startup. Libvirt in certain instances does a
|
||||||
|
* reset during startup so that the ACPI tables are re-generated */
|
||||||
|
if (state == VIR_DOMAIN_PAUSED &&
|
||||||
|
reason == VIR_DOMAIN_PAUSED_STARTING_UP) {
|
||||||
|
VIR_DEBUG("ignoring reset event during startup");
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
event = virDomainEventRebootNewFromObj(vm);
|
event = virDomainEventRebootNewFromObj(vm);
|
||||||
priv = vm->privateData;
|
priv = vm->privateData;
|
||||||
if (priv->agent)
|
if (priv->agent)
|
||||||
@ -443,6 +455,7 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED,
|
|||||||
if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
|
if (virDomainObjSave(vm, driver->xmlopt, cfg->stateDir) < 0)
|
||||||
VIR_WARN("Failed to save status on vm %s", vm->def->name);
|
VIR_WARN("Failed to save status on vm %s", vm->def->name);
|
||||||
|
|
||||||
|
unlock:
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
virObjectEventStateQueue(driver->domainEventState, event);
|
virObjectEventStateQueue(driver->domainEventState, event);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user