Make 'start --paused' mirror 'create --paused'. * tools/virsh.c (cmdStart): Try new virDomainCreateWithFlags API first. * tools/virsh.pod (start): Document --paused. --- tools/virsh.c | 9 ++++++++- tools/virsh.pod | 7 +++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index d60c27b..b208cae 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -1306,6 +1306,7 @@ static const vshCmdOptDef opts_start[] = { #ifndef WIN32 {"console", VSH_OT_BOOL, 0, N_("attach to console after creation")}, #endif + {"paused", VSH_OT_BOOL, 0, N_("leave the guest paused after creation")}, {NULL, 0, 0, NULL} }; @@ -1317,6 +1318,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) #ifndef WIN32 int console = vshCommandOptBool(cmd, "console"); #endif + unsigned int flags = VIR_DOMAIN_NONE; if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) return FALSE; @@ -1330,7 +1332,12 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) return FALSE; } - if (virDomainCreate(dom) == 0) { + if (vshCommandOptBool(cmd, "paused")) + flags |= VIR_DOMAIN_START_PAUSED; + + /* Try newer API first, but fall back to older one if possible. */ + if (virDomainCreateWithFlags(dom, flags) == 0 || + (flags == 0 && virDomainCreate(dom) == 0)) { vshPrint(ctl, _("Domain %s started\n"), virDomainGetName(dom)); #ifndef WIN32 diff --git a/tools/virsh.pod b/tools/virsh.pod index b54003c..f5b44be 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -469,9 +469,12 @@ services must be shutdown in the domain. The exact behavior of a domain when it shuts down is set by the I<on_shutdown> parameter in the domain's XML definition. -=item B<start> I<domain-name> +=item B<start> I<domain-name> optional I<--console> I<--paused> -Start a (previously defined) inactive domain. +Start a (previously defined) inactive domain. The domain will be paused +if the I<--paused> option is used and supported by the driver; otherwise +it will be running. +If I<--console> is requested, attach to the console after creation. =item B<suspend> I<domain-id> -- 1.7.0.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list