From patchwork Sat Jan 22 02:03:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Meneghel Rodrigues X-Patchwork-Id: 497531 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0M23uXc006740 for ; Sat, 22 Jan 2011 02:04:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754178Ab1AVCDz (ORCPT ); Fri, 21 Jan 2011 21:03:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55363 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752608Ab1AVCDy (ORCPT ); Fri, 21 Jan 2011 21:03:54 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0M23rwT003521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 21 Jan 2011 21:03:53 -0500 Received: from freedom.redhat.com (vpn-11-112.rdu.redhat.com [10.11.11.112]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0M23ntm030188; Fri, 21 Jan 2011 21:03:52 -0500 From: Lucas Meneghel Rodrigues To: autotest@test.kernel.org Cc: kvm@vger.kernel.org, Lucas Meneghel Rodrigues Subject: [PATCH 1/4] KVM test: Renaming script bonding_setup.py to nic_bonding_guest.py Date: Sat, 22 Jan 2011 00:03:44 -0200 Message-Id: <1295661827-30803-2-git-send-email-lmr@redhat.com> In-Reply-To: <1295661827-30803-1-git-send-email-lmr@redhat.com> References: <1295661827-30803-1-git-send-email-lmr@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 22 Jan 2011 02:04:14 +0000 (UTC) diff --git a/client/tests/kvm/scripts/bonding_setup.py b/client/tests/kvm/scripts/bonding_setup.py deleted file mode 100644 index f2d4be9..0000000 --- a/client/tests/kvm/scripts/bonding_setup.py +++ /dev/null @@ -1,37 +0,0 @@ -import os, re, commands, sys -"""This script is used to setup bonding, macaddr of bond0 should be assigned by -argv1""" - -if len(sys.argv) != 2: - sys.exit(1) -mac = sys.argv[1] -eth_nums = 0 -ifconfig_output = commands.getoutput("ifconfig") -re_eth = "eth[0-9]*" -for ename in re.findall(re_eth, ifconfig_output): - eth_config_file = "/etc/sysconfig/network-scripts/ifcfg-%s" % ename - eth_config = """DEVICE=%s -USERCTL=no -ONBOOT=yes -MASTER=bond0 -SLAVE=yes -BOOTPROTO=none -""" % ename - f = file(eth_config_file,'w') - f.write(eth_config) - f.close() - -bonding_config_file = "/etc/sysconfig/network-scripts/ifcfg-bond0" -bond_config = """DEVICE=bond0 -BOOTPROTO=dhcp -NETWORKING_IPV6=no -ONBOOT=yes -USERCTL=no -MACADDR=%s -""" % mac -f = file(bonding_config_file, "w") -f.write(bond_config) -f.close() -os.system("modprobe bonding") -os.system("service NetworkManager stop") -os.system("service network restart") diff --git a/client/tests/kvm/scripts/nic_bonding_guest.py b/client/tests/kvm/scripts/nic_bonding_guest.py new file mode 100644 index 0000000..f2d4be9 --- /dev/null +++ b/client/tests/kvm/scripts/nic_bonding_guest.py @@ -0,0 +1,37 @@ +import os, re, commands, sys +"""This script is used to setup bonding, macaddr of bond0 should be assigned by +argv1""" + +if len(sys.argv) != 2: + sys.exit(1) +mac = sys.argv[1] +eth_nums = 0 +ifconfig_output = commands.getoutput("ifconfig") +re_eth = "eth[0-9]*" +for ename in re.findall(re_eth, ifconfig_output): + eth_config_file = "/etc/sysconfig/network-scripts/ifcfg-%s" % ename + eth_config = """DEVICE=%s +USERCTL=no +ONBOOT=yes +MASTER=bond0 +SLAVE=yes +BOOTPROTO=none +""" % ename + f = file(eth_config_file,'w') + f.write(eth_config) + f.close() + +bonding_config_file = "/etc/sysconfig/network-scripts/ifcfg-bond0" +bond_config = """DEVICE=bond0 +BOOTPROTO=dhcp +NETWORKING_IPV6=no +ONBOOT=yes +USERCTL=no +MACADDR=%s +""" % mac +f = file(bonding_config_file, "w") +f.write(bond_config) +f.close() +os.system("modprobe bonding") +os.system("service NetworkManager stop") +os.system("service network restart") diff --git a/client/tests/kvm/tests/nic_bonding.py b/client/tests/kvm/tests/nic_bonding.py index ca9d70a..52ce0ae 100644 --- a/client/tests/kvm/tests/nic_bonding.py +++ b/client/tests/kvm/tests/nic_bonding.py @@ -8,7 +8,7 @@ def run_nic_bonding(test, params, env): Nic bonding test in guest. 1) Start guest with four nic models. - 2) Setup bond0 in guest by script bonding_setup.py. + 2) Setup bond0 in guest by script nic_bonding_guest.py. 3) Execute file transfer test between guest and host. 4) Repeatedly put down/up interfaces by set_link 5) Execute file transfer test between guest and host. @@ -34,9 +34,9 @@ def run_nic_bonding(test, params, env): vm = env.get_vm(params["main_vm"]) vm.verify_alive() session_serial = vm.wait_for_serial_login(timeout=timeout) - script_path = kvm_utils.get_path(test.bindir, "scripts/bonding_setup.py") - vm.copy_files_to(script_path, "/tmp/bonding_setup.py") - cmd = "python /tmp/bonding_setup.py %s" % vm.get_mac_address() + script_path = kvm_utils.get_path(test.bindir, "scripts/nic_bonding_guest.py") + vm.copy_files_to(script_path, "/tmp/nic_bonding_guest.py") + cmd = "python /tmp/nic_bonding_guest.py %s" % vm.get_mac_address() session_serial.cmd(cmd) termination_event = threading.Event()