virsh: Expose virDomainMigrateGetMaxSpeed API

This commit is contained in:
Jim Fehlig 2011-08-26 12:10:24 -06:00 committed by Jim Fehlig
parent b12354befe
commit 1282bd80f7
2 changed files with 45 additions and 0 deletions

View File

@ -5199,6 +5199,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,
@ -12576,6 +12615,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},

View File

@ -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>