mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: add --paused option to create
* tools/virsh.c (opts_create): Add --paused option. (cmdCreate): Pass appropriate flag. * tools/virsh.pod: Document it.
This commit is contained in:
parent
68e4793ae0
commit
734bbf0ea9
@ -1141,6 +1141,7 @@ static const vshCmdOptDef opts_create[] = {
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
{"console", VSH_OT_BOOL, 0, N_("attach to console after creation")},
|
{"console", VSH_OT_BOOL, 0, N_("attach to console after creation")},
|
||||||
#endif
|
#endif
|
||||||
|
{"paused", VSH_OT_BOOL, 0, N_("leave the guest paused after creation")},
|
||||||
{NULL, 0, 0, NULL}
|
{NULL, 0, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1155,6 +1156,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
int console = vshCommandOptBool(cmd, "console");
|
int console = vshCommandOptBool(cmd, "console");
|
||||||
#endif
|
#endif
|
||||||
|
unsigned int flags = VIR_DOMAIN_NONE;
|
||||||
|
|
||||||
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1166,7 +1168,10 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
|
if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
dom = virDomainCreateXML(ctl->conn, buffer, 0);
|
if (vshCommandOptBool(cmd, "paused"))
|
||||||
|
flags |= VIR_DOMAIN_START_PAUSED;
|
||||||
|
|
||||||
|
dom = virDomainCreateXML(ctl->conn, buffer, flags);
|
||||||
VIR_FREE(buffer);
|
VIR_FREE(buffer);
|
||||||
|
|
||||||
if (dom != NULL) {
|
if (dom != NULL) {
|
||||||
|
@ -265,11 +265,13 @@ The option I<--disable> disables autostarting.
|
|||||||
|
|
||||||
Connect the virtual serial console for the guest.
|
Connect the virtual serial console for the guest.
|
||||||
|
|
||||||
=item B<create> I<FILE>
|
=item B<create> I<FILE> optional I<--console> I<--paused>
|
||||||
|
|
||||||
Create a domain from an XML <file>. An easy way to create the XML
|
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
|
<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<--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.
|
||||||
|
|
||||||
B<Example>
|
B<Example>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user