[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lorax 1/2] 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 8ae3077..a376866 100644
--- a/src/pylorax/__init__.py
+++ b/src/pylorax/__init__.py
@@ -125,7 +125,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
 
@@ -231,7 +231,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 7d092fe..f2511b0 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 f86214e..14b7d96 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=[],
-- 
1.7.5.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]