SHA256
1
0
forked from pool/libvirt
libvirt/1282bd80-mig-speed-2.patch

81 lines
2.4 KiB
Diff
Raw Normal View History

commit 1282bd80f752b1b11e031881b7b64dea214a2461
Author: Jim Fehlig <jfehlig@novell.com>
Date: Fri Aug 26 12:10:24 2011 -0600
virsh: Expose virDomainMigrateGetMaxSpeed API
Index: libvirt-0.9.4/tools/virsh.c
===================================================================
--- libvirt-0.9.4.orig/tools/virsh.c
+++ libvirt-0.9.4/tools/virsh.c
@@ -5200,6 +5200,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,
@@ -12519,6 +12558,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},
Index: libvirt-0.9.4/tools/virsh.pod
===================================================================
--- libvirt-0.9.4.orig/tools/virsh.pod
+++ libvirt-0.9.4/tools/virsh.pod
@@ -619,6 +619,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>