From c239b2d4f3535012bea0261ff81fc570771b6f9b Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 6 Aug 2009 13:39:24 -0700 Subject: [PATCH] xenserver: Cope gracefully with non-integer MTU in interface-reconfigure. CP-1148. --- xenserver/opt_xensource_libexec_interface-reconfigure | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure index 72d43860..5f19ff36 100755 --- a/xenserver/opt_xensource_libexec_interface-reconfigure +++ b/xenserver/opt_xensource_libexec_interface-reconfigure @@ -758,12 +758,13 @@ def configure_netdev(pif): else: raise Error("Unknown IP-configuration-mode %s" % pifrec['ip_configuration_mode']) - oc = {} - if pifrec.has_key('other_config'): - oc = pifrec['other_config'] - if oc.has_key('mtu'): + oc = pifrec['other_config'] + if oc.has_key('mtu'): + try: int(oc['mtu']) # Check that the value is an integer ifconfig_argv += ['mtu', oc['mtu']] + except ValueError, x: + log("Invalid value for mtu = %s" % mtu) run_command(ifconfig_argv) -- 2.30.2