<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix"><br>
Even with this patch I am unable to create a vlan tagged bridge on
Ubuntu.<br>
<br>
The errors I got:<br>
<br>
[12/Feb/2014:15:28:34] HTTP Traceback (most recent call last):<br>
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py",
line 656, in respond<br>
response.body = self.handler()<br>
File
"/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line
188, in __call__<br>
self.body = self.oldhandler(*args, **kwargs)<br>
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py",
line 34, in __call__<br>
return self.callable(*self.args, **self.kwargs)<br>
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line
277, in index<br>
return self.create(parse_request(), *args)<br>
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line
211, in create<br>
name = create(*args)<br>
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line
56, in create<br>
self._set_network_bridge(params)<br>
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line
119, in _set_network_bridge<br>
str(params['vlan_id']))<br>
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line
147, in _create_vlan_tagged_bridge<br>
<b>vlan_tagged_br = conn.interfaceDefineXML(br_xml)</b><br>
File
"/home/alinefm/kimchi/src/kimchi/model/libvirtconnection.py", line
65, in wrapper<br>
ret = f(*args, **kwargs)<br>
TypeError: interfaceDefineXML() takes exactly 3 arguments (2
given)<br>
<br>
[12/Feb/2014:15:30:42] HTTP Traceback (most recent call last):<br>
File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py",
line 656, in respond<br>
response.body = self.handler()<br>
File
"/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line
188, in __call__<br>
self.body = self.oldhandler(*args, **kwargs)<br>
File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py",
line 34, in __call__<br>
return self.callable(*self.args, **self.kwargs)<br>
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line
277, in index<br>
return self.create(parse_request(), *args)<br>
File "/home/alinefm/kimchi/src/kimchi/control/base.py", line
211, in create<br>
name = create(*args)<br>
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line
56, in create<br>
self._set_network_bridge(params)<br>
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line
119, in _set_network_bridge<br>
str(params['vlan_id']))<br>
File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line
148, in _create_vlan_tagged_bridge<br>
<b>vlan_tagged_br.create()</b><br>
File
"/home/alinefm/kimchi/src/kimchi/model/libvirtconnection.py", line
65, in wrapper<br>
ret = f(*args, **kwargs)<br>
TypeError: create() takes exactly 2 arguments (1 given)<br>
<br>
They are because, libvirt has not a default value for flags.<br>
We should use: <br>
conn.interfaceDefineXML(br_xml, 0) and vlan_tagged_br.create(0)<br>
<br>
Ramon, could you include those fix in this patch?<br>
<br>
<br>
<br>
<br>
On 02/11/2014 11:34 AM, Ramon Medeiros wrote:<br>
</div>
<blockquote
cite="mid:1392125685-23706-2-git-send-email-ramonn@linux.vnet.ibm.com"
type="cite">
<pre wrap="">Python binding for libvirt does not support conn.changeBegin() and
conn.commit(). To make the change safe, this procedure was changed to a
internal framework: RollbackContext.
Signed-off-by: Ramon Medeiros <a class="moz-txt-link-rfc2396E" href="mailto:ramonn@linux.vnet.ibm.com"><ramonn@linux.vnet.ibm.com></a>
---
src/kimchi/model/networks.py | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
index b164141..d577154 100644
--- a/src/kimchi/model/networks.py
+++ b/src/kimchi/model/networks.py
@@ -29,7 +29,7 @@ from kimchi import networkxml
from kimchi import xmlutils
from kimchi.exception import InvalidOperation, InvalidParameter
from kimchi.exception import MissingParameter, NotFoundError, OperationFailed
-
+from kimchi.rollbackcontext import RollbackContext
class NetworksModel(object):
def __init__(self, **kargs):
@@ -138,17 +138,17 @@ class NetworksModel(object):
br_xml = networkxml.create_vlan_tagged_bridge_xml(br_name, interface,
vlan_id)
conn = self.conn.get()
- conn.changeBegin()
- try:
- vlan_tagged_br = conn.interfaceDefineXML(br_xml)
- vlan_tagged_br.create()
- except libvirt.libvirtError as e:
- conn.changeRollback()
- raise OperationFailed(e.message)
- else:
- conn.changeCommit()
- return br_name
+ with RollbackContext() as rollback:
+
+ try:
+ vlan_tagged_br = conn.interfaceDefineXML(br_xml)
+ vlan_tagged_br.create()
+ except libvirt.libvirtError as e:
+ rollback.prependDefer(vlan_tagged_br.destroy)
+ raise OperationFailed(e.message)
+ else:
+ return br_name
class NetworkModel(object):
def __init__(self, **kargs):
</pre>
</blockquote>
<br>
</body>
</html>