Added support for a --start flag to the define command --- Implements https://www.redhat.com/archives/libvir-list/2013-January/msg00490.html in a new way using the persistent flag for create. --- tools/virsh-domain.c | 9 ++++++++- tools/virsh.pod | 5 +++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cb56b3d..5a18316 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -6475,6 +6475,9 @@ static const vshCmdInfo info_define[] = { {.name = "desc", .data = N_("Define a domain.") }, + {.name = "starT", + .data = N_("Start domain after defining it.") + }, {.name = NULL} }; @@ -6501,7 +6504,11 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd) if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0) return false; - dom = virDomainDefineXML(ctl->conn, buffer); + if (vshCommandOptBool(cmd, "start")) + dom = virDomainCreateXML(ctl->conn, buffer, + VIR_DOMAIN_START_PERSISTENT); + else + dom = virDomainDefineXML(ctl->conn, buffer); VIR_FREE(buffer); if (dom != NULL) { diff --git a/tools/virsh.pod b/tools/virsh.pod index 3ea4ba6..91bbd6c 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -558,11 +558,12 @@ B<Example> vi domain.xml (or make changes with your other text editor) virsh create domain.xml -=item B<define> I<FILE> +=item B<define> I<FILE> [I<--start>] Define a domain from an XML <file>. The domain definition is registered but not started. If domain is already running, the changes will take -effect on the next boot. +effect on the next boot. If I<--start> is requested, start the domain +after defining it. =item B<desc> I<domain> [[I<--live>] [I<--config>] | [I<--current>]] [I<--title>] [I<--edit>] [I<--new-desc> -- 1.7.12.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list