Merge "Skip checking of target_dev for vhostuser"
This commit is contained in:
commit
c134feda3d
@ -549,6 +549,34 @@ class GuestTestCase(test.NoDBTestCase):
|
|||||||
self.guest.get_interface_by_cfg(cfg))
|
self.guest.get_interface_by_cfg(cfg))
|
||||||
self.assertIsNone(self.guest.get_interface_by_cfg(None))
|
self.assertIsNone(self.guest.get_interface_by_cfg(None))
|
||||||
|
|
||||||
|
def test_get_interface_by_cfg_vhostuser(self):
|
||||||
|
self.domain.XMLDesc.return_value = """<domain>
|
||||||
|
<devices>
|
||||||
|
<interface type="vhostuser">
|
||||||
|
<mac address='fa:16:3e:55:3e:e4'/>
|
||||||
|
<source type='unix' path='/var/run/openvswitch/vhued80c655-4e'
|
||||||
|
mode='server'/>
|
||||||
|
<target dev='vhued80c655-4e'/>
|
||||||
|
<model type='virtio'/>
|
||||||
|
<alias name='net0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03'
|
||||||
|
function='0x0'/>
|
||||||
|
</interface>
|
||||||
|
</devices>
|
||||||
|
</domain>"""
|
||||||
|
cfg = vconfig.LibvirtConfigGuestInterface()
|
||||||
|
cfg.parse_str("""<interface type="vhostuser">
|
||||||
|
<mac address='fa:16:3e:55:3e:e4'/>
|
||||||
|
<model type="virtio"/>
|
||||||
|
<source type='unix' path='/var/run/openvswitch/vhued80c655-4e'
|
||||||
|
mode='server'/>
|
||||||
|
<alias name='net0'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||||
|
</interface>""")
|
||||||
|
self.assertIsNotNone(
|
||||||
|
self.guest.get_interface_by_cfg(cfg))
|
||||||
|
self.assertIsNone(self.guest.get_interface_by_cfg(None))
|
||||||
|
|
||||||
def test_get_info(self):
|
def test_get_info(self):
|
||||||
self.domain.info.return_value = (1, 2, 3, 4, 5)
|
self.domain.info.return_value = (1, 2, 3, 4, 5)
|
||||||
self.domain.ID.return_value = 6
|
self.domain.ID.return_value = 6
|
||||||
|
@ -241,10 +241,13 @@ class Guest(object):
|
|||||||
# NOTE(leehom) LibvirtConfigGuestInterface get from domain and
|
# NOTE(leehom) LibvirtConfigGuestInterface get from domain and
|
||||||
# LibvirtConfigGuestInterface generated by
|
# LibvirtConfigGuestInterface generated by
|
||||||
# nova.virt.libvirt.vif.get_config must be identical.
|
# nova.virt.libvirt.vif.get_config must be identical.
|
||||||
|
# NOTE(arches) Skip checking target_dev for vhostuser
|
||||||
|
# vif type; target_dev is not a valid value for vhostuser.
|
||||||
if (interface.mac_addr == cfg.mac_addr and
|
if (interface.mac_addr == cfg.mac_addr and
|
||||||
interface.net_type == cfg.net_type and
|
interface.net_type == cfg.net_type and
|
||||||
interface.source_dev == cfg.source_dev and
|
interface.source_dev == cfg.source_dev and
|
||||||
interface.target_dev == cfg.target_dev and
|
(cfg.net_type == 'vhostuser' or
|
||||||
|
interface.target_dev == cfg.target_dev) and
|
||||||
interface.vhostuser_path == cfg.vhostuser_path):
|
interface.vhostuser_path == cfg.vhostuser_path):
|
||||||
return interface
|
return interface
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user