Giuseppe Vallarelli has posted comments on this change.
Change subject: Qos feature: Adds bandwidth definition at configuration level.
......................................................................
Patch Set 3: (1 inline comment)
....................................................
File vdsm/netconf/ifcfg.py
Line 17: # Refer to the README and COPYING files for full details of the license
Line 18: #
Line 19:
Line 20: from xml.sax.saxutils import escape
Line 21: from xml.etree.ElementTree import Element as XmlElement, tostring
Handmade xml generation (still bugged) do you feel this is a way worth pursuing
?
(inbound outbound are not compulsory same applies for peak and burst attributes
def createNetXml(self, netName, network, bridged, iface,
qosInbound=None, qosOutbound=None):
"""
Creates Network Xml e.g.:
<network>
<name>dummy</name>
<forward mode='bridge' || 'passthrough'/>
<bridge name='awesome'/> || <interface dev='awesome'/>
[<bandwidth>]
[<inbound average='1000' [peak='5000'] [burst='1024']/>]
[<outbound average='1000' [burst='1024']/>]
[</bandwidth>]
</network>
Forward mode can be either bridge or passthrough,
according to net if bridged or bridgeless this
determines respectively the presence of bridge
or interface element. Inbound or outbound element
can be optionally defined.
"""
def qosElemString(string_type, elem):
if 'burst' and 'peak' in elem:
return '<%s average=%s burst=%s peak=%s/>' % (
string_type, elem.get('average'),
elem.get('burst'), elem.get('peak'))
elif 'burst' in elem:
return '<%s average=%s burst=%s />' % (
string_type, elem.get('average'),
elem.get('burst'))
elif 'peak' in elem:
return '<%s average=%s burst=%s />' % (
string_type, elem.get('average'),
elem.get('burst'))
else:
return '<%s average=%s />' % (string_type, elem.get('average'))
if bridged:
netXml = '''<network><name>%s</name><forward mode='bridge'/>
<bridge name='%s'></network>'''
else:
netXml = ('''<network><name>%s</name><forward
mode='passthrough'>'''
'''<interface dev='%s'/></forward></network>''')
if qosInbound or qosOutbound:
netXml = netXml % (escape(netName), escape(network),
'<bandwidth>%s</bandwidth>')
if qosInbound and qosOutbound:
netXml = netXml % '/n'.join([qosElemString('inbound',
qosInbound),
qosElemString('outbound',
qosOutbound)])
return netXml
if qosInbound:
netXml = netXml % qosElemString('inbound', qosInbound)
return netXml
if qosOutbound:
netXml = netXml % qosElemString('outbound', qosOutbound)
return netXml
return netXml
Line 22: import glob
Line 23: import libvirt
Line 24: import logging
Line 25: import os
--
To view, visit http://gerrit.ovirt.org/15724
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: If0c3b4b9a6fd5eb53579fb2e157b5325caa88d04
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches