From 3394e94e03ce666cfc770f7256583045c0f2774e Mon Sep 17 00:00:00 2001 From: Dohyung Kim Date: Fri, 9 Jun 2017 20:00:01 +0900 Subject: add --use-mic-in-bootstrap option use mic in bootstrap without copy host mic to bootstrap. by default, copy host mic to bootstrap and use it Change-Id: I3f4f03cc666df05ad4a7c393b771a2487350b9fe Signed-off-by: Dohyung Kim --- etc/mic.conf.in | 1 + mic/cmd_create.py | 3 +++ mic/conf.py | 8 ++++++++ mic/rt_util.py | 6 +++++- tools/mic | 5 +++++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/etc/mic.conf.in b/etc/mic.conf.in index 3d41eff..81907ff 100644 --- a/etc/mic.conf.in +++ b/etc/mic.conf.in @@ -10,6 +10,7 @@ tmpdir= /var/tmp/mic cachedir= /var/tmp/mic/cache outdir= ./mic-output runtime=bootstrap +#use_mic_in_bootstrap = yes pkgmgr = auto diff --git a/mic/cmd_create.py b/mic/cmd_create.py index 7ef7e46..203d08d 100755 --- a/mic/cmd_create.py +++ b/mic/cmd_create.py @@ -151,6 +151,9 @@ def main(parser, args, argv): if args.runtime: configmgr.set_runtime(args.runtime) + if args.use_mic_in_bootstrap: + configmgr.create['use_mic_in_bootstrap'] = args.use_mic_in_bootstrap + if args.pack_to is not None: configmgr.create['pack_to'] = args.pack_to diff --git a/mic/conf.py b/mic/conf.py index 40d4a64..33e534f 100755 --- a/mic/conf.py +++ b/mic/conf.py @@ -78,6 +78,7 @@ class ConfigMgr(object): "strict_mode": False, "run_script": None, "tpk_install": None, + "use_mic_in_bootstrap": False, }, 'chroot': { "saveto": None, @@ -195,6 +196,13 @@ class ConfigMgr(object): packages = packages.split() self.bootstrap['packages'] = packages + if type(self.create['use_mic_in_bootstrap']) != 'bool': + use_mic_in_bootstrap = str(self.create['use_mic_in_bootstrap']) + if use_mic_in_bootstrap.lower() in ('on', 'yes', 'true', '1'): + self.create['use_mic_in_bootstrap'] = True + else: + self.create['use_mic_in_bootstrap'] = False + def _parse_kickstart(self, ksconf=None): if not ksconf: return diff --git a/mic/rt_util.py b/mic/rt_util.py index 316375d..61b0bb2 100644 --- a/mic/rt_util.py +++ b/mic/rt_util.py @@ -104,7 +104,11 @@ def bootstrap_mic(argv=None): rootdir = os.path.join(rootdir, "bootstrap") bsenv.dirsetup(rootdir) - sync_mic(rootdir, plugin=cropts['plugin_dir']) + if cropts['use_mic_in_bootstrap']: + msger.info("No copy host mic") + else: + msger.info("Copy host mic to bootstrap") + sync_mic(rootdir, plugin=cropts['plugin_dir']) #FIXME: sync the ks file to bootstrap if "/" == os.path.dirname(os.path.abspath(configmgr._ksconf)): diff --git a/tools/mic b/tools/mic index 70000a7..6cbfb45 100755 --- a/tools/mic +++ b/tools/mic @@ -124,6 +124,11 @@ def create_parser(parser): dest='strict_mode', default=False, help='Abort creation of image, if there are some errors' ' during rpm installation. ') + parent_parser.add_argument('--use-mic-in-bootstrap', action='store_true', + dest='use_mic_in_bootstrap', default=False, + help='This option works in bootstrap runtime mode,' + ' Use mic in bootstrap to create image.' + ' By default, copy host mic to bootstrap and use it.') parent_parser.add_argument('-d', '--debug', action='store_true', help='debug output') -- cgit v1.2.3