MTU configuration option on VIF interfaces
Hello all,
I did some 'development' work and not sure if it will work.
I would have possibility to set MTU size for virtual interfaces.
I tried to set mtu in /etc/xen/scripts/vif-nat first, but this did not work.
Could somebody review my diff's made on Debian Lenny? You know - I am not a python developer and not a developer at all. ;-)
Best regards,
Peter Viskup
/usr/lib/xen-3.2-1/lib/python/xen/xend/XendDomainInfo.py 2625,2629c2625
< # config['MTU'] = 1500 # TODO
< if not config.has_key('MTU'):
< config['MTU'] = config.get('mtu', '')
< else:
< config['MTU'] = 1500
---
Quoted 1 line
config['MTU'] = 1500 # TODO
/usr/lib/xen-3.2-1/lib/python/xen/xend/server/netif.py 117d116
< mtu = config.get('mtu')
125,126c124
< 'mac' : mac, < 'mtu' : mtu }
---
Quoted 1 line
'mac' : mac }
158,159c156
< 'mac' : mac, < 'mtu' : mtu }
---
Quoted 1 line
'mac' : mac }
198c195
< 'security_label', 'mtu'):
---
Quoted 1 line
'security_label'):
205c202
< model, accel, security_label, mtu) = devinfo
---
Quoted 1 line
model, accel,
security_label) = devinfo
229,230d225
< if mtu:
< result['mtu'] = mtu/usr/lib/xen-3.2-1/lib/python/xen/xend/XendVnet.py 97c97
< def vifctl(self, op, vif, vmac, vmtu):
---
Quoted 1 line
def
vifctl(self, op, vif, vmac):
100c100
< return vnet_cmd([fn, ['vnet', self.id], ['vif', vif], ['vmac', vmac], ['vmtu', vmtu]])
---
Quoted 1 line
return vnet_cmd([fn, ['vnet', self.id], ['vif', vif], ['vmac', vmac]])
102c102
< log.warning("vifctl failed: op=%s vif=%s mac=%s", op, vif, vmac, vmtu)
---
Quoted 1 line
log.warning("vifctl failed: op=%s vif=%s mac=%s", op, vif, vmac)
/usr/lib/xen-3.2-1/lib/python/xen/xm/main.py
168c168
< '[accel=<accel>] [mtu=<mtu>]',
---
Quoted 1 line
'[accel=<accel>]',
2129c2129
< 'backend', 'vifname', 'rate', 'model', 'accel', 'mtu']
---
Quoted 1 line
'backend', 'vifname', 'rate', 'model', 'accel']
2178,2180c2178
< lambda x: set(['other_config', 'accel'], x),
< 'mtu':
< lambda x: set(['other_config', 'mtu'], x)
---
Quoted 1 line
lambda x: set(['other_config', 'accel'], x)
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 7 lines · Peter Viskup
Hello all,
I did some 'development' work and not sure if it will work.
I would have possibility to set MTU size for virtual interfaces. I tried to set mtu in/etc/xen/scripts/vif-natfirst, but this did not work. Could somebody review my diff's made on Debian Lenny? You know - I am not a python developer and not a developer at all. ;-)
Well.. at least first please send an unified diff (diff -u) :)
-- Pasi
Ok, here they are:
START of diffs
==============
--- /usr/lib/xen-3.2-1/lib/python/xen/xend/XendDomainInfo.py.original
2009-10-16 12:41:42.000000000 +0200 +++ /usr/lib/xen-3.2-1/lib/python/xen/xend/XendDomainInfo.py 2009-10-16 12:45:48.000000000 +0200 @@ -2622,7 +2622,11 @@ # some point we're going to have to figure out how to # handle that properly.
- config['MTU'] = 1500 # TODO
+# config['MTU'] = 1500 # TODO
+ if not config.has_key('MTU'):
+ config['MTU'] = config.get('mtu', '')
+ else:
+ config['MTU'] = 1500
if self._stateGet() not in (XEN_API_VM_POWER_STATE_HALTED,):
xennode = XendNode.instance()
--- /usr/lib/xen-3.2-1/lib/python/xen/xend/server/netif.py.original
2009-10-16 16:58:56.000000000 +0200
+++ /usr/lib/xen-3.2-1/lib/python/xen/xend/server/netif.py 2009-10-16 17:29:53.000000000 +0200
@@ -114,6 +114,7 @@
model = config.get('model')
accel = config.get('accel')sec_lab = config.get('security_label')
+ mtu = config.get('mtu')
if not mac:
raise VmError("MAC address not specified or generated.") @@ -121,7 +122,8 @@
devid = self.allocateDeviceID()
back = { 'script' : script,
- 'mac' : mac }
+ 'mac' : mac,
+ 'mtu' : mtu }
if typ:
back['type'] = typ
if ipaddr:
@@ -153,7 +155,8 @@
front = {}
if typ != 'ioemu':
front = { 'handle' : "%i" % devid,
- 'mac' : mac }
+ 'mac' : mac,
+ 'mtu' : mtu }
if security.on():self.do_access_control(config)
@@ -192,14 +195,14 @@
devinfo = ()
for x in ( 'script', 'ip', 'bridge', 'mac', 'type', 'vifname', 'rate', 'uuid', 'model', 'accel',
- 'security_label'):
+ 'security_label', 'mtu'):
if transaction is None:
y = self.vm._readVm(config_path + x)
else:
y = self.vm._readVmTxn(transaction, config_path + x) devinfo += (y,)
(script, ip, bridge, mac, typ, vifname, rate, uuid,
- model, accel, security_label) = devinfo
+ model, accel, security_label, mtu) = devinfo
if script:
result['script'] = script
@@ -223,5 +226,7 @@
result['accel'] = accel
if security_label:
result['security_label'] = security_label
+ if mtu:
+ result['mtu'] = mtu
return result
--- /usr/lib/xen-3.2-1/lib/python/xen/xend/XendVnet.py.original 2009-10-16 16:07:09.000000000 +0200
+++ /usr/lib/xen-3.2-1/lib/python/xen/xend/XendVnet.py 2009-10-16 16:08:33.000000000 +0200
@@ -94,12 +94,12 @@xstransact.Remove(self.dbpath)
return val
- def vifctl(self, op, vif, vmac):
+ def vifctl(self, op, vif, vmac, vmtu):
try:
fn = self.vifctl_ops[op]
- return vnet_cmd([fn, ['vnet', self.id], ['vif', vif], ['vmac', vmac]])
+ return vnet_cmd([fn, ['vnet', self.id], ['vif', vif], ['vmac', vmac], ['vmtu', vmtu]])
except XendError:
- log.warning("vifctl failed: op=%s vif=%s mac=%s", op, vif, vmac)
+ log.warning("vifctl failed: op=%s vif=%s mac=%s", op, vif, vmac, vmtu)
class XendVnet:
"""Index of all vnets. Singleton.
--- /usr/lib/xen-3.2-1/lib/python/xen/xm/main.py.original 2009-10-16 15:32:01.000000000 +0200
+++ /usr/lib/xen-3.2-1/lib/python/xen/xm/main.py 2009-10-16 15:51:43.000000000 +0200
@@ -165,7 +165,7 @@
'network-attach': ('<Domain> [type=<type>] [mac=<mac>] [bridge=<bridge>] ' '[ip=<ip>] [script=<script>] [backend=<BackDomain>] ' '[vifname=<name>] [rate=<rate>] [model=<model>]'
- '[accel=<accel>]',
+ '[accel=<accel>] [mtu=<mtu>]',
'Create a new virtual network device.'),
'network-detach': ('<Domain> <DevId> [-f|--force]',
'Destroy a domain\'s virtual network device.'),
@@ -2126,7 +2126,7 @@
dom = args[0]
vif = ['vif']vif_params = ['type', 'mac', 'bridge', 'ip', 'script', \
- 'backend', 'vifname', 'rate', 'model', 'accel']
+ 'backend', 'vifname', 'rate', 'model', 'accel', 'mtu']
if serverType == SERVER_XEN_API:vif_record = {
@@ -2175,7 +2175,9 @@
'model':
lambda x: None,
'accel':
- lambda x: set(['other_config', 'accel'], x)
+ lambda x: set(['other_config', 'accel'], x),
+ 'mtu':
+ lambda x: set(['other_config', 'mtu'], x)
}
for a in args[1:]:
===========
END of diffs
Quoted 5 lines · Pasi Kärkkäinen
Quoted 4 lines · Peter Viskup
Hello all,
I did some 'development' work and not sure if it will work. I would have possibility to set MTU size for virtual interfaces. I tried to set mtu in/etc/xen/scripts/vif-natfirst, but this did not
Quoted 11 lines
work.
Quoted 3 lines
Could somebody review my diff's made on Debian Lenny? You know - I am not a python developer and not a developer at all. ;-)
Well.. at least first please send an unified diff (diff -u) :)
-- Pasi
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel