[Pkg-escience-soc2009] [SCM] Tool for creating VM images. branch, master, updated. d6dc1eb48dbf54cefdc99e47485024c0478c4163

David Wendt dcrkid at yahoo.com
Wed Jun 10 22:12:55 UTC 2009


The following commit has been merged in the master branch:
commit b6f14cc0bc987e3ae8d031ec2f25aa71e1faa165
Author: David Wendt <dcrkid at yahoo.com>
Date:   Tue Jun 9 20:54:47 2009 -0400

    Adding the EC2 building functionality patches to the Git archive.

diff --git a/VMBuilder/disk.py b/VMBuilder/disk.py
index 627c710..64d951b 100644
--- a/VMBuilder/disk.py
+++ b/VMBuilder/disk.py
@@ -59,7 +59,7 @@ class Disk(object):
             self.filename = filename
         else:
             if self.preallocated:
-                raise VMBuilderException('Preallocated was set, but no filename given')
+                raise VMBuilderUserError('Preallocated was set, but no filename given')
             self.filename = 'disk%d.img' % len(self.vm.disks)
 
         self.partitions = []
diff --git a/VMBuilder/plugins/cli/__init__.py b/VMBuilder/plugins/cli/__init__.py
index 30f0602..5d3216c 100644
--- a/VMBuilder/plugins/cli/__init__.py
+++ b/VMBuilder/plugins/cli/__init__.py
@@ -42,6 +42,7 @@ class CLI(VMBuilder.Frontend):
                     break
 
             vm = VMBuilder.VM(conf)
+            vm.register_setting('--version', action='callback', callback=self.versioninfo, callback_kwargs={ 'vm' : vm }, help='Show version information')
             vm.register_setting('--rootsize', metavar='SIZE', type='int', default=4096, help='Size (in MB) of the root filesystem [default: %default]')
             vm.register_setting('--optsize', metavar='SIZE', type='int', default=0, help='Size (in MB) of the /opt filesystem. If not set, no /opt filesystem will be added.')
             vm.register_setting('--swapsize', metavar='SIZE', type='int', default=1024, help='Size (in MB) of the swap partition [default: %default]')
@@ -68,6 +69,10 @@ class CLI(VMBuilder.Frontend):
         except VMBuilder.VMBuilderUserError, e:
             print >> sys.stderr, e
 
+    def versioninfo(self, option, opt, value, parser, vm=None):
+        print '%(major)d.%(minor)d.r%(revno)d' % vm.get_version_info()
+        sys.exit(0)
+
     def set_usage(self, vm):
         vm.optparser.set_usage('%prog hypervisor distro [options]')
         vm.optparser.arg_help = (('hypervisor', vm.hypervisor_help), ('distro', vm.distro_help))
diff --git a/VMBuilder/plugins/ec2/__init__.py b/VMBuilder/plugins/ec2/__init__.py
index 09593b2..24990a8 100644
--- a/VMBuilder/plugins/ec2/__init__.py
+++ b/VMBuilder/plugins/ec2/__init__.py
@@ -36,6 +36,7 @@ class EC2(Plugin):
         group.add_option('--ec2-secret-key', metavar='SECRET_ID', help='AWS secret access key.')
         group.add_option('--ec2-kernel','--ec2-aki', metavar='AKI', help='EC2 AKI (kernel) to use.')
         group.add_option('--ec2-ramdisk','--ec2-ari', metavar='ARI', help='EC2 ARI (ramdisk) to use.')
+	group.add_option('--ec2-version',metavar='EC2_VER',help='Specifity the EC2 image version.')
         self.vm.register_setting_group(group)
 
     def preflight_check(self):
@@ -59,17 +60,45 @@ class EC2(Plugin):
 
         if not self.vm.ec2_kernel:
             logging.debug('No ec2-aki choosen setting to default. Use --ec2-kernel to change this')
-            if self.vm.arch == 'amd64':
-                self.vm.ec2_kernel = 'aki-d314f0ba'
-            else:
-                self.vm.ec2_kernel = 'aki-af14f0c6'
+	    if self.vm.suite == 'hardy':
+               if self.vm.arch == 'amd64':
+	          self.vm.ec2_kernel = 'aki-6f709706'
+	       else:
+	          self.vm.ec2_kernel = 'aki-6e709707'
+	    elif self.vm.suite == 'intrepid':
+	        if self.vm.arch == 'amd64':
+                   self.vm.ec2_kernel = 'aki-4f4daa26'
+	        else: 
+	           self.vm.ec2_kernel = 'aki-714daa18' 
+	    elif self.vm.suite == 'jaunty':
+                if self.vm.arch == 'amd64':
+                    self.vm.ec2_kernel = 'aki-6507e00c'
+                else:
+	            self.vm.ec2_kernel = 'aki-6407e00d'
+
+        logging.info('%s - AKI to be used.' %(self.vm.ec2_kernel))
+	logging.info('WARNING! You might be using an outdated AKI. Please check xxx')
 
         if not self.vm.ec2_ramdisk:
             logging.debug('No ec2-ari choosen setting to default. Use --ec2-ramdisk to change this.')
-            if self.vm.arch == 'amd64':
-                self.vm.ec2_ramdisk = 'ari-d014f0b9'
-            else:
-                self.vm.ec2_ramdisk = 'ari-ac14f0c5'
+	    if self.vm.suite == 'hardy':
+              if self.vm.arch == 'amd64':
+                 self.vm.ec2_ramdisk = 'ari-61709708'
+              else:
+                 self.vm.ec2_ramdisk = 'ari-6c709705'
+	    elif self.vm.suite == 'intrepid':
+                if self.vm.arch == 'amd64':
+                   self.vm.ec2_ramdisk = 'ari-4c4daa25' 
+                else:
+                   self.vm.ec2_ramdisk = 'ari-7e4daa17'
+	    elif self.vm.suite == 'jaunty':
+                if self.vm.arch == 'amd64':
+	           self.vm.ec2_ramdisk = 'ari-6307e00a'
+                else:
+	           self.vm.ec2_ramdisk = 'ari-6207e00b'
+
+	logging .info('%s - ARI to be used.'%(self.vm.ec2_ramdisk))
+	logging.info('WARNING! You might be using an outdated AKI. Please check xxx')
 
         if not self.vm.ec2_bucket:
             raise VMBuilderUserError('When building for EC2 you must provide an S3 bucket to hold the AMI')
@@ -80,29 +109,28 @@ class EC2(Plugin):
         if not self.vm.ec2_secret_key:
             raise VMBuilderUserError('When building for EC2 you must provide your AWS secret access key.')
 
-
-        if not self.vm.addpkg:
-             self.vm.addpkg = []
-
-        self.vm.addpkg += ['openssh-server']
-        self.vm.addpkg += ['ec2-init']
-        self.vm.addpkg += ['openssh-server']
-        self.vm.addpkg += ['ec2-modules']
-        self.vm.addpkg += ['server^']
-        self.vm.addpkg += ['standard^']
-
-        if not self.vm.ppa:
-            self.vm.ppa = []
-
-        self.vm.ppa += ['ubuntu-ec2']
+	logging.info('Installing common software')
+	self.install_common()
+	if self.vm.suite == 'hardy':
+             self.install_hardy()
+	elif self.vm.suite == 'intrepid':
+              self.install_intrepid()
+	elif self.vm.suite == 'jaunty':
+              self.install_jaunty()
 
     def post_install(self):
         if not self.vm.ec2:
             return
 
         logging.info("Running ec2 postinstall")
-        self.install_from_template('/etc/event.d/xvc0', 'upstart')
-        self.run_in_target('passwd', '-l', self.vm.user)
+	logging.info("Running common post install")
+	if self.vm.suite == 'hardy':
+	     self.postinstall_hardy()
+	elif self.vm.suite == 'intrepid':
+	     self.postinstall_intrepid()
+	elif self.vm.suite == 'jaunty':
+	     self.postinstall_jaunty()
+	self.postinstall_common()
 
     def deploy(self):
         if not self.vm.ec2:
@@ -121,4 +149,111 @@ class EC2(Plugin):
 
         return True
 
+    def install_common(self):
+        if not self.vm.ec2:
+            return False
+
+	if not self.vm.addpkg:
+	    self.vm.addpkg = []
+
+	logging.info('Installing common software.')
+	self.vm.addpkg += ['openssh-server', 
+                           'ec2-init', 
+                           'standard^',
+		           'ec2-ami-tools',
+                           'update-motd',
+                           'curl',
+                           'screen',
+                           'screen-profiles']
+
+	if not self.vm.ppa:
+	    self.vm.ppa = []
+
+        self.vm.ppa += ['ubuntu-on-ec2']
+
+    def install_hardy(self):
+	if not self.vm.ec2:
+	    return False
+
+	logging.info('Installing software for hardy.')
+	self.vm.addpkg += ['ruby',
+			   'libc6-xen',
+			   'ec2-modules',
+			   'libopenssl-ruby',
+			   'landscape-common',
+			   'landscape-client']
+
+
+    def postinstall_hardy(self):
+	if not self.vm.ec2:
+	    return False
+
+	logging.info('Running post-install for hardy')
+	# work around for libc6/xen bug in hardy.
+	self.install_from_template('/etc/ld.so.conf.d/libc6-xen.conf', 'xen-ld-so-conf')
+	self.run_in_target('apt-get', 'remove', '-y', 'libc6-i686')
+
+	self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-hardy')
+	self.install_from_template('/etc/event.d/xvc0', 'xvc0')
+	self.run_in_target('update-rc.d', '-f', 'hwclockfirst.sh', 'remove')
+
+    def install_intrepid(self):
+	if not self.vm.ec2:
+	    return False
+
+	logging.info('Installing software for intrepid')
+	self.vm.addpkg += ['ec2-modules',
+			   'ruby',
+			   'libopenssl-ruby',
+                           'server^',
+                           'policykit',
+			   'landscape-common',
+			   'landscape-client']
+
+    def postinstall_intrepid(self):
+	if not self.vm.ec2:
+	    return False
+
+	logging.info('Running post-install for intrepid')
+	self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-intrepid')
+
+    def install_jaunty(self):
+	if not self.vm.ec2:
+	    return False
+
+	logging.info('Installing software for jaunty')
+	self.vm.addpkg += ['ec2-modules',
+			   'ruby1.8',
+                           'server^',
+			   'libopenssl-ruby1.8']
+
+    def postinall_jaunty(self):
+	if not self.vm.ec2:
+            return False
+	
+	logging.info('Running post-install for jaunty') 
+	self.install_from_template('/etc/update-motd.d/51_update-motd', '51_update-motd-intrepid')
+
+    def postinstall_common(self):
+	if not self.vm.ec2:
+	    return False
+
+	logging.info('Running common post-install')
+	self.install_from_template('/etc/ssh/sshd_config', 'sshd_config')
+	self.run_in_target('chpasswd', '-e', stdin='ubuntu:!\n')
+	# this makes my skin crawl
+	self.install_from_template('/etc/sudoers', 'sudoers')
+	# this doesnt
+	self.run_in_target('chmod', '755', '/etc/update-motd.d/51_update-motd')
+	self.install_from_template('/etc/ec2_version', 'ec2_version', { 'version' : self.vm.ec2_version })
+
+	self.run_in_target('rm', '-f', '/etc/localtime')
+	self.run_in_target('ln', '-s', '/usr/share/zoneinfo/UTC', '/etc/localtime')
+
+	self.run_in_target('usermod', '-u', '135', 'ubuntu')
+	self.run_in_target('chown', '-R', 'ubuntu', '/home/ubuntu')
+
+	self.run_in_target('update-rc.d', '-f', 'hwclock.sh', 'remove') 
+	self.install_from_template('/etc/default/landscape-client', 'landscape_client')
+
 register_plugin(EC2)
diff --git a/VMBuilder/plugins/ec2/templates/51_update-motd-hardy.tmpl b/VMBuilder/plugins/ec2/templates/51_update-motd-hardy.tmpl
new file mode 100644
index 0000000..f51c547
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/51_update-motd-hardy.tmpl
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+echo "---------------------------------------------------------------------"
+echo "At the moment, only the core of the system is installed. To tune the "
+echo "system to your needs, you can choose to install one or more          "
+echo "predefined collections of software by running the following          "
+echo "command:                                                             "
+echo "                                                                     "
+echo "   sudo tasksel                                                      "
+echo "---------------------------------------------------------------------"
diff --git a/VMBuilder/plugins/ec2/templates/51_update-motd-intrepid.tmpl b/VMBuilder/plugins/ec2/templates/51_update-motd-intrepid.tmpl
new file mode 100644
index 0000000..2a98f7d
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/51_update-motd-intrepid.tmpl
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+echo "---------------------------------------------------------------------"
+echo "At the moment, only the core of the system is installed. To tune the "
+echo "system to your needs, you can choose to install one or more          "
+echo "predefined collections of software by running the following          "
+echo "command:                                                             "
+echo "                                                                     "
+echo "   sudo tasksel --section server                                     "
+echo "---------------------------------------------------------------------"
diff --git a/VMBuilder/plugins/ec2/templates/51_update-motd-jaunty.tmpl b/VMBuilder/plugins/ec2/templates/51_update-motd-jaunty.tmpl
new file mode 100644
index 0000000..2a98f7d
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/51_update-motd-jaunty.tmpl
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+echo "---------------------------------------------------------------------"
+echo "At the moment, only the core of the system is installed. To tune the "
+echo "system to your needs, you can choose to install one or more          "
+echo "predefined collections of software by running the following          "
+echo "command:                                                             "
+echo "                                                                     "
+echo "   sudo tasksel --section server                                     "
+echo "---------------------------------------------------------------------"
diff --git a/VMBuilder/plugins/ec2/templates/ec2_version.tmpl b/VMBuilder/plugins/ec2/templates/ec2_version.tmpl
new file mode 100644
index 0000000..f43b9c6
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/ec2_version.tmpl
@@ -0,0 +1 @@
+$version
diff --git a/VMBuilder/plugins/ec2/templates/upstart.tmpl b/VMBuilder/plugins/ec2/templates/hvc0.tmpl
similarity index 85%
copy from VMBuilder/plugins/ec2/templates/upstart.tmpl
copy to VMBuilder/plugins/ec2/templates/hvc0.tmpl
index 245efa1..84da6b3 100644
--- a/VMBuilder/plugins/ec2/templates/upstart.tmpl
+++ b/VMBuilder/plugins/ec2/templates/hvc0.tmpl
@@ -1,4 +1,4 @@
-# tty1 - getty
+# hvc0 - getty
 #
 # This service maintains a getty on tty1 from the point the system is
 # started until it is shut down again.
@@ -13,4 +13,4 @@ stop on runlevel 1
 stop on runlevel 6
 
 respawn
-exec /sbin/getty 38400 xvc0
+exec /sbin/getty 38400 hvc0
diff --git a/VMBuilder/plugins/ec2/templates/landscape_client.tmpl b/VMBuilder/plugins/ec2/templates/landscape_client.tmpl
new file mode 100644
index 0000000..4ea1407
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/landscape_client.tmpl
@@ -0,0 +1 @@
+CLOUD=1
diff --git a/VMBuilder/plugins/ec2/templates/sshd_config.tmpl b/VMBuilder/plugins/ec2/templates/sshd_config.tmpl
new file mode 100644
index 0000000..3691b82
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/sshd_config.tmpl
@@ -0,0 +1,77 @@
+# Package generated configuration file
+# See the sshd(8) manpage for details
+
+# What ports, IPs and protocols we listen for
+Port 22
+# Use these options to restrict which interfaces/protocols sshd will bind to
+#ListenAddress ::
+#ListenAddress 0.0.0.0
+Protocol 2
+# HostKeys for protocol version 2
+HostKey /etc/ssh/ssh_host_rsa_key
+HostKey /etc/ssh/ssh_host_dsa_key
+#Privilege Separation is turned on for security
+UsePrivilegeSeparation yes
+
+# Lifetime and size of ephemeral version 1 server key
+KeyRegenerationInterval 3600
+ServerKeyBits 768
+
+# Logging
+SyslogFacility AUTH
+LogLevel INFO
+
+# Authentication:
+LoginGraceTime 120
+PermitRootLogin yes
+StrictModes yes
+
+RSAAuthentication yes
+PubkeyAuthentication yes
+#AuthorizedKeysFile	%h/.ssh/authorized_keys
+
+# Don't read the user's ~/.rhosts and ~/.shosts files
+IgnoreRhosts yes
+# For this to work you will also need host keys in /etc/ssh_known_hosts
+RhostsRSAAuthentication no
+# similar for protocol version 2
+HostbasedAuthentication no
+# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
+#IgnoreUserKnownHosts yes
+
+# To enable empty passwords, change to yes (NOT RECOMMENDED)
+PermitEmptyPasswords no
+
+# Change to yes to enable challenge-response passwords (beware issues with
+# some PAM modules and threads)
+ChallengeResponseAuthentication no
+
+# Change to no to disable tunnelled clear text passwords
+PasswordAuthentication no
+
+# Kerberos options
+#KerberosAuthentication no
+#KerberosGetAFSToken no
+#KerberosOrLocalPasswd yes
+#KerberosTicketCleanup yes
+
+# GSSAPI options
+#GSSAPIAuthentication no
+#GSSAPICleanupCredentials yes
+
+X11Forwarding yes
+X11DisplayOffset 10
+PrintMotd no
+PrintLastLog yes
+TCPKeepAlive yes
+#UseLogin no
+
+#MaxStartups 10:30:60
+#Banner /etc/issue.net
+
+# Allow client to pass locale environment variables
+AcceptEnv LANG LC_*
+
+Subsystem sftp /usr/lib/openssh/sftp-server
+
+UsePAM yes
diff --git a/VMBuilder/plugins/ubuntu/templates/sudoers.tmpl b/VMBuilder/plugins/ec2/templates/sudoers.tmpl
similarity index 86%
copy from VMBuilder/plugins/ubuntu/templates/sudoers.tmpl
copy to VMBuilder/plugins/ec2/templates/sudoers.tmpl
index f25be9b..513093f 100644
--- a/VMBuilder/plugins/ubuntu/templates/sudoers.tmpl
+++ b/VMBuilder/plugins/ec2/templates/sudoers.tmpl
@@ -3,9 +3,9 @@
 # This file MUST be edited with the 'visudo' command as root.
 #
 # See the man page for details on how to write a sudoers file.
-# Defaults
+#
 
-Defaults	!lecture,tty_tickets,!fqdn
+Defaults	env_reset
 
 # Uncomment to allow members of group sudo to not need a password
 # %sudo ALL=NOPASSWD: ALL
@@ -18,6 +18,6 @@ Defaults	!lecture,tty_tickets,!fqdn
 
 # User privilege specification
 root	ALL=(ALL) ALL
+ubuntu  ALL=(ALL) NOPASSWD:ALL
 
 # Members of the admin group may gain root privileges
-%admin ALL=(ALL) ALL
diff --git a/VMBuilder/plugins/ec2/templates/xen-ld-so-conf.tmpl b/VMBuilder/plugins/ec2/templates/xen-ld-so-conf.tmpl
new file mode 100644
index 0000000..e5ce344
--- /dev/null
+++ b/VMBuilder/plugins/ec2/templates/xen-ld-so-conf.tmpl
@@ -0,0 +1 @@
+hwcap 0 nosegneg
diff --git a/VMBuilder/plugins/ec2/templates/upstart.tmpl b/VMBuilder/plugins/ec2/templates/xvc0.tmpl
similarity index 95%
rename from VMBuilder/plugins/ec2/templates/upstart.tmpl
rename to VMBuilder/plugins/ec2/templates/xvc0.tmpl
index 245efa1..76cad35 100644
--- a/VMBuilder/plugins/ec2/templates/upstart.tmpl
+++ b/VMBuilder/plugins/ec2/templates/xvc0.tmpl
@@ -1,4 +1,4 @@
-# tty1 - getty
+# xvc0 - getty
 #
 # This service maintains a getty on tty1 from the point the system is
 # started until it is shut down again.
diff --git a/VMBuilder/plugins/firstscripts/__init__.py b/VMBuilder/plugins/firstscripts/__init__.py
index cfcb18f..99c97e0 100644
--- a/VMBuilder/plugins/firstscripts/__init__.py
+++ b/VMBuilder/plugins/firstscripts/__init__.py
@@ -41,11 +41,17 @@ class Firstscripts(Plugin):
         
         if self.vm.firstboot:
             logging.debug("Checking if firstboot script %s exists" % (self.vm.firstboot,))
+	    if not(os.access(self.vm.firstboot, os.X_OK)):
+	        raise MBuilderUserError("The first-boot script is not executable")
+
             if not(os.path.isfile(self.vm.firstboot)):
                 raise VMBuilderUserError('The path to the first-boot script is invalid: %s. Make sure you are providing a full path.' % self.vm.firstboot)
                 
         if self.vm.firstlogin:
             logging.debug("Checking if first login script %s exists" % (self.vm.firstlogin,))
+            if not(os.access(self.vm.firstlogin, os.X_OK)):
+                raise VMBuilderUserError("The first-login script is not executable")
+
             if not(os.path.isfile(self.vm.firstlogin)):
                 raise VMBuilderUserError('The path to the first-login script is invalid: %s.  Make sure you are providing a full path.' % self.vm.firstlogin)
 
diff --git a/VMBuilder/plugins/ubuntu/dapper.py b/VMBuilder/plugins/ubuntu/dapper.py
index 91cd351..32bca6f 100644
--- a/VMBuilder/plugins/ubuntu/dapper.py
+++ b/VMBuilder/plugins/ubuntu/dapper.py
@@ -81,6 +81,9 @@ class Dapper(suite.Suite):
         logging.debug("Installing ssh keys")
         self.install_authorized_keys()
 
+	logging.debug("Install xen kernel")
+	self.install_xen_kernel()
+
         logging.debug("Installing extra packages")
         self.install_extras()
 
diff --git a/VMBuilder/plugins/ubuntu/hardy.py b/VMBuilder/plugins/ubuntu/hardy.py
index 5ed63f1..3ce1caf 100644
--- a/VMBuilder/plugins/ubuntu/hardy.py
+++ b/VMBuilder/plugins/ubuntu/hardy.py
@@ -18,13 +18,24 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 import suite
+import logging
+import VMBuilder
+from VMBuilder.util		    import run_cmd
 from VMBuilder.plugins.ubuntu.gutsy import Gutsy
 
 class Hardy(Gutsy):
     virtio_net = True
 
     def xen_kernel_path(self):
-        return '/boot/vmlinuz-2.6.24-19-xen'
+	rcmd = run_cmd('chroot', self.destdir, 'dpkg', '-S', 'xen')
+	temp = rcmd[0].split(": ")
+	xen_kernel = temp[0].split("linux-image-")
+	path = '/boot/vmlinuz-%s' %xen_kernel
+	return path
 
     def xen_ramdisk_path(self):
-        return '/boot/initrd.img-2.6.24-19-xen'
+	rcmd = run_cmd('chroot', self.destdir, 'dpkg', '-S', 'xen')
+	temp = rcmd[0].split(": ")
+	xen_ramdisk = temp[0].split("linux-image-")
+	path = '/boot/initrd.img-%s' %xen_ramdisk
+	return path
diff --git a/VMBuilder/plugins/ubuntu/intrepid.py b/VMBuilder/plugins/ubuntu/intrepid.py
index 99d9c82..5f9cabe 100644
--- a/VMBuilder/plugins/ubuntu/intrepid.py
+++ b/VMBuilder/plugins/ubuntu/intrepid.py
@@ -24,10 +24,19 @@ from   VMBuilder.util import run_cmd
 from   VMBuilder.plugins.ubuntu.hardy import Hardy
 
 class Intrepid(Hardy):
-    xen_kernel_flavour = 'server'
+    valid_flavours = { 'i386' :  ['386', 'generic', 'server', 'virtual'],
+                       'amd64' : ['generic', 'server', 'virtual'],
+                       'lpia'  : ['lpia', 'lpiacompat'] }
+    default_flavour = { 'i386' : 'virtual', 'amd64' : 'virtual', 'lpia' : 'lpia' }
+    xen_kernel_flavour = 'virtual'
 
     def mangle_grub_menu_lst(self):
         bootdev = disk.bootpart(self.vm.disks)
         run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
         run_cmd('sed', '-ie', 's/^# groot.*/# groot=%s/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
         run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir)
+    def install_xen_kernel(self):
+	import VMBuilder.plugins.xen
+
+	if isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen):
+	   logging.info('Skipping Xen kernel installation.')
diff --git a/VMBuilder/plugins/ubuntu/jaunty.py b/VMBuilder/plugins/ubuntu/jaunty.py
index ac9a544..b800dec 100644
--- a/VMBuilder/plugins/ubuntu/jaunty.py
+++ b/VMBuilder/plugins/ubuntu/jaunty.py
@@ -31,3 +31,9 @@ class Jaunty(Intrepid):
         run_cmd('sed', '-ie', 's/^# kopt=root=\([^ ]*\)\(.*\)/# kopt=root=UUID=%s\\2/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
         run_cmd('sed', '-ie', 's/^# groot.*/# groot=%s/g' % bootdev.fs.uuid, '%s/boot/grub/menu.lst' % self.destdir)
         run_cmd('sed', '-ie', '/^# kopt_2_6/ d', '%s/boot/grub/menu.lst' % self.destdir)
+
+    def install_xen_kernel(self):
+	import VMBuilder.plugins.xen
+
+  	if isinstance(self.vm.hypervisor, VMBuilder.plugins.xen.Xen):
+	    logging.info('Skipping Xen kernel installation.')
diff --git a/VMBuilder/plugins/ubuntu/templates/sources.list.tmpl b/VMBuilder/plugins/ubuntu/templates/sources.list.tmpl
index 9dbd879..84ec7d4 100644
--- a/VMBuilder/plugins/ubuntu/templates/sources.list.tmpl
+++ b/VMBuilder/plugins/ubuntu/templates/sources.list.tmpl
@@ -9,7 +9,7 @@ deb $security_mirror $suite-security #slurp
 
 #if $ppa
 #for $p in $ppa
-deb http://ppa.launchpad.net/$p/ubuntu $suite #slurp
+deb http://ppa.launchpad.net/$p/ppa/ubuntu $suite #slurp
 #echo ' '.join($components)
 
 #end for
diff --git a/VMBuilder/vm.py b/VMBuilder/vm.py
index c6d425b..a03f286 100644
--- a/VMBuilder/vm.py
+++ b/VMBuilder/vm.py
@@ -90,6 +90,13 @@ class VM(object):
 
         self._register_base_settings()
 
+    def get_version_info(self):
+        import vcsversion
+        info = vcsversion.version_info
+        info['major'] = 0
+        info['minor'] = 10
+        return info
+       
     def cleanup(self):
         logging.info("Cleaning up")
         while len(self._cleanup_cbs) > 0:
@@ -137,7 +144,7 @@ class VM(object):
         self.register_setting('--in-place', action='store_true', default=False, help='Install directly into the filesystem images. This is needed if your $TMPDIR is nodev and/or nosuid, but will result in slightly larger file system images.')
         self.register_setting('--tmpfs', metavar="OPTS", help='Use a tmpfs as the working directory, specifying its size or "-" to use tmpfs default (suid,dev,size=1G).')
         self.register_setting('-m', '--mem', type='int', default=128, help='Assign MEM megabytes of memory to the guest vm. [default: %default]')
-        self.register_setting('--cpus', type='int', default=1, help='Number of virtual CPU's. [default: %default]')
+        self.register_setting('--cpus', type='int', default=1, help='Number of virtual CPU\'s. [default: %default]')
 
         group = self.setting_group('Network related options')
         domainname = '.'.join(socket.gethostbyname_ex(socket.gethostname())[0].split('.')[1:])
diff --git a/debian/control b/debian/control
index 8acd841..0531040 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ Vcs-Bzr: http://bazaar.launchpad.net/~ubuntu-virt/vmbuilder/trunk
 
 Package: python-vm-builder
 Architecture: all
-Depends: kvm (>= 1:69) | qemu, debootstrap (>= 1.0.9), parted, kpartx, ubuntu-keyring, ${python:Depends}, python-cheetah, devscripts
+Depends: kvm (>= 1:69) | qemu, debootstrap (>= 1.0.9), parted, kpartx, ubuntu-keyring, ${python:Depends}, python-cheetah, devscripts, rsync
 Recommends: python-libvirt
 XB-Python-Version: ${python:Versions}
 Description: VM builder
diff --git a/debian/python-vm-builder-ec2.install b/debian/python-vm-builder-ec2.install
index 4ffd32e..5697af7 100644
--- a/debian/python-vm-builder-ec2.install
+++ b/debian/python-vm-builder-ec2.install
@@ -1 +1 @@
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/ec2
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/ec2
diff --git a/debian/python-vm-builder.install b/debian/python-vm-builder.install
index 0898e77..78d1d53 100644
--- a/debian/python-vm-builder.install
+++ b/debian/python-vm-builder.install
@@ -1,12 +1,12 @@
 debian/tmp/etc
 debian/tmp/usr/bin/vmbuilder
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/*.py
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/*.py
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/cli
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/firstscripts
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/kvm
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/libvirt
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/postinst
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/ubuntu
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/xen
-debian/tmp/usr/lib/python2.5/site-packages/VMBuilder/plugins/vmware
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/*.py
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/*.py
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/cli
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/firstscripts
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/kvm
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/libvirt
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/postinst
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/ubuntu
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/xen
+debian/tmp/usr/lib/python*/*-packages/VMBuilder/plugins/vmware
diff --git a/setup.py b/setup.py
index 475894e..42d2993 100755
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,19 @@
 from distutils.core import setup
 import VMBuilder.plugins
 from glob import glob
+import os.path
+import subprocess
 
+if os.path.exists('.bzr'):
+    try:
+        o = subprocess.Popen(('bzr','version-info', '--python'), stdout=subprocess.PIPE).stdout
+        f = open('VMBuilder/vcsversion.py', 'w')
+        f.write(o.read())
+        f.close()
+        o.close()
+    except Exception, e:
+        print repr(e)
+    
 setup(name='VMBuilder',
       version='0.9',
       description='Uncomplicated VM Builder',

-- 
Tool for creating VM images.



More information about the Pkg-escience-soc2009 mailing list