[libvirt] [PATCH 3/3] virsh: add --paused option to create

Eric Blake eblake at redhat.com
Tue Jun 8 22:00:20 UTC 2010


On 06/08/2010 02:57 PM, Jiri Denemark wrote:
>> +    unsigned int paused = (vshCommandOptBool(cmd, "paused")
>> +                           ? VIR_DOMAIN_START_PAUSED
>> +                           : VIR_DOMAIN_NONE);
> 
> I'd probably name this variable "flags" to avoid confusion (or the need to
> rename it) if new flags are added to virDomainCreateXML().
> 
> ...
> 
>>  Create a domain from an XML <file>. An easy way to create the XML
>>  <file> is to use the B<dumpxml> command to obtain the definition of a
>> -pre-existing guest.
>> +pre-existing guest.  The domain will be paused if the I<--option>
> 
> Should be "--paused" instead of "--option".

I've squashed this in:

diff --git i/tools/virsh.c w/tools/virsh.c
index 6b05949..c0b6112 100644
--- i/tools/virsh.c
+++ w/tools/virsh.c
@@ -1156,9 +1156,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
 #ifndef WIN32
     int console = vshCommandOptBool(cmd, "console");
 #endif
-    unsigned int paused = (vshCommandOptBool(cmd, "paused")
-                           ? VIR_DOMAIN_START_PAUSED
-                           : VIR_DOMAIN_NONE);
+    unsigned int flags = VIR_DOMAIN_NONE;

     if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
         return FALSE;
@@ -1170,7 +1168,10 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
     if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
         return FALSE;

-    dom = virDomainCreateXML(ctl->conn, buffer, paused);
+    if (vshCommandOptBool(cmd, "paused"))
+        flags |= VIR_DOMAIN_START_PAUSED;
+
+    dom = virDomainCreateXML(ctl->conn, buffer, flags);
     VIR_FREE(buffer);

     if (dom != NULL) {
diff --git i/tools/virsh.pod w/tools/virsh.pod
index 3cadb87..cf27e17 100644
--- i/tools/virsh.pod
+++ w/tools/virsh.pod
@@ -269,7 +269,7 @@ Connect the virtual serial console for the guest.

 Create a domain from an XML <file>. An easy way to create the XML
 <file> is to use the B<dumpxml> command to obtain the definition of a
-pre-existing guest.  The domain will be paused if the I<--option>
+pre-existing guest.  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.

> ACK after making those tweaks.

Thanks.  I've run more tests on the result this time, then pushed all
three (I got an off-list ACK for 2/3, in case this email beats Jirka's
promised on-list ACK).

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100608/9af5f258/attachment-0001.sig>


More information about the libvir-list mailing list