From 3cc42ebbc144096dc56b618845519daf2d48ef6e Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 5 Aug 2009 11:39:03 -0700 Subject: [PATCH] xenserver: Really take devices down in interface-reconfigure. When down_netdev was called with deconfigure=True (which is the default), it would invoke, e.g. "/sbin/ifconfig eth0 down 0.0.0.0", with the intention of taking the interface down and removing any IP address from it at the same time. In fact, this removed any IP address from it and brought the device *up*, because ifconfig executes its commands in the order that they are specified, and setting or unsetting an IP address brings a device up. We could specify the commands in the opposite order ("0.0.0.0 down") but it seems to me more obviously correct to just run ifconfig twice, so that is what this commit does. This commit could break things, because it could be that there is a bug elsewhere that depends on down_netdev not actually bringing a device down, but it is needed for the upcoming device renaming commit (to fix bug NIC-20), because a network device has to be down to be renamed. --- xenserver/opt_xensource_libexec_interface-reconfigure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure index 1ff53590d..8f33e102d 100755 --- a/xenserver/opt_xensource_libexec_interface-reconfigure +++ b/xenserver/opt_xensource_libexec_interface-reconfigure @@ -547,10 +547,7 @@ def down_netdev(interface, deconfigure=True): if not interface_exists(interface): log("down_netdev: interface %s does not exist, ignoring" % interface) return - argv = ["/sbin/ifconfig", interface, 'down'] if deconfigure: - argv += ['0.0.0.0'] - # Kill dhclient. pidfile_name = '/var/run/dhclient-%s.pid' % interface pidfile = None @@ -567,7 +564,10 @@ def down_netdev(interface, deconfigure=True): os.remove(pidfile_name) except: pass - run_command(argv) + + run_command(["/sbin/ifconfig", interface, '0.0.0.0']) + + run_command(["/sbin/ifconfig", interface, 'down']) def up_netdev(interface): run_command(["/sbin/ifconfig", interface, 'up']) -- 2.43.0