From 20fa29b32b6f137d847f6ea99a64a8b128400306 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Fri, 17 Feb 2012 10:51:22 +0100 Subject: [PATCH] Add option to specify volume id on command line (#786834) --- src/pylorax/__init__.py | 5 +++-- src/pylorax/treebuilder.py | 5 +++-- src/sbin/lorax | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index 203191e2..d842b0f7 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -129,7 +129,7 @@ class Lorax(BaseLoraxClass): logger.addHandler(fh) def run(self, ybo, product, version, release, variant="", bugurl="", - isfinal=False, workdir=None, outputdir=None, buildarch=None): + isfinal=False, workdir=None, outputdir=None, buildarch=None, volid=None): assert self._configured @@ -235,7 +235,8 @@ class Lorax(BaseLoraxClass): logger.info("preparing to build output tree and boot images") treebuilder = TreeBuilder(product=self.product, arch=self.arch, inroot=installroot, outroot=self.outputdir, - runtime=runtime, templatedir=templatedir) + runtime=runtime, templatedir=templatedir, + volid=volid) logger.info("rebuilding initramfs images") dracut_args=["--xz", "--add", "livenet", "--add", "convertfs", "--omit", "plymouth"] diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index b0635ff5..686db1e9 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -151,10 +151,11 @@ class RuntimeBuilder(object): class TreeBuilder(object): '''Builds the arch-specific boot images. inroot should be the installtree root (the newly-built runtime dir)''' - def __init__(self, product, arch, inroot, outroot, runtime, templatedir=None): + def __init__(self, product, arch, inroot, outroot, runtime, templatedir=None, volid=None): # NOTE: if you change isolabel, you need to change pungi to match, or # the pungi images won't boot. - isolabel = "{0.name} {0.version} {1.basearch}".format(product, arch) + isolabel = volid or "{0.name} {0.version} {1.basearch}".format(product, arch) + # NOTE: if you pass an arg named "runtime" to a mako template it'll # clobber some mako internal variables - hence "runtime_img". self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime, diff --git a/src/sbin/lorax b/src/sbin/lorax index f86214e1..14b7d96d 100755 --- a/src/sbin/lorax +++ b/src/sbin/lorax @@ -72,6 +72,8 @@ def main(args): help="package glob to exclude (may be listed multiple times)") optional.add_option("--buildarch", default=None, help="build architecture", metavar="STRING") + optional.add_option("--volid", default=None, + help="volume id", metavar="STRING") # add the option groups to the parser parser.add_option_group(required) @@ -123,7 +125,8 @@ def main(args): lorax.configure(conf_file=opts.config) lorax.run(yb, opts.product, opts.version, opts.release, opts.variant, opts.bugurl, opts.isfinal, - workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch) + workdir=tempdir, outputdir=outputdir, buildarch=opts.buildarch, + volid=opts.volid) def get_yum_base_object(installroot, repositories, mirrorlists=[],