Merge lp:~kees/vmbuilder/use-ext4 into lp:vmbuilder/trunk

Proposed by Kees Cook
Status: Merged
Merged at revision: not available
Proposed branch: lp:~kees/vmbuilder/use-ext4
Merge into: lp:vmbuilder/trunk
Diff against target: 156 lines (+55/-13)
5 files modified
AUTHORS (+1/-0)
VMBuilder/disk.py (+17/-12)
VMBuilder/plugins/ubuntu/distro.py (+4/-1)
VMBuilder/plugins/ubuntu/karmic.py (+7/-0)
VMBuilder/plugins/ubuntu/lucid.py (+26/-0)
To merge this branch: bzr merge lp:~kees/vmbuilder/use-ext4
Reviewer Review Type Date Requested Status
VMBuilder Pending
Review via email: mp+15969@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Kees Cook (kees) wrote :

Switches default fs to ext4 for karmic and later.

lp:~kees/vmbuilder/use-ext4 updated
360. By Kees Cook

add Lucid guest support

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'AUTHORS'
--- AUTHORS 2008-09-29 12:28:03 +0000
+++ AUTHORS 2010-01-04 19:54:14 +0000
@@ -2,3 +2,4 @@
22
3Other contributors:3Other contributors:
4 * Nicolas Barcet <nicolas.barcet@ubuntu.com>4 * Nicolas Barcet <nicolas.barcet@ubuntu.com>
5 * Kees Cook <kees.cook@canonical.com>
56
=== modified file 'VMBuilder/disk.py'
--- VMBuilder/disk.py 2009-10-23 07:17:47 +0000
+++ VMBuilder/disk.py 2010-01-04 19:54:14 +0000
@@ -32,6 +32,7 @@
32TYPE_EXT3 = 132TYPE_EXT3 = 1
33TYPE_XFS = 233TYPE_XFS = 2
34TYPE_SWAP = 334TYPE_SWAP = 3
35TYPE_EXT4 = 4
3536
36class Disk(object):37class Disk(object):
37 def __init__(self, vm, size='5G', preallocated=False, filename=None):38 def __init__(self, vm, size='5G', preallocated=False, filename=None):
@@ -217,7 +218,7 @@
217 @rtype: string218 @rtype: string
218 @return: the filesystem type of the partition suitable for passing to parted219 @return: the filesystem type of the partition suitable for passing to parted
219 """220 """
220 return { TYPE_EXT2: 'ext2', TYPE_EXT3: 'ext2', TYPE_XFS: 'ext2', TYPE_SWAP: 'linux-swap(new)' }[self.type]221 return { TYPE_EXT2: 'ext2', TYPE_EXT3: 'ext2', TYPE_EXT4: 'ext2', TYPE_XFS: 'ext2', TYPE_SWAP: 'linux-swap(new)' }[self.type]
221222
222 def create(self, disk):223 def create(self, disk):
223 """Adds partition to the disk image (does not mkfs or anything like that)"""224 """Adds partition to the disk image (does not mkfs or anything like that)"""
@@ -254,13 +255,7 @@
254 self.device = device255 self.device = device
255 self.dummy = dummy256 self.dummy = dummy
256 257
257 try:258 self.set_type(type)
258 if int(type) == type:
259 self.type = type
260 else:
261 self.type = str_to_type(type)
262 except ValueError, e:
263 self.type = str_to_type(type)
264259
265 self.mntpnt = mntpnt260 self.mntpnt = mntpnt
266261
@@ -299,13 +294,13 @@
299 def mkfs_fstype(self):294 def mkfs_fstype(self):
300 if self.vm.suite in ['dapper', 'edgy', 'feisty', 'gutsy']:295 if self.vm.suite in ['dapper', 'edgy', 'feisty', 'gutsy']:
301 logging.debug('%s: 128 bit inode' % self.vm.suite)296 logging.debug('%s: 128 bit inode' % self.vm.suite)
302 return { TYPE_EXT2: ['mkfs.ext2', '-F'], TYPE_EXT3: ['mkfs.ext3', '-I 128', '-F'], TYPE_XFS: ['mkfs.xfs'], TYPE_SWAP: ['mkswap'] }[self.type]297 return { TYPE_EXT2: ['mkfs.ext2', '-F'], TYPE_EXT3: ['mkfs.ext3', '-I 128', '-F'], TYPE_EXT4: ['mkfs.ext4', '-I 128', '-F'], TYPE_XFS: ['mkfs.xfs'], TYPE_SWAP: ['mkswap'] }[self.type]
303 else:298 else:
304 logging.debug('%s: 256 bit inode' % self.vm.suite)299 logging.debug('%s: 256 bit inode' % self.vm.suite)
305 return { TYPE_EXT2: ['mkfs.ext2', '-F'], TYPE_EXT3: ['mkfs.ext3', '-F'], TYPE_XFS: ['mkfs.xfs'], TYPE_SWAP: ['mkswap'] }[self.type]300 return { TYPE_EXT2: ['mkfs.ext2', '-F'], TYPE_EXT3: ['mkfs.ext3', '-F'], TYPE_EXT4: ['mkfs.ext4', '-F'], TYPE_XFS: ['mkfs.xfs'], TYPE_SWAP: ['mkswap'] }[self.type]
306301
307 def fstab_fstype(self):302 def fstab_fstype(self):
308 return { TYPE_EXT2: 'ext2', TYPE_EXT3: 'ext3', TYPE_XFS: 'xfs', TYPE_SWAP: 'swap' }[self.type]303 return { TYPE_EXT2: 'ext2', TYPE_EXT3: 'ext3', TYPE_EXT4: 'ext4', TYPE_XFS: 'xfs', TYPE_SWAP: 'swap' }[self.type]
309304
310 def fstab_options(self):305 def fstab_options(self):
311 return 'defaults'306 return 'defaults'
@@ -344,7 +339,16 @@
344 def get_index(self):339 def get_index(self):
345 """Index of the disk (starting from 0)"""340 """Index of the disk (starting from 0)"""
346 return self.vm.filesystems.index(self)341 return self.vm.filesystems.index(self)
347 342
343 def set_type(self, type):
344 try:
345 if int(type) == type:
346 self.type = type
347 else:
348 self.type = str_to_type(type)
349 except ValueError, e:
350 self.type = str_to_type(type)
351
348def parse_size(size_str):352def parse_size(size_str):
349 """Takes a size like qemu-img would accept it and returns the size in MB"""353 """Takes a size like qemu-img would accept it and returns the size in MB"""
350 try:354 try:
@@ -366,6 +370,7 @@
366370
367str_to_type_map = { 'ext2': TYPE_EXT2,371str_to_type_map = { 'ext2': TYPE_EXT2,
368 'ext3': TYPE_EXT3,372 'ext3': TYPE_EXT3,
373 'ext4': TYPE_EXT4,
369 'xfs': TYPE_XFS,374 'xfs': TYPE_XFS,
370 'swap': TYPE_SWAP,375 'swap': TYPE_SWAP,
371 'linux-swap': TYPE_SWAP }376 'linux-swap': TYPE_SWAP }
372377
=== modified file 'VMBuilder/plugins/ubuntu/distro.py'
--- VMBuilder/plugins/ubuntu/distro.py 2009-10-05 11:06:37 +0000
+++ VMBuilder/plugins/ubuntu/distro.py 2010-01-04 19:54:14 +0000
@@ -29,7 +29,7 @@
29class Ubuntu(Distro):29class Ubuntu(Distro):
30 name = 'Ubuntu'30 name = 'Ubuntu'
31 arg = 'ubuntu'31 arg = 'ubuntu'
32 suites = ['dapper', 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic']32 suites = ['dapper', 'gutsy', 'hardy', 'intrepid', 'jaunty', 'karmic', 'lucid']
33 33
34 # Maps host arch to valid guest archs34 # Maps host arch to valid guest archs
35 valid_archs = { 'amd64' : ['amd64', 'i386', 'lpia' ],35 valid_archs = { 'amd64' : ['amd64', 'i386', 'lpia' ],
@@ -143,6 +143,9 @@
143 self.get_ec2_ramdisk()143 self.get_ec2_ramdisk()
144 self.apply_ec2_settings()144 self.apply_ec2_settings()
145145
146 if getattr(self.suite, 'set_filesystem_types', False):
147 self.suite.set_filesystem_types()
148
146 def install(self, destdir):149 def install(self, destdir):
147 self.destdir = destdir150 self.destdir = destdir
148 self.suite.install(destdir)151 self.suite.install(destdir)
149152
=== modified file 'VMBuilder/plugins/ubuntu/karmic.py'
--- VMBuilder/plugins/ubuntu/karmic.py 2009-09-25 19:14:04 +0000
+++ VMBuilder/plugins/ubuntu/karmic.py 2010-01-04 19:54:14 +0000
@@ -29,3 +29,10 @@
2929
30 def pre_install(self):30 def pre_install(self):
31 self.vm.install_file('/etc/hosts', contents='')31 self.vm.install_file('/etc/hosts', contents='')
32
33 def set_filesystem_types(self):
34 # Default for Karmic and later is ext4
35 for disk in self.vm.disks:
36 for partition in disk.partitions:
37 if partition.parted_fstype() == "ext2":
38 partition.set_type('ext4')
3239
=== added file 'VMBuilder/plugins/ubuntu/lucid.py'
--- VMBuilder/plugins/ubuntu/lucid.py 1970-01-01 00:00:00 +0000
+++ VMBuilder/plugins/ubuntu/lucid.py 2010-01-04 19:54:14 +0000
@@ -0,0 +1,26 @@
1#
2# Uncomplicated VM Builder
3# Copyright (C) 2007-2009 Canonical Ltd.
4#
5# See AUTHORS for list of contributors
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 3, as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18#
19import suite
20import logging
21import VMBuilder.disk as disk
22from VMBuilder.util import run_cmd
23from VMBuilder.plugins.ubuntu.karmic import Karmic
24
25class Lucid(Karmic):
26 pass

Subscribers

People subscribed via source and target branches