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