Merge "libvirt: Remove unused host parameters"
This commit is contained in:
commit
940dfce803
@ -19243,8 +19243,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
expected = drvr.vif_driver.get_config(instance, network_info[0],
|
||||
fake_image_meta,
|
||||
instance.get_flavor(),
|
||||
CONF.libvirt.virt_type,
|
||||
drvr._host)
|
||||
CONF.libvirt.virt_type)
|
||||
mock_get_config = self.useFixture(fixtures.MockPatchObject(
|
||||
drvr.vif_driver, 'get_config')).mock
|
||||
mock_get_config.return_value = expected
|
||||
@ -19261,7 +19260,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
|
||||
mock_get_config.assert_called_once_with(
|
||||
instance, network_info[0], test.MatchType(objects.ImageMeta),
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type, drvr._host)
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type)
|
||||
|
||||
@mock.patch.object(lockutils, "external_lock")
|
||||
def test_attach_interface_get_config(self, mock_lock):
|
||||
@ -23334,7 +23333,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
{'id': instance.image_ref})
|
||||
expected = self.drvr.vif_driver.get_config(
|
||||
instance, network_info[0], fake_image_meta, instance.flavor,
|
||||
CONF.libvirt.virt_type, self.drvr._host)
|
||||
CONF.libvirt.virt_type)
|
||||
with test.nested(
|
||||
mock.patch.object(host.Host, '_get_domain', return_value=domain),
|
||||
mock.patch.object(domain, 'attachDeviceFlags'),
|
||||
@ -23357,7 +23356,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
mock_info.assert_called_with()
|
||||
mock_get_config.assert_called_with(
|
||||
instance, network_info[0], fake_image_meta, instance.flavor,
|
||||
CONF.libvirt.virt_type, self.drvr._host)
|
||||
CONF.libvirt.virt_type)
|
||||
mock_build_device_metadata.assert_called_with(self.context,
|
||||
instance)
|
||||
mock_attach_device_flags.assert_called_with(
|
||||
@ -23397,7 +23396,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
{'id': instance.image_ref})
|
||||
expected = self.drvr.vif_driver.get_config(
|
||||
instance, network_info[0], fake_image_meta, instance.flavor,
|
||||
CONF.libvirt.virt_type, self.drvr._host)
|
||||
CONF.libvirt.virt_type)
|
||||
mock_build.return_value = objects.InstanceDeviceMetadata()
|
||||
|
||||
with test.nested(
|
||||
@ -23409,8 +23408,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
|
||||
mock_get_config.assert_called_once_with(
|
||||
instance, network_info[0], test.MatchType(objects.ImageMeta),
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type,
|
||||
self.drvr._host)
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type)
|
||||
mock_get_domain.assert_called_once_with(instance)
|
||||
mock_info.assert_called_once_with()
|
||||
mock_build.assert_called_once_with(self.context, instance)
|
||||
@ -23493,8 +23491,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
mock_get_guest.assert_called_once_with(instance)
|
||||
mock_get_config.assert_called_once_with(
|
||||
instance, network_info[0], test.MatchType(objects.ImageMeta),
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type,
|
||||
self.drvr._host)
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type)
|
||||
mock_get_interface.assert_has_calls(
|
||||
[mock.call(expected_cfg) for x in range(len(get_interface_calls))])
|
||||
|
||||
@ -23632,8 +23629,7 @@ class LibvirtDriverTestCase(test.NoDBTestCase, TraitsComparisonMixin):
|
||||
self.assertEqual(4, mock_get_interface.call_count)
|
||||
mock_get_config.assert_called_once_with(
|
||||
instance, network_info[0], test.MatchType(objects.ImageMeta),
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type,
|
||||
self.drvr._host)
|
||||
test.MatchType(objects.Flavor), CONF.libvirt.virt_type)
|
||||
mock_get_domain.assert_called_once_with(instance)
|
||||
mock_info.assert_called_once_with()
|
||||
mock_detach.assert_called_once_with(expected.to_xml(),
|
||||
|
@ -32,7 +32,6 @@ from nova import test
|
||||
from nova.tests.unit.virt import fakelibosinfo
|
||||
from nova.tests.unit.virt.libvirt import fakelibvirt
|
||||
from nova.virt.libvirt import config as vconfig
|
||||
from nova.virt.libvirt import host
|
||||
from nova.virt.libvirt import vif
|
||||
|
||||
CONF = cfg.CONF
|
||||
@ -591,10 +590,8 @@ class LibvirtVifTestCase(test.NoDBTestCase):
|
||||
image_meta = objects.ImageMeta.from_dict({})
|
||||
|
||||
conf = self._get_conf()
|
||||
hostimpl = host.Host("qemu:///system")
|
||||
nic = driver.get_config(self.instance, vif, image_meta,
|
||||
flavor, CONF.libvirt.virt_type,
|
||||
hostimpl)
|
||||
flavor, CONF.libvirt.virt_type)
|
||||
# TODO(stephenfin): There doesn't appear to be any reason we should do
|
||||
# this: just return 'nic.to_xml()' and remove '_get_node'
|
||||
conf.add_device(nic)
|
||||
|
@ -2195,8 +2195,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
self.vif_driver.plug(instance, vif)
|
||||
cfg = self.vif_driver.get_config(instance, vif, image_meta,
|
||||
instance.flavor,
|
||||
CONF.libvirt.virt_type,
|
||||
self._host)
|
||||
CONF.libvirt.virt_type)
|
||||
try:
|
||||
state = guest.get_power_state(self._host)
|
||||
live = state in (power_state.RUNNING, power_state.PAUSED)
|
||||
@ -2237,7 +2236,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
cfg = self.vif_driver.get_config(instance, vif,
|
||||
instance.image_meta,
|
||||
instance.flavor,
|
||||
CONF.libvirt.virt_type, self._host)
|
||||
CONF.libvirt.virt_type)
|
||||
interface = guest.get_interface_by_cfg(cfg)
|
||||
try:
|
||||
self.vif_driver.unplug(instance, vif)
|
||||
@ -4396,8 +4395,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
vif,
|
||||
instance.image_meta,
|
||||
instance.flavor,
|
||||
CONF.libvirt.virt_type,
|
||||
self._host)
|
||||
CONF.libvirt.virt_type)
|
||||
LOG.debug('Attaching direct passthrough port %(port)s '
|
||||
'to %(dom)s', {'port': vif, 'dom': guest.id},
|
||||
instance=instance)
|
||||
@ -6107,8 +6105,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
|
||||
for vif in network_info:
|
||||
config = self.vif_driver.get_config(
|
||||
instance, vif, image_meta,
|
||||
flavor, virt_type, self._host)
|
||||
instance, vif, image_meta, flavor, virt_type,
|
||||
)
|
||||
guest.add_device(config)
|
||||
|
||||
self._create_consoles(virt_type, guest, instance, flavor, image_meta)
|
||||
@ -9064,7 +9062,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
image_meta=instance.image_meta,
|
||||
inst_type=instance.flavor,
|
||||
virt_type=CONF.libvirt.virt_type,
|
||||
host=self._host)
|
||||
)
|
||||
self._detach_direct_passthrough_vifs(context,
|
||||
migrate_data, instance)
|
||||
new_resources = None
|
||||
|
@ -516,9 +516,7 @@ class LibvirtGenericVIFDriver(object):
|
||||
|
||||
return conf
|
||||
|
||||
# TODO(stephenfin): Remove unused host argument
|
||||
def get_config(self, instance, vif, image_meta,
|
||||
inst_type, virt_type, host):
|
||||
def get_config(self, instance, vif, image_meta, inst_type, virt_type):
|
||||
vif_type = vif['type']
|
||||
vnic_type = vif['vnic_type']
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user