Add support for the persistent flag to virsh create to allow creating of guests that remain defined after they are stopped. --- The discussion on https://www.redhat.com/archives/libvir-list/2013-January/msg00490.html was more inclined to have 'virsh create --persistent' so this adds that. --- tools/virsh-domain.c | 7 +++++++ tools/virsh.pod | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3e4be89..cb56b3d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6414,6 +6414,11 @@ static const vshCmdOptDef opts_create[] = { .flags = 0, .help = N_("automatically destroy the guest when virsh disconnects") }, + {.name = "persistent", + .type = VSH_OT_BOOL, + .flags = 0, + .help = N_("keep the guest persistently defined") + }, {.name = NULL} }; @@ -6439,6 +6444,8 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd) flags |= VIR_DOMAIN_START_PAUSED; if (vshCommandOptBool(cmd, "autodestroy")) flags |= VIR_DOMAIN_START_AUTODESTROY; + if (vshCommandOptBool(cmd, "persistent")) + flags |= VIR_DOMAIN_START_PERSISTENT; dom = virDomainCreateXML(ctl->conn, buffer, flags); VIR_FREE(buffer); diff --git a/tools/virsh.pod b/tools/virsh.pod index 96666c4..3ea4ba6 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -539,6 +539,7 @@ the I<--force> flag may be specified, requesting to disconnect any existing sessions, such as in a case of a broken connection. =item B<create> I<FILE> [I<--console>] [I<--paused>] [I<--autodestroy>] +[I<--persistent>] 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 @@ -547,7 +548,9 @@ is used and supported by the driver; otherwise it will be running. If I<--console> is requested, attach to the console after creation. If I<--autodestroy> is requested, then the guest will be automatically destroyed when virsh closes its connection to libvirt, or otherwise -exits. +exits. If I<--persistent> is requested, keep the domain defined after +it is destroyed. The behavior is similar to having issued the B<define> +command followed by the B<start> command. B<Example> -- 1.7.12.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list