1print "XXXX start of control file" 2 3 4def check_kernel(host, version, package): 5 if host.run("uname -r").stdout.strip() != version: 6 print "XXXX installing kernel on %s" % (host.hostname,) 7 package.install(host) 8 9 host.reboot() 10 host.wait_up() 11 12 13def install_kvm(kvm_on_host_var_name, host, source, addresses): 14 exec ("global %(var_name)s\n" 15 "%(var_name)s= kvm.KVM(host)\n" 16 "%(var_name)s.get(source)\n" 17 "%(var_name)s.install(addresses)\n" % {"var_name": kvm_on_host_var_name}) 18 19 20print "XXXX creating RemoteHost objects" 21remote_host1= hosts.create_host("192.168.1.1") 22remote_host2= hosts.create_host("192.168.1.2") 23 24kernel= deb_kernel.DEBKernel() 25kernel.get("/home/foo/linux-2.6.21.3-3_2.6.21.3-3_amd64.deb") 26 27host1_command= subcommand(check_kernel, [remote_host1, "2.6.21.3-3", kernel]) 28host2_command= subcommand(check_kernel, [remote_host2, "2.6.21.3-3", kernel]) 29 30parallel([host1_command, host2_command]) 31 32 33print "XXXX installing KVM on %s" % remote_host1.hostname 34install_kvm("kvm_on_remote_host1", remote_host1, "/var/local/kvm-33.tar.gz", [{"mac": "02:00:00:00:00:01", "ip" : "10.0.0.1"}]) 35 36 37print "XXXX starting guests" 38qemu_options= "-m 256 -hda /var/local/vdisk.img -snapshot" 39gserver= hosts.KVMGuest(kvm_on_remote_host1, qemu_options) 40gserver.wait_up() 41 42 43print "XXXX installing autotest" 44at= autotest.Autotest() 45at.get("/home/foo/autotest/client") 46at.install(gserver) 47at.install(remote_host2) 48 49 50print "XXXX running autotest" 51server_results_dir= "results-netperf-guest-to-host-far-server" 52client_results_dir= "results-netperf-guest-to-host-far-client" 53 54server_control_file= 'job.run_test("netperf2", "%s", "%s", "server", tag="server")' % (sh_escape(gserver.hostname), sh_escape(remote_host2.hostname),) 55client_control_file= 'job.run_test("netperf2", "%s", "%s", "client", tag="client")' % (sh_escape(gserver.hostname), sh_escape(remote_host2.hostname),) 56 57server_command= subcommand(at.run, [server_control_file, server_results_dir, gserver]) 58client_command= subcommand(at.run, [client_control_file, client_results_dir, remote_host2]) 59 60parallel([server_command, client_command]) 61 62 63print "XXXX end of control file" 64