print "XXXX start of control file"


print "XXXX creating RemoteHost object"
remote_host= hosts.create_host("192.168.1.1")


print "XXXX installing KVM"
kvm_on_remote_host= kvm.KVM(remote_host)

kvm_on_remote_host.get("/var/local/kvm-33.tar.gz")
addresses= [{"mac": "02:00:00:00:00:%02x" % (num,), "ip" : "10.0.0.%d" % (num,)} for num in range(1, 16)]
kvm_on_remote_host.install(addresses)


print "XXXX starting guest with default kernel"
qemu_options= "-m 256 -hda /var/local/vdisk.img -snapshot"

g= hosts.KVMGuest(kvm_on_remote_host, qemu_options)
g.wait_up()

print g.run('uname -a').stdout.strip()


print "XXXX starting guest with custom kernel"
kernel= deb_kernel.DEBKernel()
kernel.get("/home/foo/linux-2.6.21.3-6_2.6.21.3-6_amd64-version2.deb")
kernel_dir= kernel.extract(remote_host)

qemu_options= '-m 256 -hda /var/local/vdisk.img -snapshot -kernel "%s" -append "%s"' % (sh_escape(os.path.join(kernel_dir, kernel.get_image_name()[1:])), sh_escape("root=/dev/hda1 ro console=tty0 console=ttyS0,9600"),)

g= hosts.KVMGuest(kvm_on_remote_host, qemu_options)
g.wait_up()

print g.run('uname -a').stdout.strip()


print "XXXX end of control file"