Skip to content
Snippets Groups Projects
Commit 4df0bc46 authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

Merge branch 'master' into ubuntu

parents 58e387f2 f564c1ff
No related branches found
No related tags found
No related merge requests found
2013-05-01, v0.2.10
* Fix a bug where acl and user_xattr mount options where not respected
in host bundling operation
2013-04-25, v0.2.9
* Support kamaki 0.8
* Fix a bug in util.get_command()
......
......@@ -50,9 +50,9 @@ copyright = u'2012, 2013 GRNET S.A. All rights reserved'
# built documents.
#
# The short X.Y version.
version = '0.2.9'
version = '0.2.10'
# The full version, including alpha/beta/rc tags.
release = '0.2.8'
release = '0.2.10'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......@@ -239,10 +239,10 @@ latex_documents = [
man_pages = [
('man/snf-image-creator', 'snf-image-creator',
'Command line image creator for Synnefo',
'GRNET Development Team <synnefo-devel@googlegroups.com>', 1),
'Synnefo development team <synnefo-devel@googlegroups.com>', 1),
('man/snf-mkimage', 'snf-mkimage',
'Dialog-based image creator for Synnefo',
'GRNET Development Team <synnefo-devel@googlegroups.com>', 1)
'Synnefo development team <synnefo-devel@googlegroups.com>', 1)
]
# If true, show URL addresses after external links.
......
......@@ -31,6 +31,6 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
__version__ = '0.2.9'
__version__ = '0.2.10'
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
......@@ -53,6 +53,7 @@ losetup = get_command('losetup')
mount = get_command('mount')
umount = get_command('umount')
blkid = get_command('blkid')
tune2fs = get_command('tune2fs')
MKFS_OPTS = {'ext2': ['-F'],
'ext3': ['-F'],
......@@ -277,11 +278,15 @@ class BundleVolume(object):
def _mount(self, target, devs):
"""Mount a list of filesystems in mountpoints relative to target"""
devs.sort(key=lambda d: d[1])
for dev, mpoint in devs:
for dev, mpoint, options in devs:
absmpoint = os.path.abspath(target + mpoint)
if not os.path.exists(absmpoint):
os.makedirs(absmpoint)
mount(dev, absmpoint)
if len(options) > 0:
mount(dev, absmpoint, '-o', ",".join(options))
else:
mount(dev, absmpoint)
def _umount_all(self, target):
"""Unmount all filesystems that are mounted under the directory target
......@@ -369,8 +374,10 @@ class BundleVolume(object):
"""
filesystem = {}
orig_dev = {}
for p in self.disk.partitions:
filesystem[p.number] = self._get_mount_options(p.path)
orig_dev[p.number] = p.path
unmounted = filter(lambda p: filesystem[p.num] is None, partitions)
mounted = filter(lambda p: filesystem[p.num] is not None, partitions)
......@@ -385,6 +392,8 @@ class BundleVolume(object):
self.out.success("done")
loop = str(losetup('-f', '--show', image)).strip()
# Recreate mounted file systems
mapped = {}
try:
for p in mounted:
......@@ -398,15 +407,34 @@ class BundleVolume(object):
self.out.output('Creating %s filesystem on partition %d ... ' %
(fs, i), False)
get_command('mkfs.%s' % fs)(*(MKFS_OPTS[fs] + [dev]))
# For ext[234] enable the default mount options
if re.match('^ext[234]$', fs):
mopts = filter(
lambda p: p.startswith('Default mount options:'),
tune2fs('-l', orig_dev[i]).splitlines()
)[0].split(':')[1].strip().split()
if not (len(mopts) == 1 and mopts[0] == '(none)'):
for opt in mopts:
tune2fs('-o', opt, dev)
self.out.success('done')
new_uuid[i] = blkid(
'-s', 'UUID', '-o', 'value', dev).stdout.strip()
target = tempfile.mkdtemp()
devs = []
for i in mapped.keys():
fs = filesystem[i].fs
mpoint = filesystem[i].mpoint
opts = []
for opt in filesystem[i].opts.split(','):
if opt in ('acl', 'user_xattr'):
opts.append(opt)
devs.append((mapped[i], mpoint, opts))
try:
self._mount(
target,
[(mapped[i], filesystem[i].mpoint) for i in mapped.keys()])
self._mount(target, devs)
excluded = self._to_exclude()
......
......@@ -43,8 +43,8 @@ setup(
description='Command line tool for creating images',
long_description=open('README').read(),
url='https://code.grnet.gr/projects/snf-image-creator',
author="GRNET development team",
author_email="okeanos-dev@lists.grnet.gr",
author="Synnefo development team",
author_email="synnefo-devel@googlegroups.com",
license='BSD',
packages=find_packages(),
include_package_data=True,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment