Merge "Move equality check into LibvirtConfigGuestInterface"
This commit is contained in:
@@ -1686,6 +1686,20 @@ class LibvirtConfigGuestInterface(LibvirtConfigGuestDevice):
|
||||
self.device_addr = None
|
||||
self.mtu = None
|
||||
|
||||
def __eq__(self, other):
|
||||
if not isinstance(other, LibvirtConfigGuestInterface):
|
||||
return False
|
||||
|
||||
# NOTE(arches) Skip checking target_dev for vhostuser
|
||||
# vif type; target_dev is not a valid value for vhostuser.
|
||||
return (
|
||||
self.mac_addr == other.mac_addr and
|
||||
self.net_type == other.net_type and
|
||||
self.source_dev == other.source_dev and
|
||||
(self.net_type == 'vhostuser' or
|
||||
self.target_dev == other.target_dev) and
|
||||
self.vhostuser_path == other.vhostuser_path)
|
||||
|
||||
@property
|
||||
def uses_virtio(self):
|
||||
return 'virtio' == self.model
|
||||
|
||||
@@ -246,14 +246,9 @@ class Guest(object):
|
||||
# NOTE(leehom) LibvirtConfigGuestInterface get from domain and
|
||||
# LibvirtConfigGuestInterface generated by
|
||||
# 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
|
||||
interface.net_type == cfg.net_type and
|
||||
interface.source_dev == cfg.source_dev and
|
||||
(cfg.net_type == 'vhostuser' or
|
||||
interface.target_dev == cfg.target_dev) and
|
||||
interface.vhostuser_path == cfg.vhostuser_path):
|
||||
# NOTE(gibi): LibvirtConfigGuestInterface does a custom
|
||||
# equality check based on available information on nova side
|
||||
if cfg == interface:
|
||||
return interface
|
||||
|
||||
def get_vcpus_info(self):
|
||||
|
||||
Reference in New Issue
Block a user