mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 13:55:47 +00:00
Adjust usage of qemu -no-reboot and -no-shutdown options
During building of the qemu command line determine whether to add/use the '-no-reboot' option only if each of the 'on' events want to to destroy the domain; otherwise, use the '-no-shutdown' option. Prior to this change both could be on the command line, which while allowed could be construed as a conflict.
This commit is contained in:
parent
85ec7ff6fd
commit
0e034efaf9
@ -6422,6 +6422,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
int last_good_net = -1;
|
int last_good_net = -1;
|
||||||
bool hasHwVirt = false;
|
bool hasHwVirt = false;
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
|
bool allowReboot = true;
|
||||||
bool emitBootindex = false;
|
bool emitBootindex = false;
|
||||||
int sdl = 0;
|
int sdl = 0;
|
||||||
int vnc = 0;
|
int vnc = 0;
|
||||||
@ -6808,16 +6809,24 @@ qemuBuildCommandLine(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_REBOOT) &&
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_REBOOT)) {
|
||||||
def->onReboot != VIR_DOMAIN_LIFECYCLE_RESTART)
|
/* Only add -no-reboot option if each event destroys domain */
|
||||||
virCommandAddArg(cmd, "-no-reboot");
|
if (def->onReboot == VIR_DOMAIN_LIFECYCLE_DESTROY &&
|
||||||
|
def->onPoweroff == VIR_DOMAIN_LIFECYCLE_DESTROY &&
|
||||||
|
def->onCrash == VIR_DOMAIN_LIFECYCLE_DESTROY) {
|
||||||
|
allowReboot = false;
|
||||||
|
virCommandAddArg(cmd, "-no-reboot");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If JSON monitor is enabled, we can receive an event
|
/* If JSON monitor is enabled, we can receive an event
|
||||||
* when QEMU stops. If we use no-shutdown, then we can
|
* when QEMU stops. If we use no-shutdown, then we can
|
||||||
* watch for this event and do a soft/warm reboot.
|
* watch for this event and do a soft/warm reboot.
|
||||||
*/
|
*/
|
||||||
if (monitor_json && virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN))
|
if (monitor_json && allowReboot &&
|
||||||
|
virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
|
||||||
virCommandAddArg(cmd, "-no-shutdown");
|
virCommandAddArg(cmd, "-no-shutdown");
|
||||||
|
}
|
||||||
|
|
||||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) {
|
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) {
|
||||||
if (!(def->features & (1 << VIR_DOMAIN_FEATURE_ACPI)))
|
if (!(def->features & (1 << VIR_DOMAIN_FEATURE_ACPI)))
|
||||||
|
Loading…
Reference in New Issue
Block a user