Add --live-rootfs-size option.

This commit is contained in:
Radek Vykydal 2015-01-15 11:22:30 +01:00
parent a55fe2259a
commit d16bdcaf6d
3 changed files with 16 additions and 5 deletions

View File

@ -11,6 +11,7 @@ livemedia-creator [-h]
[--fs-label FS_LABEL]
[--qcow2] [--qcow2-arg QCOW2_ARGS]
[--compression] [--compress-arg]
[--live-rootfs-size LIVE_ROOTFS_SIZE]
[--keep-image] [--no-virt] [--proxy PROXY]
[--anaconda-arg ANACONDA_ARGS]
[--armplatform ARMPLATFORM] [--location LOCATION]
@ -195,6 +196,11 @@ Path to template to use for appliance data.
\fB\-\-app\-file APP_FILE\fR
Appliance template results file.
.SH PXE\-LIVE ARGUMENTS:
.TP
\fB\-\-live\-rootfs\-size\fR
Size of root filesystem of live image in GiB. By default approximate size of space used in root filesystem is used.
.SH VIRT\-INSTALL ARGUMENTS:
.TP
\fB\-\-ram MEMORY\fR

View File

@ -98,7 +98,7 @@ def mkrootfsimg(rootdir, outfile, label, size=2, sysroot=""):
:param str rootdir: Root directory
:param str outfile: Path of output image file
:param str label: Filesystem label
:param int size: Size of the image, if None computed automatically
:param int size: Size of the image in GiB, if None computed automatically
:param str sysroot: path to system (deployment) root relative to physical root
"""
if size:

View File

@ -1035,7 +1035,7 @@ def make_image(opts, ks):
return disk_img
def make_live_images(opts, work_dir, root_dir, rootfs_image=None):
def make_live_images(opts, work_dir, root_dir, rootfs_image=None, size=None):
"""
Create live images from direcory or rootfs image
@ -1061,7 +1061,7 @@ def make_live_images(opts, work_dir, root_dir, rootfs_image=None):
shutil.copy2(rootfs_image, joinpaths(liveos_dir, "rootfs.img"))
else:
log.info("Creating live rootfs image")
mkrootfsimg(root_dir, joinpaths(liveos_dir, "rootfs.img"), "LiveOS", size=None, sysroot=sys_root)
mkrootfsimg(root_dir, joinpaths(liveos_dir, "rootfs.img"), "LiveOS", size=size, sysroot=sys_root)
log.info("Packing live rootfs image")
add_pxe_args = []
@ -1202,7 +1202,6 @@ def main():
help="Compression binary for make-tar. xz, lzma, gzip, and bzip2 are supported. xz is the default.")
image_group.add_argument("--compress-arg", action="append", dest="compress_args", default=[],
help="Arguments to pass to compression. Pass once for each argument")
# Group of arguments for appliance creation
app_group = parser.add_argument_group("appliance arguments")
app_group.add_argument("--app-name", default=None,
@ -1236,6 +1235,11 @@ def main():
"once for each argument. NOTE: this "
"overrides the default. (default: %s)" % (DRACUT_DEFAULT,))
# pxe to live arguments
pxelive_group = parser.add_argument_group("pxe to live arguments")
pxelive_group.add_argument("--live-rootfs-size", type=int, default=0,
help="Size of root filesystem of live image in GiB")
parser.add_argument("--title", default="Linux Live Media",
help="Substituted for @TITLE@ in bootloader config files")
parser.add_argument("--project", default="Linux",
@ -1442,7 +1446,8 @@ def main():
mounted_sysroot_boot_dir = None
if opts.ostree:
mounted_sysroot_boot_dir = mount_boot_part_over_root(img_mount)
result_dir = make_live_images(opts, work_dir, img_mount.mount_dir)
size = opts.live_rootfs_size or None
result_dir = make_live_images(opts, work_dir, img_mount.mount_dir, size=size)
finally:
if mounted_sysroot_boot_dir:
umount(mounted_sysroot_boot_dir)