devices: interface: Rename is_conflict_net -> check_mac_in_use

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-07-05 18:56:36 -04:00
parent f27e203732
commit a8d2438d5a
6 changed files with 8 additions and 8 deletions

View File

@ -268,8 +268,8 @@ class TestXMLMisc(unittest.TestCase):
self.assertTrue(qemumac != testmac) self.assertTrue(qemumac != testmac)
self.assertTrue(len(randommac) == len(testmac)) self.assertTrue(len(randommac) == len(testmac))
# Ensure is_conflict_net doesn't error on None # Ensure check_mac_in_use doesn't error on None
virtinst.DeviceInterface.is_conflict_net(self.conn, None) virtinst.DeviceInterface.check_mac_in_use(self.conn, None)
def test_support_misc(self): def test_support_misc(self):
try: try:

View File

@ -693,7 +693,7 @@ class vmmCloneVM(vmmGObjectUI):
row = self.net_list[orig] row = self.net_list[orig]
try: try:
DeviceInterface.is_conflict_net(self.conn.get_backend(), new) DeviceInterface.check_mac_in_use(self.conn.get_backend(), new)
row[NETWORK_INFO_NEW_MAC] = new row[NETWORK_INFO_NEW_MAC] = new
except Exception as e: except Exception as e:
self.err.show_err(_("Error changing MAC address: %s") % str(e)) self.err.show_err(_("Error changing MAC address: %s") % str(e))

View File

@ -1677,7 +1677,7 @@ class vmmDetails(vmmGObjectUI):
if self.edited(EDIT_NET_MAC): if self.edited(EDIT_NET_MAC):
kwargs["macaddr"] = self.widget("network-mac-entry").get_text() kwargs["macaddr"] = self.widget("network-mac-entry").get_text()
virtinst.DeviceInterface.is_conflict_net( virtinst.DeviceInterface.check_mac_in_use(
self.conn.get_backend(), kwargs["macaddr"]) self.conn.get_backend(), kwargs["macaddr"])
if self.edited(EDIT_NET_LINKSTATE): if self.edited(EDIT_NET_LINKSTATE):

View File

@ -298,7 +298,7 @@ class vmmNetworkList(vmmGObjectUI):
def validate_device(self, net): def validate_device(self, net):
self._check_network_is_running(net) self._check_network_is_running(net)
virtinst.DeviceInterface.is_conflict_net(net.conn, net.macaddr) virtinst.DeviceInterface.check_mac_in_use(net.conn, net.macaddr)
net.validate() net.validate()
def reset_state(self): def reset_state(self):

View File

@ -333,7 +333,7 @@ def validate_mac(conn, macaddr):
with --check with --check
""" """
try: try:
DeviceInterface.is_conflict_net(conn, macaddr) DeviceInterface.check_mac_in_use(conn, macaddr)
return return
except Exception as e: except Exception as e:
_optional_fail(str(e), "mac_in_use") _optional_fail(str(e), "mac_in_use")

View File

@ -145,7 +145,7 @@ class DeviceInterface(Device):
for ignore in range(256): for ignore in range(256):
mac = _random_mac(conn) mac = _random_mac(conn)
try: try:
DeviceInterface.is_conflict_net(conn, mac) DeviceInterface.check_mac_in_use(conn, mac)
return mac return mac
except RuntimeError: # pragma: no cover except RuntimeError: # pragma: no cover
continue continue
@ -155,7 +155,7 @@ class DeviceInterface(Device):
return None # pragma: no cover return None # pragma: no cover
@staticmethod @staticmethod
def is_conflict_net(conn, searchmac): def check_mac_in_use(conn, searchmac):
""" """
Raise RuntimeError if the passed mac conflicts with a defined VM Raise RuntimeError if the passed mac conflicts with a defined VM
""" """