[Kimchi-devel] [PATCH] Bug fix #309 - network: Unable to create vlan tagged on Ubuntu
Aline Manera
alinefm at linux.vnet.ibm.com
Mon Feb 17 12:42:06 UTC 2014
On 02/17/2014 08:55 AM, Ramon Medeiros wrote:
> 2 arguments (1 given)
>>
>> They are because, libvirt has not a default value for flags.
>> We should use:
>> conn.interfaceDefineXML(br_xml, 0) and vlan_tagged_br.create(0)
>>
>> Ramon, could you include those fix in this patch?
>>
> You said that i need to change the remove_vg function too.
>
> What function that i have to pass the 0 flag?
>
> def _remove_vlan_tagged_bridge(self, network):
> try:
> bridge = network.bridgeName()
> except libvirt.libvirtError:
> pass
> else:
> if bridge.startswith('kimchi-'):
> conn = self.conn.get()
> iface = conn.interfaceLookupByName(bridge)
> if iface.isActive():
> iface.destroy()
> iface.undefine()
>
> iface.destroy(0) and iface.undefine(0)?
I don't think it is needed for iface.undedine() but it is true for
iface.destroy(0)
>
>>
>>
>>
>> On 02/11/2014 11:34 AM, Ramon Medeiros wrote:
>>> 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<ramonn at linux.vnet.ibm.com>
>>> ---
>>> 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):
>>
>
>
More information about the Kimchi-devel
mailing list