Add option to specify volume id on command line (#786834)

This commit is contained in:
Martin Gracik 2012-02-17 10:51:22 +01:00
parent 0e9d3e0c1c
commit e59ff3802f
3 changed files with 10 additions and 5 deletions

View File

@ -129,7 +129,7 @@ class Lorax(BaseLoraxClass):
logger.addHandler(fh) logger.addHandler(fh)
def run(self, ybo, product, version, release, variant="", bugurl="", 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 assert self._configured
@ -235,7 +235,8 @@ class Lorax(BaseLoraxClass):
logger.info("preparing to build output tree and boot images") logger.info("preparing to build output tree and boot images")
treebuilder = TreeBuilder(product=self.product, arch=self.arch, treebuilder = TreeBuilder(product=self.product, arch=self.arch,
inroot=installroot, outroot=self.outputdir, inroot=installroot, outroot=self.outputdir,
runtime=runtime, templatedir=templatedir) runtime=runtime, templatedir=templatedir,
volid=volid)
logger.info("rebuilding initramfs images") logger.info("rebuilding initramfs images")
dracut_args=["--xz", "--add", "livenet", "--add", "convertfs", "--omit", "plymouth"] dracut_args=["--xz", "--add", "livenet", "--add", "convertfs", "--omit", "plymouth"]

View File

@ -151,10 +151,11 @@ class RuntimeBuilder(object):
class TreeBuilder(object): class TreeBuilder(object):
'''Builds the arch-specific boot images. '''Builds the arch-specific boot images.
inroot should be the installtree root (the newly-built runtime dir)''' 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 # NOTE: if you change isolabel, you need to change pungi to match, or
# the pungi images won't boot. # 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 # NOTE: if you pass an arg named "runtime" to a mako template it'll
# clobber some mako internal variables - hence "runtime_img". # clobber some mako internal variables - hence "runtime_img".
self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime, self.vars = DataHolder(arch=arch, product=product, runtime_img=runtime,

View File

@ -72,6 +72,8 @@ def main(args):
help="package glob to exclude (may be listed multiple times)") help="package glob to exclude (may be listed multiple times)")
optional.add_option("--buildarch", default=None, optional.add_option("--buildarch", default=None,
help="build architecture", metavar="STRING") help="build architecture", metavar="STRING")
optional.add_option("--volid", default=None,
help="volume id", metavar="STRING")
# add the option groups to the parser # add the option groups to the parser
parser.add_option_group(required) parser.add_option_group(required)
@ -123,7 +125,8 @@ def main(args):
lorax.configure(conf_file=opts.config) lorax.configure(conf_file=opts.config)
lorax.run(yb, opts.product, opts.version, opts.release, lorax.run(yb, opts.product, opts.version, opts.release,
opts.variant, opts.bugurl, opts.isfinal, 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=[], def get_yum_base_object(installroot, repositories, mirrorlists=[],