mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-10 01:18:03 +03:00
devices: interface: Convert setup() to validate()
That's all it's doing. Fold in mac validation while we are here
This commit is contained in:
parent
43f40950eb
commit
c27cdc67de
@ -369,6 +369,8 @@ class vmmNetworkList(vmmGObjectUI):
|
||||
net.virtualport.typeid = vport_typeid or None
|
||||
net.virtualport.typeidversion = vport_idver or None
|
||||
net.virtualport.instanceid = vport_instid or None
|
||||
|
||||
net.validate()
|
||||
except Exception as e:
|
||||
return self.err.val_err(_("Error with network parameters."), e)
|
||||
|
||||
|
@ -204,10 +204,6 @@ class DeviceInterface(Device):
|
||||
# XML helpers #
|
||||
###############
|
||||
|
||||
def _validate_mac(self, val):
|
||||
util.validate_macaddr(val)
|
||||
return val
|
||||
|
||||
def _get_source(self):
|
||||
"""
|
||||
Convenience function, try to return the relevant <source> value
|
||||
@ -257,7 +253,7 @@ class DeviceInterface(Device):
|
||||
type = XMLProperty("./@type")
|
||||
trustGuestRxFilters = XMLProperty("./@trustGuestRxFilters", is_yesno=True)
|
||||
|
||||
macaddr = XMLProperty("./mac/@address", set_converter=_validate_mac)
|
||||
macaddr = XMLProperty("./mac/@address")
|
||||
|
||||
source_type = XMLProperty("./source/@type")
|
||||
source_path = XMLProperty("./source/@path")
|
||||
@ -281,11 +277,11 @@ class DeviceInterface(Device):
|
||||
# Build API #
|
||||
#############
|
||||
|
||||
def setup(self, meter=None):
|
||||
ignore = meter
|
||||
def validate(self):
|
||||
if not self.macaddr:
|
||||
return
|
||||
|
||||
util.validate_macaddr(self.macaddr)
|
||||
ret, msg = self.is_conflict_net(self.conn, self.macaddr)
|
||||
if msg is None:
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user