mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-16 03:24:31 +03:00
Add public API for setting migration speed on the fly
It is possible to set a migration speed limit when starting migration. This new API allows the speed limit to be changed on the fly to adjust to changing conditions * src/driver.h, src/libvirt.c, src/libvirt_public.syms, include/libvirt/libvirt.h.in: Add virDomainMigrateSetMaxSpeed * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/opennebula/one_driver.c, src/openvz/openvz_driver.c, src/phyp/phyp_driver.c, src/qemu/qemu_driver.c, src/remote/remote_driver.c, src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c, src/vmware/vmware_driver.c, src/xen/xen_driver.c, src/libxl/libxl_driver.c: Stub new API
This commit is contained in:
parent
09fb354ce3
commit
cb4aba9b6a
@ -436,6 +436,10 @@ int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
|
|||||||
unsigned long long downtime,
|
unsigned long long downtime,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
|
||||||
|
unsigned long bandwidth,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VIR_NODEINFO_MAXCPUS:
|
* VIR_NODEINFO_MAXCPUS:
|
||||||
* @nodeinfo: virNodeInfo instance
|
* @nodeinfo: virNodeInfo instance
|
||||||
|
@ -442,6 +442,10 @@ typedef int
|
|||||||
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
|
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
|
||||||
unsigned long long downtime,
|
unsigned long long downtime,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
typedef int
|
||||||
|
(*virDrvDomainMigrateSetMaxSpeed)(virDomainPtr domain,
|
||||||
|
unsigned long bandwidth,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*virDrvDomainEventRegisterAny)(virConnectPtr conn,
|
(*virDrvDomainEventRegisterAny)(virConnectPtr conn,
|
||||||
@ -618,6 +622,7 @@ struct _virDriver {
|
|||||||
virDrvDomainGetJobInfo domainGetJobInfo;
|
virDrvDomainGetJobInfo domainGetJobInfo;
|
||||||
virDrvDomainAbortJob domainAbortJob;
|
virDrvDomainAbortJob domainAbortJob;
|
||||||
virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
|
virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
|
||||||
|
virDrvDomainMigrateSetMaxSpeed domainMigrateSetMaxSpeed;
|
||||||
virDrvDomainEventRegisterAny domainEventRegisterAny;
|
virDrvDomainEventRegisterAny domainEventRegisterAny;
|
||||||
virDrvDomainEventDeregisterAny domainEventDeregisterAny;
|
virDrvDomainEventDeregisterAny domainEventDeregisterAny;
|
||||||
virDrvDomainManagedSave domainManagedSave;
|
virDrvDomainManagedSave domainManagedSave;
|
||||||
|
@ -4658,6 +4658,7 @@ static virDriver esxDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -12556,6 +12556,53 @@ error:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virDomainMigrateSetMaxSpeed:
|
||||||
|
* @domain: a domain object
|
||||||
|
* @bandwidth: migration bandwidth limit in Mbps
|
||||||
|
* @flags: fine-tuning flags, currently unused, use 0
|
||||||
|
*
|
||||||
|
* The maximum bandwidth (in Mbps) that will be used to do migration
|
||||||
|
* can be specified with the bandwidth parameter. Not all hypervisors
|
||||||
|
* will support a bandwidth cap
|
||||||
|
*
|
||||||
|
* Returns 0 in case of success, -1 otherwise.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virDomainMigrateSetMaxSpeed(virDomainPtr domain,
|
||||||
|
unsigned long bandwidth,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
virConnectPtr conn;
|
||||||
|
|
||||||
|
VIR_DOMAIN_DEBUG(domain, "bandwidth=%lu, flags=%u", bandwidth, flags);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
|
||||||
|
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||||
|
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||||
|
virDispatchError(NULL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
conn = domain->conn;
|
||||||
|
if (conn->flags & VIR_CONNECT_RO) {
|
||||||
|
virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conn->driver->domainMigrateSetMaxSpeed) {
|
||||||
|
if (conn->driver->domainMigrateSetMaxSpeed(domain, bandwidth, flags) < 0)
|
||||||
|
goto error;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||||
|
error:
|
||||||
|
virDispatchError(conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virConnectDomainEventRegisterAny:
|
* virConnectDomainEventRegisterAny:
|
||||||
* @conn: pointer to the connection
|
* @conn: pointer to the connection
|
||||||
|
@ -427,6 +427,7 @@ LIBVIRT_0.8.8 {
|
|||||||
LIBVIRT_0.9.0 {
|
LIBVIRT_0.9.0 {
|
||||||
global:
|
global:
|
||||||
virDomainGetBlkioParameters;
|
virDomainGetBlkioParameters;
|
||||||
|
virDomainMigrateSetMaxSpeed;
|
||||||
virDomainSetBlkioParameters;
|
virDomainSetBlkioParameters;
|
||||||
virDomainSetMemoryFlags;
|
virDomainSetMemoryFlags;
|
||||||
virEventRegisterDefaultImpl;
|
virEventRegisterDefaultImpl;
|
||||||
|
@ -1414,6 +1414,7 @@ static virDriver libxlDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -2883,6 +2883,7 @@ static virDriver lxcDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
lxcDomainEventRegisterAny, /* domainEventRegisterAny */
|
lxcDomainEventRegisterAny, /* domainEventRegisterAny */
|
||||||
lxcDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
lxcDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -815,6 +815,7 @@ static virDriver oneDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -1637,6 +1637,7 @@ static virDriver openvzDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -4038,6 +4038,7 @@ static virDriver phypDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -7121,6 +7121,7 @@ static virDriver qemuDriver = {
|
|||||||
qemuDomainGetJobInfo, /* domainGetJobInfo */
|
qemuDomainGetJobInfo, /* domainGetJobInfo */
|
||||||
qemuDomainAbortJob, /* domainAbortJob */
|
qemuDomainAbortJob, /* domainAbortJob */
|
||||||
qemuDomainMigrateSetMaxDowntime, /* domainMigrateSetMaxDowntime */
|
qemuDomainMigrateSetMaxDowntime, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
qemuDomainEventRegisterAny, /* domainEventRegisterAny */
|
qemuDomainEventRegisterAny, /* domainEventRegisterAny */
|
||||||
qemuDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
qemuDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
||||||
qemuDomainManagedSave, /* domainManagedSave */
|
qemuDomainManagedSave, /* domainManagedSave */
|
||||||
|
@ -11156,6 +11156,7 @@ static virDriver remote_driver = {
|
|||||||
remoteDomainGetJobInfo, /* domainGetJobInfo */
|
remoteDomainGetJobInfo, /* domainGetJobInfo */
|
||||||
remoteDomainAbortJob, /* domainFinishJob */
|
remoteDomainAbortJob, /* domainFinishJob */
|
||||||
remoteDomainMigrateSetMaxDowntime, /* domainMigrateSetMaxDowntime */
|
remoteDomainMigrateSetMaxDowntime, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
remoteDomainEventRegisterAny, /* domainEventRegisterAny */
|
remoteDomainEventRegisterAny, /* domainEventRegisterAny */
|
||||||
remoteDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
remoteDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
||||||
remoteDomainManagedSave, /* domainManagedSave */
|
remoteDomainManagedSave, /* domainManagedSave */
|
||||||
|
@ -5430,6 +5430,7 @@ static virDriver testDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
testDomainEventRegisterAny, /* domainEventRegisterAny */
|
testDomainEventRegisterAny, /* domainEventRegisterAny */
|
||||||
testDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
testDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -2232,6 +2232,7 @@ static virDriver umlDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -8625,6 +8625,7 @@ virDriver NAME(Driver) = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
#if VBOX_API_VERSION == 2002 || VBOX_API_VERSION == 4000
|
#if VBOX_API_VERSION == 2002 || VBOX_API_VERSION == 4000
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
|
@ -990,6 +990,7 @@ static virDriver vmwareDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
NULL, /* domainEventRegisterAny */
|
NULL, /* domainEventRegisterAny */
|
||||||
NULL, /* domainEventDeregisterAny */
|
NULL, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
@ -2124,6 +2124,7 @@ static virDriver xenUnifiedDriver = {
|
|||||||
NULL, /* domainGetJobInfo */
|
NULL, /* domainGetJobInfo */
|
||||||
NULL, /* domainAbortJob */
|
NULL, /* domainAbortJob */
|
||||||
NULL, /* domainMigrateSetMaxDowntime */
|
NULL, /* domainMigrateSetMaxDowntime */
|
||||||
|
NULL, /* domainMigrateSetMaxSpeed */
|
||||||
xenUnifiedDomainEventRegisterAny, /* domainEventRegisterAny */
|
xenUnifiedDomainEventRegisterAny, /* domainEventRegisterAny */
|
||||||
xenUnifiedDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
xenUnifiedDomainEventDeregisterAny, /* domainEventDeregisterAny */
|
||||||
NULL, /* domainManagedSave */
|
NULL, /* domainManagedSave */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user