summaryrefslogtreecommitdiff
path: root/virtinst/network.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2018-09-03 15:45:26 -0400
committerCole Robinson <crobinso@redhat.com>2018-09-04 14:55:04 -0400
commit852d7b564df230b45e1c809f1a5fea8d1e225546 (patch)
tree945fd4f97fbe879bf57603441509918a27d7e994 /virtinst/network.py
parent2ac54ac00149307ff93657935fc7c0a52b3aa7e9 (diff)
downloadvirt-manager-852d7b564df230b45e1c809f1a5fea8d1e225546.tar.gz
virtinst: Remove name field validate_cb usage
Either openly do this at callers, or wrap it in a validate() call. Doing this at set time has always had issues, like the self.replace hack
Diffstat (limited to 'virtinst/network.py')
-rw-r--r--virtinst/network.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/virtinst/network.py b/virtinst/network.py
index 41c2b7b2..84530d1c 100644
--- a/virtinst/network.py
+++ b/virtinst/network.py
@@ -187,11 +187,12 @@ class Network(XMLBuilder):
# Validation helpers #
######################
- def _validate_name(self, name):
+ @staticmethod
+ def validate_name(conn, name):
util.validate_name(_("Network"), name)
try:
- self.conn.networkLookupByName(name)
+ conn.networkLookupByName(name)
except libvirt.libvirtError:
return
raise ValueError(_("Name '%s' already in use by another network." %
@@ -208,7 +209,7 @@ class Network(XMLBuilder):
"macaddr", "ips", "routes", "bandwidth"]
ipv6 = XMLProperty("./@ipv6", is_yesno=True)
- name = XMLProperty("./name", validate_cb=_validate_name)
+ name = XMLProperty("./name")
uuid = XMLProperty("./uuid")
virtualport_type = XMLProperty("./virtualport/@type")