devices: interface: Rename is_conflict_net -> check_mac_in_use
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
f27e203732
commit
a8d2438d5a
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue