mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 1 | import os.path |
| 2 | |
| 3 | print "XXXX start of control file" |
| 4 | |
jadmanski | 8d631c9 | 2008-08-18 21:12:40 +0000 | [diff] [blame] | 5 | print "XXXX creating RemoteHost object" |
| 6 | remote_host= hosts.create_host("192.168.1.1") |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 7 | |
| 8 | |
| 9 | print "XXXX installing KVM" |
| 10 | kvm_on_remote_host= kvm.KVM(remote_host) |
| 11 | |
| 12 | kvm_on_remote_host.get("/var/local/kvm-33.tar.gz") |
| 13 | addresses= [{"mac": "02:00:00:00:00:%02x" % (num,), "ip" : "10.0.0.%d" % (num,)} for num in range(1, 16)] |
| 14 | kvm_on_remote_host.install(addresses) |
| 15 | |
| 16 | |
| 17 | print "XXXX starting guests" |
| 18 | qemu_options= "-m 256 -hda /var/local/vdisk.img -snapshot" |
| 19 | |
| 20 | # > 1 |
| 21 | num_guests= 5 |
| 22 | g= [] |
| 23 | for i in range(num_guests): |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 24 | g.append(hosts.KVMGuest(kvm_on_remote_host, qemu_options)) |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 25 | for i in range(num_guests): |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 26 | g[i].wait_up() |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 27 | |
| 28 | |
| 29 | print "XXXX running transfers" |
| 30 | tmp_dir= g[0].get_tmp_dir() |
| 31 | big_file= os.path.join(tmp_dir, "big_file") |
| 32 | g[0].run('dd if=/dev/urandom of="%s" bs=1024 count=102400' % (big_file,)) |
| 33 | print g[0].run('sha1sum "%s"' % (big_file,)).stdout.strip() |
| 34 | |
| 35 | args= range(1, num_guests) |
| 36 | |
| 37 | def f(i): |
jadmanski | 0afbb63 | 2008-06-06 21:10:57 +0000 | [diff] [blame] | 38 | print "This is %s" % i |
| 39 | tmp_dir= g[i].get_tmp_dir() |
| 40 | g[i].run('scp "%s":"%s" "%s"' % (g[0].hostname, big_file, tmp_dir,)) |
| 41 | print g[i].run('sha1sum "%s"' % (os.path.join(tmp_dir, "big_file"),)).stdout.strip() |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 42 | |
mbligh | d74208c | 2008-04-17 15:27:03 +0000 | [diff] [blame] | 43 | job.parallel_simple(f, args) |
mbligh | f17c6f7 | 2007-08-28 11:04:39 +0000 | [diff] [blame] | 44 | |
| 45 | |
| 46 | print "XXXX end of control file" |