commit b98bf81151446b34dde59217dec19f93981c8047 Author: Jim Fehlig Date: Thu May 1 11:42:54 2014 -0600 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. Index: libvirt-1.2.4/include/libvirt/libvirt.h.in =================================================================== --- libvirt-1.2.4.orig/include/libvirt/libvirt.h.in +++ libvirt-1.2.4/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, Index: libvirt-1.2.4/tools/virsh-domain.c =================================================================== --- libvirt-1.2.4.orig/tools/virsh-domain.c +++ libvirt-1.2.4/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 vshCm 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 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++; Index: libvirt-1.2.4/tools/virsh.pod =================================================================== --- libvirt-1.2.4.orig/tools/virsh.pod +++ libvirt-1.2.4/tools/virsh.pod @@ -1302,8 +1302,8 @@ I parameter in the domain's X 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, C, -C and C. The order in which drivers will try each -mode is undefined, and not related to the order specified to virsh. +C, C and C. 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 parameter can specify a comma separated list which includes C, C, -C and C. The order in which drivers will try each -mode is undefined, and not related to the order specified to virsh. +C, C and C. 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.