ia64/xen-unstable

changeset 5488:06485a209ecc

bitkeeper revision 1.1713.3.10 (42b306faXfFxqDZahYvvQJPQeaDm1A)

netif.py:
Add mtu config option for network interfaces.
Signed-off-by: Mike Wray <mike.wray@hp.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Fri Jun 17 17:23:06 2005 +0000 (2005-06-17)
parents bf7a872ed421
children 3e54d8803974
files tools/python/xen/xend/server/netif.py
line diff
     1.1 --- a/tools/python/xen/xend/server/netif.py	Fri Jun 17 17:22:24 2005 +0000
     1.2 +++ b/tools/python/xen/xend/server/netif.py	Fri Jun 17 17:23:06 2005 +0000
     1.3 @@ -87,6 +87,7 @@ class NetDev(Dev):
     1.4          self.bridge = None
     1.5          self.script = None
     1.6          self.ipaddr = None
     1.7 +        self.mtu = None
     1.8          self.vifname = None
     1.9          self.configure(self.config, recreate=recreate)
    1.10  
    1.11 @@ -132,6 +133,15 @@ class NetDev(Dev):
    1.12              val = None
    1.13          return val
    1.14  
    1.15 +    def _get_config_mtu(self, config):
    1.16 +        mtu = sxp.child_value(config, 'mtu')
    1.17 +        if not mtu: return None
    1.18 +        try:
    1.19 +            mtu = int(mtu)
    1.20 +        except:
    1.21 +            raise XendError("invalid mtu: %s" & mtu)
    1.22 +        return mtu
    1.23 +
    1.24      def configure(self, config, change=False, recreate=False):
    1.25          if change:
    1.26              return self.reconfigure(config)
    1.27 @@ -156,6 +166,7 @@ class NetDev(Dev):
    1.28          self.bridge = sxp.child_value(config, 'bridge')
    1.29          self.script = sxp.child_value(config, 'script')
    1.30          self.ipaddr = self._get_config_ipaddr(config) or []
    1.31 +        self.mtu = self._get_config_mtu(config)
    1.32          self._config_credit_limit(config)
    1.33          
    1.34          try:
    1.35 @@ -187,6 +198,7 @@ class NetDev(Dev):
    1.36          bridge = sxp.child_value(config, 'bridge')
    1.37          script = sxp.child_value(config, 'script')
    1.38          ipaddr = self._get_config_ipaddr(config)
    1.39 +        mtu = self._get_config_mtu(config)
    1.40          
    1.41          xd = get_component('xen.xend.XendDomain')
    1.42          backendDomain = xd.domain_lookup_by_name(sxp.child_value(config, 'backend', '0')).id
    1.43 @@ -203,6 +215,8 @@ class NetDev(Dev):
    1.44              changes['script'] = script
    1.45          if (ipaddr is not None) and (ipaddr != self.ipaddr):
    1.46              changes['ipaddr'] = ipaddr
    1.47 +        if (mtu is not None) and (mtu != self.mtu):
    1.48 +            changes['mtu'] = mtu
    1.49  
    1.50          if changes:
    1.51              self.vifctl("down")