mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 1 | print "XXXX start of control file" |
| 2 | |
| 3 | |
| 4 | def check_kernel(host, version, package): |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 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() |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 11 | |
| 12 | |
| 13 | def install_kvm(kvm_on_host_var_name, host, source, addresses): |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 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}) |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 18 | |
| 19 | |
jadmanski | 8d631c9 | 2008-08-18 21:12:40 +0000 | [diff] [blame] | 20 | print "XXXX creating RemoteHost objects" |
| 21 | remote_host1= hosts.create_host("192.168.1.1") |
| 22 | remote_host2= hosts.create_host("192.168.1.2") |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 23 | |
| 24 | kernel= deb_kernel.DEBKernel() |
| 25 | kernel.get("/home/foo/linux-2.6.21.3-3_2.6.21.3-3_amd64.deb") |
| 26 | |
| 27 | host1_command= subcommand(check_kernel, [remote_host1, "2.6.21.3-3", kernel]) |
| 28 | host2_command= subcommand(check_kernel, [remote_host2, "2.6.21.3-3", kernel]) |
| 29 | |
| 30 | parallel([host1_command, host2_command]) |
| 31 | |
| 32 | |
| 33 | print "XXXX installing KVM on %s" % remote_host1.hostname |
| 34 | install_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 | |
| 37 | print "XXXX starting guests" |
| 38 | qemu_options= "-m 256 -hda /var/local/vdisk.img -snapshot" |
| 39 | gserver= hosts.KVMGuest(kvm_on_remote_host1, qemu_options) |
| 40 | gserver.wait_up() |
| 41 | |
| 42 | |
| 43 | print "XXXX installing autotest" |
| 44 | at= autotest.Autotest() |
| 45 | at.get("/home/foo/autotest/client") |
| 46 | at.install(gserver) |
| 47 | at.install(remote_host2) |
| 48 | |
| 49 | |
| 50 | print "XXXX running autotest" |
| 51 | server_results_dir= "results-netperf-guest-to-host-far-server" |
| 52 | client_results_dir= "results-netperf-guest-to-host-far-client" |
| 53 | |
| 54 | server_control_file= 'job.run_test("netperf2", "%s", "%s", "server", tag="server")' % (sh_escape(gserver.hostname), sh_escape(remote_host2.hostname),) |
| 55 | client_control_file= 'job.run_test("netperf2", "%s", "%s", "client", tag="client")' % (sh_escape(gserver.hostname), sh_escape(remote_host2.hostname),) |
| 56 | |
| 57 | server_command= subcommand(at.run, [server_control_file, server_results_dir, gserver]) |
| 58 | client_command= subcommand(at.run, [client_control_file, client_results_dir, remote_host2]) |
| 59 | |
| 60 | parallel([server_command, client_command]) |
| 61 | |
| 62 | |
| 63 | print "XXXX end of control file" |