blob: 27c4f26dc590644ab204e96dba0ae2becc35b45f [file] [log] [blame] [edit]
print "XXXX start of control file"
print "XXXX creating RemoteHost object"
remote_host= hosts.create_host("myhost")
print "XXXX installing KVM"
kvm_on_remote_host= kvm.KVM(remote_host)
### kvm git repo vars ###
kvm_repodir = '/var/local/git/kvm'
kvm_giturl = 'git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git'
kvm_weburl = 'http://git.kernel.org/?p=linux/kernel/git/avi/kvm.git'
### kvm-userspace git repo vars ###
kvmuser_repodir = '/var/local/git/kvm-userspace'
kvmuser_giturl = 'git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git'
kvmuser_weburl = 'http://git.kernel.org/?p=virt/kvm/kvm-userspace.git'
### common dir on remote to push repos
kvm_build = '/tmp/git'
print "XXXX pulling latest kvm from git repo"
kvm_repo = git.GitRepo(kvm_repodir, kvm_giturl, kvm_weburl)
kvm_repo.get(remote_host)
kvm_repo.install(remote_host, builddir=kvm_build)
print "XXXX pulling latest kvm-userspace from git repo"
kvmuser_repo = git.GitRepo(kvmuser_repodir, kvmuser_giturl, kvmuser_weburl)
kvmuser_repo.get(remote_host)
kvmuser_repo.install(remote_host, builddir=kvm_build)
# copy kvmuserspace into tmp dir
kvm_on_remote_host.get(kvmuser_repodir)
addresses= [{"mac": "02:00:00:00:00:%02x" % (num,), "ip" : "10.0.0.%d" % (num,)} for num in range(1, 16)]
# install and sync latest kvm bits into before building
print "XXXX installing kvm"
kvm_on_remote_host.install(addresses, syncdir=kvm_repodir)
# print out kvm module version
module = kvm_on_remote_host.modules['kvm']
modversion = remote_host.run("modinfo -F version %s" %(module)).stdout.strip()
print "XXXX using kvm version %s" %(modversion)
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"