]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: Add support for VIR_MIGRATE_PARAM_PERSIST_XML
authorJiri Denemark <jdenemar@redhat.com>
Tue, 22 Nov 2016 13:06:43 +0000 (14:06 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 22 Nov 2016 20:24:55 +0000 (21:24 +0100)
Commit v1.3.3-181-gb028e9d7c implmented support for
VIR_MIGRATE_PARAM_PERSIST_XML migration parameter, but forgot to update
virsh.

https://bugzilla.redhat.com/show_bug.cgi?id=835300

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
docs/news.html.in
tools/virsh-domain.c
tools/virsh.pod

index 56c03b35c88c01ed510181da99cec2a7edff3a85..a6f86e518b92ba899a1f081cd978e3315b5a82d6 100644 (file)
@@ -26,6 +26,8 @@
       </li>
       <li><strong>Improvements</strong>
         <ul>
+          <li>virsh: Add support for passing an alternative persistent XML
+          to migrate command</li>
           <li>vhostuser: Allow hotplug of multiqueue devices
           </li>
           <li>NEWS: Switch to an improved format<br/>
index a133c81ace15fbd46c1670c9d8aebaf457b4f9bd..dedddeb96681b548903153c72a8337fa53eafa56 100644 (file)
@@ -10105,6 +10105,10 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_INT,
      .help = N_("CPU throttling rate increment for auto-convergence")
     },
+    {.name = "persistent-xml",
+     .type = VSH_OT_STRING,
+     .help = N_("filename containing updated persistent XML for the target")
+    },
     {.name = NULL}
 };
 
@@ -10265,6 +10269,24 @@ doMigrate(void *opaque)
         VIR_FREE(xml);
     }
 
+    if (vshCommandOptStringReq(ctl, cmd, "persistent-xml", &opt) < 0)
+        goto out;
+    if (opt) {
+        char *xml;
+
+        if (virFileReadAll(opt, VSH_MAX_XML_FILE, &xml) < 0) {
+            vshError(ctl, _("cannot read file '%s'"), opt);
+            goto save_error;
+        }
+
+        if (virTypedParamsAddString(&params, &nparams, &maxparams,
+                                    VIR_MIGRATE_PARAM_PERSIST_XML, xml) < 0) {
+            VIR_FREE(xml);
+            goto save_error;
+        }
+        VIR_FREE(xml);
+    }
+
     if ((rv = vshCommandOptInt(ctl, cmd, "auto-converge-initial", &intOpt)) < 0) {
         goto out;
     } else if (rv > 0) {
@@ -10421,6 +10443,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd)
     VSH_EXCLUSIVE_OPTIONS("live", "offline");
     VSH_EXCLUSIVE_OPTIONS("timeout-suspend", "timeout-postcopy");
     VSH_REQUIRE_OPTION("postcopy-after-precopy", "postcopy");
+    VSH_REQUIRE_OPTION("persistent-xml", "persistent");
 
     if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
         return false;
index f278fecafde328c8dc255543c1f855be5a195395..74d531122b03a7ffd27c282211a58853a48ac1bf 100644 (file)
@@ -1625,7 +1625,7 @@ I<domain> I<desturi> [I<migrateuri>] [I<graphicsuri>] [I<listen-address>] [I<dna
 [I<--compressed>] [I<--comp-methods> B<method-list>]
 [I<--comp-mt-level>] [I<--comp-mt-threads>] [I<--comp-mt-dthreads>]
 [I<--comp-xbzrle-cache>] [I<--auto-converge>] [I<auto-converge-initial>]
-[I<auto-converge-increment>]
+[I<auto-converge-increment>] [I<--persistent-xml> B<file>]
 
 Migrate domain to another host.  Add I<--live> for live migration; <--p2p>
 for peer-2-peer migration; I<--direct> for direct migration; or I<--tunnelled>
@@ -1679,6 +1679,9 @@ omitted, but can be used to supply an alternative XML file for use on
 the destination to supply a larger set of changes to any host-specific
 portions of the domain XML, such as accounting for naming differences
 between source and destination in accessing underlying storage.
+If I<--persistent> is enabled, I<--persistent-xml> B<file> can be used to
+supply an alternative XML file which will be used as the persistent domain
+definition on the destination host.
 
 I<--timeout> B<seconds> tells virsh to run a specified action when live
 migration exceeds that many seconds.  It can only be used with I<--live>.