Introduce a new flag for controlling shutdown/reboot

Add a new flag to virDomain{Reboot,Shutdown}FlagValues to allow
shutting down and rebooting a domain via the Xen paravirt control
interface.
This commit is contained in:
Jim Fehlig 2014-05-01 11:42:54 -06:00
parent fff74b275e
commit b98bf81151
3 changed files with 16 additions and 8 deletions

View File

@ -1652,6 +1652,7 @@ typedef enum {
VIR_DOMAIN_SHUTDOWN_GUEST_AGENT = (1 << 1), /* Use guest agent */
VIR_DOMAIN_SHUTDOWN_INITCTL = (1 << 2), /* Use initctl */
VIR_DOMAIN_SHUTDOWN_SIGNAL = (1 << 3), /* Send a signal */
VIR_DOMAIN_SHUTDOWN_PARAVIRT = (1 << 4), /* Use paravirt guest control */
} virDomainShutdownFlagValues;
int virDomainShutdown (virDomainPtr domain);
@ -1664,6 +1665,7 @@ typedef enum {
VIR_DOMAIN_REBOOT_GUEST_AGENT = (1 << 1), /* Use guest agent */
VIR_DOMAIN_REBOOT_INITCTL = (1 << 2), /* Use initctl */
VIR_DOMAIN_REBOOT_SIGNAL = (1 << 3), /* Send a signal */
VIR_DOMAIN_REBOOT_PARAVIRT = (1 << 4), /* Use paravirt guest control */
} virDomainRebootFlagValues;
int virDomainReboot (virDomainPtr domain,

View File

@ -4837,7 +4837,7 @@ static const vshCmdOptDef opts_shutdown[] = {
},
{.name = "mode",
.type = VSH_OT_STRING,
.help = N_("shutdown mode: acpi|agent|initctl|signal")
.help = N_("shutdown mode: acpi|agent|initctl|signal|paravirt")
},
{.name = NULL}
};
@ -4872,9 +4872,12 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_SHUTDOWN_INITCTL;
} else if (STREQ(mode, "signal")) {
flags |= VIR_DOMAIN_SHUTDOWN_SIGNAL;
} else if (STREQ(mode, "paravirt")) {
flags |= VIR_DOMAIN_SHUTDOWN_PARAVIRT;
} else {
vshError(ctl, _("Unknown mode %s value, expecting "
"'acpi', 'agent', 'initctl' or 'signal'"), mode);
"'acpi', 'agent', 'initctl', 'signal', "
"or 'paravirt'"), mode);
goto cleanup;
}
tmp++;
@ -4923,7 +4926,7 @@ static const vshCmdOptDef opts_reboot[] = {
},
{.name = "mode",
.type = VSH_OT_STRING,
.help = N_("shutdown mode: acpi|agent|initctl|signal")
.help = N_("shutdown mode: acpi|agent|initctl|signal|paravirt")
},
{.name = NULL}
};
@ -4957,9 +4960,12 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd)
flags |= VIR_DOMAIN_REBOOT_INITCTL;
} else if (STREQ(mode, "signal")) {
flags |= VIR_DOMAIN_REBOOT_SIGNAL;
} else if (STREQ(mode, "paravirt")) {
flags |= VIR_DOMAIN_REBOOT_PARAVIRT;
} else {
vshError(ctl, _("Unknown mode %s value, expecting "
"'acpi', 'agent', 'initctl' or 'signal'"), mode);
"'acpi', 'agent', 'initctl', 'signal' "
"or 'paravirt'"), mode);
goto cleanup;
}
tmp++;

View File

@ -1302,8 +1302,8 @@ I<on_reboot> parameter in the domain's XML definition.
By default the hypervisor will try to pick a suitable shutdown
method. To specify an alternative method, the I<--mode> parameter
can specify a comma separated list which includes C<acpi>, C<agent>,
C<initctl> and C<signal>. The order in which drivers will try each
mode is undefined, and not related to the order specified to virsh.
C<initctl>, C<signal> and C<paravirt>. The order in which drivers will
try each mode is undefined, and not related to the order specified to virsh.
For strict control over ordering, use a single mode at a time and
repeat the command.
@ -1781,8 +1781,8 @@ snapshot metadata with B<snapshot-create>.
By default the hypervisor will try to pick a suitable shutdown
method. To specify an alternative method, the I<--mode> parameter
can specify a comma separated list which includes C<acpi>, C<agent>,
C<initctl> and C<signal>. The order in which drivers will try each
mode is undefined, and not related to the order specified to virsh.
C<initctl>, C<signal> and C<paravirt>. The order in which drivers will
try each mode is undefined, and not related to the order specified to virsh.
For strict control over ordering, use a single mode at a time and
repeat the command.