← Back to team overview

vmbuilder team mailing list archive

[Merge] lp:~w-mail-4/vmbuilder/vmbuilder into lp:vmbuilder

 

Tinco Andringa has proposed merging lp:~w-mail-4/vmbuilder/vmbuilder into lp:vmbuilder.

Requested reviews:
  VMBuilder (vmbuilder)

For more details, see:
https://code.launchpad.net/~w-mail-4/vmbuilder/vmbuilder/+merge/242076

It modifies the generated fstab to refer to partitions by UUID instead of by disk mount point.

Fixes 517067


-- 
Your team VMBuilder is requested to review the proposed merge of lp:~w-mail-4/vmbuilder/vmbuilder into lp:vmbuilder.
=== modified file 'VMBuilder/hypervisor.py'
--- VMBuilder/hypervisor.py	2011-05-16 20:00:30 +0000
+++ VMBuilder/hypervisor.py	2014-11-18 14:55:49 +0000
@@ -59,6 +59,7 @@
         self.nics = [self.NIC()]
         self.call_hooks('preflight_check')
         self.call_hooks('configure_networking', self.nics)
+        self.call_hooks('create_partitions')
         self.call_hooks('configure_mounting', self.disks, self.filesystems)
 
         self.chroot_dir = tmpdir()
@@ -78,9 +79,8 @@
                         destdir)
         self.call_hooks('deploy', destdir)
 
-    def mount_partitions(self, mntdir):
-        """Mounts all the vm's partitions and filesystems below .rootmnt"""
-        logging.info('Mounting target filesystems')
+    def create_partitions(self):
+        """Creates all the vms partitions and formats them """
         for fs in self.filesystems:
             fs.create()
             fs.mkfs()
@@ -89,6 +89,10 @@
             disk.partition()
             disk.map_partitions()
             disk.mkfs()
+
+    def mount_partitions(self, mntdir):
+        """Mounts all the vm's partitions and filesystems below .rootmnt"""
+        logging.info('Mounting target filesystems')
         fss = VMBuilder.disk.get_ordered_filesystems(self)
         for fs in fss:
             fs.mount(mntdir)

=== modified file 'VMBuilder/plugins/ubuntu/dapper.py'
--- VMBuilder/plugins/ubuntu/dapper.py	2013-03-06 08:56:30 +0000
+++ VMBuilder/plugins/ubuntu/dapper.py	2014-11-18 14:55:49 +0000
@@ -246,7 +246,7 @@
             self.context.install_file('/etc/apt/apt.conf', '// Proxy added by vmbuilder\nAcquire::http { Proxy "%s"; };' % proxy)
 
     def install_fstab(self, disks, filesystems):
-        self.install_from_template('/etc/fstab', 'dapper_fstab', { 'parts' : disk.get_ordered_partitions(disks), 'prefix' : self.disk_prefix })
+        self.install_from_template('/etc/fstab', 'dapper_fstab', { 'parts' : disk.get_ordered_partitions(disks) })
 
     def install_device_map(self):
         self.install_from_template('/boot/grub/device.map', 'devicemap', { 'prefix' : self.disk_prefix })

=== modified file 'VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl'
--- VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl	2010-02-24 11:04:23 +0000
+++ VMBuilder/plugins/ubuntu/templates/dapper_fstab.tmpl	2014-11-18 14:55:49 +0000
@@ -3,8 +3,5 @@
 # <file system>                                 <mount point>   <type>  <options>       <dump>  <pass>
 proc                                            /proc           proc    defaults        0       0
 #for $part in $parts
-#echo '/dev/%s%-40s %-15s %-7s %-15s %d       %d\n' % ($prefix, part.get_suffix(), part.mntpnt, part.fs.fstab_fstype(), part.fs.fstab_options(), 0, 0)
-#*
-echo "/dev/$prefix$part.get_suffix()                                $part.mntpnt        $part.fs.fstab_fstype()    $part.fs.fstab_options()    0    0
-*#
+UUID=$part.fs.uuid                                $part.mntpnt        $part.fs.fstab_fstype()    $part.fs.fstab_options()    0    0
 #end for


Follow ups