libvirt: bandwidth param should be set in guest migrate

The bandwidth param set outside of the method "migrate" from guest
object have to be done inside that to avoid duplicating that option.

Change-Id: I8a37753dea8eca7b26466f17dfbdc184c48c24c5
Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@redhat.com>
This commit is contained in:
Sahid Orentino Ferdjaoui
2017-08-24 09:39:06 -04:00
parent a8cf7acc21
commit c212ad27b0
3 changed files with 4 additions and 4 deletions

View File

@@ -644,7 +644,7 @@ class GuestTestCase(test.NoDBTestCase):
self.guest.migrate('an-uri', domain_xml='</xml>',
params={'p1': 'v1'}, flags=1, bandwidth=2)
self.domain.migrateToURI3.assert_called_once_with(
'an-uri', flags=1, params={'p1': 'v1'})
'an-uri', flags=1, params={'p1': 'v1', 'bandwidth': 2})
def test_abort_job(self):
self.guest.abort_job()

View File

@@ -6327,7 +6327,6 @@ class LibvirtDriver(driver.ComputeDriver):
if self._host.has_min_version(
MIN_LIBVIRT_BLOCK_LM_WITH_VOLUMES_VERSION):
params = {
'bandwidth': CONF.libvirt.live_migration_bandwidth,
'destination_xml': new_xml_str,
'migrate_disks': device_names,
}

View File

@@ -640,10 +640,11 @@ class Guest(object):
destination, flags=flags, bandwidth=bandwidth)
else:
if params:
# In migrateToURI3 these parameters are extracted from the
# `params` dict
if migrate_uri:
# In migrateToURI3 this parameter is searched in
# the `params` dict
params['migrate_uri'] = migrate_uri
params['bandwidth'] = bandwidth
self._domain.migrateToURI3(
destination, params=params, flags=flags)
else: