On 12/29/2014 09:53 AM, Aline Manera wrote:
When trying to delete a VLAN tagging bridged network I got the
following
error because of the VLAN bridge was not active.
[26/Dec/2014:16:28:42] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in
respond
response.body = self.handler()
File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217,
in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in
__call__
return self.callable(*self.args, **self.kwargs)
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line 158, in index
'PUT': self.update}[method]()
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line 135, in delete
fn(*self.model_args)
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line 327, in
delete
self._remove_vlan_tagged_bridge(network)
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line 372, in
_remove_vlan_tagged_bridge
iface.destroy(0)
File "/home/alinefm/kimchi/src/kimchi/model/libvirtconnection.py", line 66,
in wrapper
ret = f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/libvirt.py", line 2894, in destroy
if ret == -1: raise libvirtError ('virInterfaceDestroy() failed', net=self)
libvirtError: Requested operation is not valid: interface is not running
I was not
able to reproduce this, is this for a specific distro?
virsh # iface-list --all
Name State MAC Address
--------------------------------------------
kbem1-4 inactive
lo active 00:00:00:00:00:00
virsh # net-list
Name State Autostart Persistent
----------------------------------------------------------
abc active yes yes
default active yes yes
virsh # net-dumpxml abc
<network>
<name>abc</name>
<uuid>1dfcefe2-de3f-41e0-a74d-1c5769f1d05e</uuid>
<forward mode='bridge'/>
<bridge name='kbem1-4'/>
</network>
When delete the bridge:
9.115.122.223 - - [30/Dec/2014:03:01:37] "GET /networks HTTP/1.0" 200
564 "https://9.115.122.184:8001/" "Mozilla/5.0 (X11; Linux x86_64;
rv:31.0) Gecko/20100101 Firefox/31.0"
9.115.122.223 - - [30/Dec/2014:03:01:40] "GET /networks/abc HTTP/1.0"
200 221 "https://9.115.122.184:8001/" "Mozilla/5.0 (X11; Linux x86_64;
rv:31.0) Gecko/20100101 Firefox/31.0"
9.115.122.223 - - [30/Dec/2014:03:01:44] "DELETE /networks/abc HTTP/1.0"
204 - "https://9.115.122.184:8001/" "Mozilla/5.0 (X11; Linux x86_64;
rv:31.0) Gecko/20100101 Firefox/31.0"
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/networks.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index 44f1297..dad31c7 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -369,5 +369,5 @@ class NetworkModel(object):
if bridge.startswith(KIMCHI_BRIDGE_PREFIX):
conn = self.conn.get()
iface = conn.interfaceLookupByName(bridge)
- iface.destroy(0)
+ iface.isActive() and iface.destroy(0)
iface.undefine()