• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1print "XXXX start of control file"
2print "XXXX creating RemoteHost object"
3remote_host= hosts.create_host("myhost")
4
5print "XXXX installing KVM"
6kvm_on_remote_host= kvm.KVM(remote_host)
7
8### kvm git repo vars ###
9kvm_repodir = '/var/local/git/kvm'
10kvm_giturl  = 'git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm.git'
11kvm_weburl  = 'http://git.kernel.org/?p=linux/kernel/git/avi/kvm.git'
12
13### kvm-userspace git repo vars ###
14kvmuser_repodir = '/var/local/git/kvm-userspace'
15kvmuser_giturl = 'git://git.kernel.org/pub/scm/virt/kvm/kvm-userspace.git'
16kvmuser_weburl = 'http://git.kernel.org/?p=virt/kvm/kvm-userspace.git'
17
18### common dir on remote to push repos
19kvm_build = '/tmp/git'
20
21print "XXXX pulling latest kvm from git repo"
22kvm_repo = git.GitRepo(kvm_repodir, kvm_giturl, kvm_weburl)
23kvm_repo.get(remote_host)
24kvm_repo.install(remote_host, builddir=kvm_build)
25
26print "XXXX pulling latest kvm-userspace from git repo"
27kvmuser_repo = git.GitRepo(kvmuser_repodir, kvmuser_giturl, kvmuser_weburl)
28kvmuser_repo.get(remote_host)
29kvmuser_repo.install(remote_host, builddir=kvm_build)
30
31# copy kvmuserspace into tmp dir
32kvm_on_remote_host.get(kvmuser_repodir)
33
34addresses= [{"mac": "02:00:00:00:00:%02x" % (num,), "ip" : "10.0.0.%d" % (num,)} for num in range(1, 16)]
35
36# install and sync latest kvm bits into before building
37print "XXXX installing kvm"
38kvm_on_remote_host.install(addresses, syncdir=kvm_repodir)
39
40# print out kvm module version
41module = kvm_on_remote_host.modules['kvm']
42modversion = remote_host.run("modinfo -F version %s" %(module)).stdout.strip()
43print "XXXX using kvm version %s" %(modversion)
44
45print "XXXX starting guest with default kernel"
46qemu_options= "-m 256 -hda /var/local/vdisk.img -snapshot"
47
48g= hosts.KVMGuest(kvm_on_remote_host, qemu_options)
49g.wait_up()
50
51print g.run('uname -a').stdout.strip()
52
53
54print "XXXX starting guest with custom kernel"
55kernel= deb_kernel.DEBKernel()
56kernel.get("/home/foo/linux-2.6.21.3-6_2.6.21.3-6_amd64-version2.deb")
57kernel_dir= kernel.extract(remote_host)
58
59qemu_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"),)
60
61g= hosts.KVMGuest(kvm_on_remote_host, qemu_options)
62g.wait_up()
63
64print g.run('uname -a').stdout.strip()
65print "XXXX end of control file"
66