summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-05-26 04:54:16 +0000
committerGerrit Code Review <review@openstack.org>2017-05-26 04:54:16 +0000
commitd756b78e303753e1b88e0691aa0fd13d2edaf1f0 (patch)
treea63fbf7566388fd89343d27d960d5ede3746d47e
parentf0cd6af7916f9a1810320e3b50da11b5f1649ffb (diff)
parentb4bbe68e279aa94aa71aef1a3879d42bf90d3170 (diff)
Merge "Fixed suspend for PCI passthrough" into stable/newton14.0.7
-rw-r--r--nova/tests/unit/virt/libvirt/test_driver.py20
-rw-r--r--nova/virt/libvirt/driver.py3
2 files changed, 22 insertions, 1 deletions
diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py
index e060c42..3a121f6 100644
--- a/nova/tests/unit/virt/libvirt/test_driver.py
+++ b/nova/tests/unit/virt/libvirt/test_driver.py
@@ -11660,6 +11660,26 @@ class LibvirtConnTestCase(test.NoDBTestCase):
11660 @mock.patch.object(FakeVirtDomain, 'ID', return_value=1) 11660 @mock.patch.object(FakeVirtDomain, 'ID', return_value=1)
11661 @mock.patch.object(utils, 'get_image_from_system_metadata', 11661 @mock.patch.object(utils, 'get_image_from_system_metadata',
11662 return_value=None) 11662 return_value=None)
11663 def test_attach_sriov_direct_physical_ports(self,
11664 mock_get_image_metadata,
11665 mock_ID,
11666 mock_attachDevice):
11667 instance = objects.Instance(**self.test_instance)
11668
11669 network_info = _fake_network_info(self, 1)
11670 network_info[0]['vnic_type'] = network_model.VNIC_TYPE_DIRECT_PHYSICAL
11671 guest = libvirt_guest.Guest(FakeVirtDomain())
11672 drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
11673
11674 drvr._attach_sriov_ports(self.context, instance, guest, network_info)
11675 mock_get_image_metadata.assert_called_once_with(
11676 instance.system_metadata)
11677 self.assertTrue(mock_attachDevice.called)
11678
11679 @mock.patch.object(FakeVirtDomain, 'attachDeviceFlags')
11680 @mock.patch.object(FakeVirtDomain, 'ID', return_value=1)
11681 @mock.patch.object(utils, 'get_image_from_system_metadata',
11682 return_value=None)
11663 def test_attach_sriov_ports_with_info_cache(self, 11683 def test_attach_sriov_ports_with_info_cache(self,
11664 mock_get_image_metadata, 11684 mock_get_image_metadata,
11665 mock_ID, 11685 mock_ID,
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 70410dc..9b1cab2 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -3252,7 +3252,8 @@ class LibvirtDriver(driver.ComputeDriver):
3252 @staticmethod 3252 @staticmethod
3253 def _has_sriov_port(network_info): 3253 def _has_sriov_port(network_info):
3254 for vif in network_info: 3254 for vif in network_info:
3255 if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT: 3255 if vif['vnic_type'] in [network_model.VNIC_TYPE_DIRECT,
3256 network_model.VNIC_TYPE_DIRECT_PHYSICAL]:
3256 return True 3257 return True
3257 return False 3258 return False
3258 3259