createinterface: raise value error when no ip addr set

We could set blank ip address

IP setting->Configure->Mode (static), then press "OK".

And libvirt will throw an error not very helpful:
Error creating interface: 'Could not define interface:
XML error: could not get interface XML description:
XML invalid - Element protocol failed to validate attributes.

This patch will forbid setting an empty ip address.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
Chen Hanxiao 2014-03-30 07:47:22 +08:00
parent 5120b90fc3
commit 119025e1ef
1 changed files with 1 additions and 1 deletions

View File

@ -764,7 +764,7 @@ class vmmCreateInterface(vmmGObjectUI):
def build_ip_info(self):
def build_ip(addr_str):
if not addr_str:
return None, None
raise ValueError(_("Please enter an IP address"))
ret = addr_str.rsplit("/", 1)
address = ret[0]
prefix = None