libvirt: add method to configure migration speed

In this commit we are enhancing guest object to control the maximum bw
to perform migration.

Related-Bug: #1414559
Change-Id: I35470773b8c467449ed71217fdb4b6c82f455e33
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
This commit is contained in:
Sahid Orentino Ferdjaoui 2017-08-24 09:47:29 -04:00
parent f44ffecae7
commit 23446a9552
3 changed files with 14 additions and 0 deletions

View File

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

View File

@ -654,6 +654,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):

View File

@ -663,6 +663,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()