libvirt: add method to configure migration speed
In this commit we are enhancing guest object to control the maximum bw
to perform migration.
Closes-Bug: #1783635
Related-Bug: #1414559
Change-Id: I35470773b8c467449ed71217fdb4b6c82f455e33
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
(cherry picked from commit 23446a9552
)
This commit is contained in:
parent
33ca54ddce
commit
e0f1c2cbfd
|
@ -776,6 +776,9 @@ class Domain(object):
|
|||
def migrateSetMaxDowntime(self, downtime):
|
||||
pass
|
||||
|
||||
def migrateSetMaxSpeed(self, bandwidth):
|
||||
pass
|
||||
|
||||
def attachDevice(self, xml):
|
||||
disk_info = _parse_disk_info(etree.fromstring(xml))
|
||||
disk_info['_attached'] = True
|
||||
|
|
|
@ -662,6 +662,10 @@ class GuestTestCase(test.NoDBTestCase):
|
|||
self.guest.migrate_configure_max_downtime(1000)
|
||||
self.domain.migrateSetMaxDowntime.assert_called_once_with(1000)
|
||||
|
||||
def test_migrate_configure_max_speed(self):
|
||||
self.guest.migrate_configure_max_speed(1000)
|
||||
self.domain.migrateSetMaxSpeed.assert_called_once_with(1000)
|
||||
|
||||
|
||||
class GuestBlockTestCase(test.NoDBTestCase):
|
||||
|
||||
|
|
|
@ -684,6 +684,13 @@ class Guest(object):
|
|||
"""
|
||||
self._domain.migrateSetMaxDowntime(mstime)
|
||||
|
||||
def migrate_configure_max_speed(self, bandwidth):
|
||||
"""The maximum bandwidth that will be used to do migration
|
||||
|
||||
:param bw: Bandwidth in MiB/s
|
||||
"""
|
||||
self._domain.migrateSetMaxSpeed(bandwidth)
|
||||
|
||||
def migrate_start_postcopy(self):
|
||||
"""Switch running live migration to post-copy mode"""
|
||||
self._domain.migrateStartPostCopy()
|
||||
|
|
Loading…
Reference in New Issue