Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: client/tests/kvm/scripts/nic_bonding_guest.py

Issue 6246035: Merge remote branch 'cros/upstream' into master (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 import os, re, commands, sys
2 """This script is used to setup bonding, macaddr of bond0 should be assigned by
3 argv1"""
4
5 if len(sys.argv) != 2:
6 sys.exit(1)
7 mac = sys.argv[1]
8 eth_nums = 0
9 ifconfig_output = commands.getoutput("ifconfig")
10 re_eth = "eth[0-9]*"
11 for ename in re.findall(re_eth, ifconfig_output):
12 eth_config_file = "/etc/sysconfig/network-scripts/ifcfg-%s" % ename
13 eth_config = """DEVICE=%s
14 USERCTL=no
15 ONBOOT=yes
16 MASTER=bond0
17 SLAVE=yes
18 BOOTPROTO=none
19 """ % ename
20 f = file(eth_config_file,'w')
21 f.write(eth_config)
22 f.close()
23
24 bonding_config_file = "/etc/sysconfig/network-scripts/ifcfg-bond0"
25 bond_config = """DEVICE=bond0
26 BOOTPROTO=dhcp
27 NETWORKING_IPV6=no
28 ONBOOT=yes
29 USERCTL=no
30 MACADDR=%s
31 """ % mac
32 f = file(bonding_config_file, "w")
33 f.write(bond_config)
34 f.close()
35 os.system("modprobe bonding")
36 os.system("service NetworkManager stop")
37 os.system("service network restart")
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698