2 # Copyright (c) 2014 Intel, Inc.
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the Free
6 # Software Foundation; version 2 of the License
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc., 59
15 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 from mic import msger, rt_util
22 from mic.plugin import pluginmgr
23 from mic.pluginbase import ImagerPlugin
24 from mic.imager.qcow import QcowImageCreator
25 from mic.utils import errors, runner
27 class QcowPlugin(ImagerPlugin):
31 def do_create(cls, args):
32 """${cmd_name}: create qcow image
35 creatoropts, pkgmgr, recording_pkgs = rt_util.prepare_create(args)
37 creator = QcowImageCreator(creatoropts,
40 if len(recording_pkgs) > 0:
41 creator._recording_pkgs = recording_pkgs
43 image_names = [creator.name + ".img"]
44 image_names.extend(creator.get_image_names())
45 cls.check_image_exists(creator.destdir,
48 creatoropts['release'])
51 creator.check_depend_tools()
52 creator.mount(None, creatoropts["cachedir"])
55 creator.configure(creatoropts["repomd"])
57 creator.create_cpio_image()
59 creator.copy_cpio_image()
60 creator.package(creatoropts["destdir"])
61 creator.create_manifest()
63 if creatoropts['release'] is not None:
64 creator.release_output(args.ksfile,
65 creatoropts['destdir'],
66 creatoropts['release'])
67 creator.print_outimage_info()
69 except errors.CreatorError:
74 #Run script of --run_script after image created
75 if creatoropts['run_script']:
76 cmd = creatoropts['run_script']
79 except OSError as err:
80 msger.warning(str(err))
83 msger.info("Finished.")
87 def do_chroot(cls, target, cmd=[]):
91 def do_unpack(cls, srcimg):