Add a new flag to virDomain{Reboot,Shutdown}FlagValues to allow
shutting down and rebooting a domain via the Xen paravirt control
interface.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
include/libvirt/libvirt.h.in | 2 ++
tools/virsh-domain.c | 14 ++++++++++----
tools/virsh.pod | 8 ++++----
3 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 930b7e8..2c7565a 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -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,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 73414f8..3a7c260 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -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++;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index abd2e93..9104804 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -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.
--
1.8.1.4