]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: add start --paused support
authorEric Blake <eblake@redhat.com>
Thu, 10 Jun 2010 16:18:02 +0000 (10:18 -0600)
committerEric Blake <eblake@redhat.com>
Tue, 15 Jun 2010 15:50:58 +0000 (09:50 -0600)
Make 'start --paused' mirror 'create --paused'.

* tools/virsh.c (cmdStart): Use new virDomainCreateWithFlags API
when needed.
* tools/virsh.pod (start): Document --paused.

tools/virsh.c
tools/virsh.pod

index 7c43acb19314016b5c5f8c100999de8d07c29f5a..4aa281e3c9d36921305981ee2ed48e29eb11e433 100644 (file)
@@ -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;
+
+    /* Prefer older API unless we have to pass a flag.  */
+    if ((flags ? virDomainCreateWithFlags(dom, flags)
+         : virDomainCreate(dom)) == 0) {
         vshPrint(ctl, _("Domain %s started\n"),
                  virDomainGetName(dom));
 #ifndef WIN32
index f376649c6051348035926b0082a89d797148e4c0..b1917eed6e756fb226a36fdecd8384b600357559 100644 (file)
@@ -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>