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