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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Pasi Kärkkäinen
2009-Oct-26 22:16 UTC
Re: [Xen-devel] MTU configuration option on VIF interfaces
On Sun, Oct 18, 2009 at 10:13:12PM +0200, Peter Viskup wrote:> 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. ;-) >Well.. at least first please send an unified diff (diff -u) :) -- Pasi _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Peter Viskup
2009-Oct-27 10:49 UTC
Re: [Xen-devel] MTU configuration option on VIF interfaces
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 On Mon, Oct 26, 2009 at 11:16 PM, Pasi Kärkkäinen <pasik@iki.fi> wrote:> On Sun, Oct 18, 2009 at 10:13:12PM +0200, Peter Viskup wrote: > > 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. ;-) > > > > Well.. at least first please send an unified diff (diff -u) :) > > -- Pasi > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel