
On Fri, Aug 26, 2011 at 12:10:24PM -0600, Jim Fehlig wrote:
--- tools/virsh.c | 41 +++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 4 ++++ 2 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 15b9bdd..f6d65c7 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -5194,6 +5194,45 @@ done: return ret; }
+/* + * "migrate-getspeed" command + */ +static const vshCmdInfo info_migrate_getspeed[] = { + {"help", N_("Get the maximum migration bandwidth")}, + {"desc", N_("Get the maximum migration bandwidth (in Mbps) for a domain.")}, + {NULL, NULL} +}; + +static const vshCmdOptDef opts_migrate_getspeed[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, + {NULL, 0, 0, NULL} +}; + +static bool +cmdMigrateGetMaxSpeed(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom = NULL; + unsigned long bandwidth; + bool ret = false; + + if (!vshConnectionUsability(ctl, ctl->conn)) + return false; + + if (!(dom = vshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (virDomainMigrateGetMaxSpeed(dom, &bandwidth, 0) < 0) + goto done; + + vshPrint(ctl, "%lu\n", bandwidth); + + ret = true; + +done: + virDomainFree(dom); + return ret; +} + typedef enum { VSH_CMD_BLOCK_JOB_ABORT = 0, VSH_CMD_BLOCK_JOB_INFO = 1, @@ -12571,6 +12610,8 @@ static const vshCmdDef domManagementCmds[] = { opts_migrate_setmaxdowntime, info_migrate_setmaxdowntime, 0}, {"migrate-setspeed", cmdMigrateSetMaxSpeed, opts_migrate_setspeed, info_migrate_setspeed, 0}, + {"migrate-getspeed", cmdMigrateGetMaxSpeed, + opts_migrate_getspeed, info_migrate_getspeed, 0}, {"reboot", cmdReboot, opts_reboot, info_reboot, 0}, {"restore", cmdRestore, opts_restore, info_restore, 0}, {"resume", cmdResume, opts_resume, info_resume, 0}, diff --git a/tools/virsh.pod b/tools/virsh.pod index 81d7a1e..9c4ae19 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -624,6 +624,10 @@ to be down at the end of live migration. Set the maximum migration bandwidth (in Mbps) for a domain which is being migrated to another host.
+=item B<migrate-getspeed> I<domain-id> + +Get the maximum migration bandwidth (in Mbps) for a domain. + =item B<reboot> I<domain-id>
Reboot a domain. This acts just as if the domain had the B<reboot>
ACK Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|