<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">    Hi,
<br>
I checked the libvirt git tree. It seems that this patch has not been applied. <br>
I think to use virsh command line to control the migration bandwidth is useful. Thanks.
<br>
<br>
- Hui<br>
<br>
<br>
<pre>API virDomainMigrateSetMaxSpeed was introduced since 0.9.0, but<br>no command in virsh yet.<br>---<br> tools/virsh.c   |   46 ++++++++++++++++++++++++++++++++++++++++++++++<br> tools/virsh.pod |    5 +++++<br> 2 files changed, 51 insertions(+), 0 deletions(-)<br><br>diff --git a/tools/virsh.c b/tools/virsh.c<br>index d98be1c..ab83ba9 100644<br>--- a/tools/virsh.c<br>+++ b/tools/virsh.c<br>@@ -4301,6 +4301,50 @@ done:<br> }<br> <br> /*<br>+ * "migrate-setspeed" command<br>+ */<br>+static const vshCmdInfo info_migrate_setspeed[] = {<br>+    {"help", N_("Set the maximum migration bandwidth")},<br>+    {"desc", N_("Set the maximum migration bandwidth (in Mbps) for a domain "<br>+                "which is being migrated to another host.")},<br>+    {NULL, NULL}<br>+};<br>+<br>+static const vshCmdOptDef opts_migrate_setspeed[] = {<br>+    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},<br>+    {"bandwidth", VSH_OT_INT, VSH_OFLAG_REQ, N_("migration bandwidth limit in Mbps")},<br>+    {NULL, 0, 0, NULL}<br>+};<br>+<br>+static bool<br>+cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd *cmd)<br>+{<br>+    virDomainPtr dom = NULL;<br>+    unsigned long bandwidth = 0;<br>+    bool ret = false;<br>+<br>+    if (!vshConnectionUsability(ctl, ctl->conn))<br>+        return false;<br>+<br>+    if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))<br>+        return false;<br>+<br>+    if (vshCommandOptUL(cmd, "bandwidth", &bandwidth) < 0) {<br>+        vshError(ctl, "%s", _("migrate: Invalid bandwidth"));<br>+        goto done;<br>+    }<br>+<br>+    if (virDomainMigrateSetMaxSpeed(dom, bandwidth, 0) < 0)<br>+        goto done;<br>+<br>+    ret = true;<br>+<br>+done:<br>+    virDomainFree(dom);<br>+    return ret;<br>+}<br>+<br>+/*<br>  * "net-autostart" command<br>  */<br> static const vshCmdInfo info_network_autostart[] = {<br>@@ -11080,6 +11124,8 @@ static const vshCmdDef domManagementCmds[] = {<br>     {"migrate", cmdMigrate, opts_migrate, info_migrate, 0},<br>     {"migrate-setmaxdowntime", cmdMigrateSetMaxDowntime,<br>      opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime, 0},<br>+    {"migrate-setspeed", cmdMigrateSetMaxSpeed,<br>+     opts_migrate_setspeed, info_migrate_setspeed, 0},<br>     {"reboot", cmdReboot, opts_reboot, info_reboot, 0},<br>     {"restore", cmdRestore, opts_restore, info_restore, 0},<br>     {"resume", cmdResume, opts_resume, info_resume, 0},<br>diff --git a/tools/virsh.pod b/tools/virsh.pod<br>index 7ed3003..98adc90 100644<br>--- a/tools/virsh.pod<br>+++ b/tools/virsh.pod<br>@@ -542,6 +542,11 @@ Set maximum tolerable downtime for a domain which is being live-migrated to<br> another host.  The I<downtime> is a number of milliseconds the guest is allowed<br> to be down at the end of live migration.<br> <br>+=item B<migrate-setspeed> I<domain-id> I<bandwidth><br>+<br>+Set the maximum migration bandwidth (in Mbps) for a domain which is being<br>+migrated to another host.<br>+<br> =item B<reboot> I<domain-id><br> <br> Reboot a domain.  This acts just as if the domain had the B<reboot><br>-- <br>1.7.4<br></pre>
<br>
</div>
</body>
</html>