mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
qemu: process: Split out logic for setting the 'allowReboot' internal flag
Split out the logic which was used to determine whether qemu should allow the guest OS to reboot for QEMU versions which don't support the 'set-action' QMP command. Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
b6ec01b821
commit
a2e6039cca
@ -6361,6 +6361,24 @@ qemuProcessPrepareHostHostdevs(virDomainObj *vm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qemuProcessRebootAllowed:
|
||||||
|
* @def: domain definition
|
||||||
|
*
|
||||||
|
* This function encapsulates the logic which dictated whether '-no-reboot' was
|
||||||
|
* used instead of '-no-shutdown' which is used QEMU versions which don't
|
||||||
|
* support the 'set-action' QMP command.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
|
qemuProcessRebootAllowed(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return def->onReboot != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
|
||||||
|
def->onPoweroff != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
|
||||||
|
(def->onCrash != VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY &&
|
||||||
|
def->onCrash != VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qemuProcessPrepareAllowReboot(virDomainObj *vm)
|
qemuProcessPrepareAllowReboot(virDomainObj *vm)
|
||||||
{
|
{
|
||||||
@ -6375,14 +6393,7 @@ qemuProcessPrepareAllowReboot(virDomainObj *vm)
|
|||||||
if (priv->allowReboot != VIR_TRISTATE_BOOL_ABSENT)
|
if (priv->allowReboot != VIR_TRISTATE_BOOL_ABSENT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (def->onReboot == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY &&
|
priv->allowReboot = virTristateBoolFromBool(qemuProcessRebootAllowed(def));
|
||||||
def->onPoweroff == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY &&
|
|
||||||
(def->onCrash == VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY ||
|
|
||||||
def->onCrash == VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY)) {
|
|
||||||
priv->allowReboot = VIR_TRISTATE_BOOL_NO;
|
|
||||||
} else {
|
|
||||||
priv->allowReboot = VIR_TRISTATE_BOOL_YES;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -242,3 +242,5 @@ void qemuProcessQMPFree(qemuProcessQMP *proc);
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuProcessQMP, qemuProcessQMPFree);
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuProcessQMP, qemuProcessQMPFree);
|
||||||
|
|
||||||
int qemuProcessQMPStart(qemuProcessQMP *proc);
|
int qemuProcessQMPStart(qemuProcessQMP *proc);
|
||||||
|
|
||||||
|
bool qemuProcessRebootAllowed(const virDomainDef *def);
|
||||||
|
Loading…
Reference in New Issue
Block a user