From a8d2438d5a4725825af936c72ccffad3d5c7b992 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 5 Jul 2020 18:56:36 -0400 Subject: [PATCH] devices: interface: Rename is_conflict_net -> check_mac_in_use Signed-off-by: Cole Robinson --- tests/test_xmlconfig.py | 4 ++-- virtManager/clone.py | 2 +- virtManager/details/details.py | 2 +- virtManager/device/netlist.py | 2 +- virtinst/cli.py | 2 +- virtinst/devices/interface.py | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_xmlconfig.py b/tests/test_xmlconfig.py index 73d91bfbc..cd5d28275 100644 --- a/tests/test_xmlconfig.py +++ b/tests/test_xmlconfig.py @@ -268,8 +268,8 @@ class TestXMLMisc(unittest.TestCase): self.assertTrue(qemumac != testmac) self.assertTrue(len(randommac) == len(testmac)) - # Ensure is_conflict_net doesn't error on None - virtinst.DeviceInterface.is_conflict_net(self.conn, None) + # Ensure check_mac_in_use doesn't error on None + virtinst.DeviceInterface.check_mac_in_use(self.conn, None) def test_support_misc(self): try: diff --git a/virtManager/clone.py b/virtManager/clone.py index db5251fe8..c929259dc 100644 --- a/virtManager/clone.py +++ b/virtManager/clone.py @@ -693,7 +693,7 @@ class vmmCloneVM(vmmGObjectUI): row = self.net_list[orig] 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 except Exception as e: self.err.show_err(_("Error changing MAC address: %s") % str(e)) diff --git a/virtManager/details/details.py b/virtManager/details/details.py index e6ca45b9b..8628e9371 100644 --- a/virtManager/details/details.py +++ b/virtManager/details/details.py @@ -1677,7 +1677,7 @@ class vmmDetails(vmmGObjectUI): if self.edited(EDIT_NET_MAC): 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"]) if self.edited(EDIT_NET_LINKSTATE): diff --git a/virtManager/device/netlist.py b/virtManager/device/netlist.py index 4e4c08e67..ace5a0151 100644 --- a/virtManager/device/netlist.py +++ b/virtManager/device/netlist.py @@ -298,7 +298,7 @@ class vmmNetworkList(vmmGObjectUI): def validate_device(self, 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() def reset_state(self): diff --git a/virtinst/cli.py b/virtinst/cli.py index a43d87172..bb21495ab 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -333,7 +333,7 @@ def validate_mac(conn, macaddr): with --check """ try: - DeviceInterface.is_conflict_net(conn, macaddr) + DeviceInterface.check_mac_in_use(conn, macaddr) return except Exception as e: _optional_fail(str(e), "mac_in_use") diff --git a/virtinst/devices/interface.py b/virtinst/devices/interface.py index 229f9a089..e970f8942 100644 --- a/virtinst/devices/interface.py +++ b/virtinst/devices/interface.py @@ -145,7 +145,7 @@ class DeviceInterface(Device): for ignore in range(256): mac = _random_mac(conn) try: - DeviceInterface.is_conflict_net(conn, mac) + DeviceInterface.check_mac_in_use(conn, mac) return mac except RuntimeError: # pragma: no cover continue @@ -155,7 +155,7 @@ class DeviceInterface(Device): return None # pragma: no cover @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 """