Add --live-rootfs-size option.

Resolves: rhbz#1184021
This commit is contained in:
Radek Vykydal 2015-01-15 11:22:30 +01:00
parent 219ede2ae5
commit 9d8aabded6
3 changed files with 16 additions and 4 deletions

View File

@ -10,6 +10,7 @@ livemedia-creator [-h]
[--image-name IMAGE_NAME] [--image-only] [--image-name IMAGE_NAME] [--image-only]
[--fs-label FS_LABEL] [--fs-label FS_LABEL]
[--compression] [--compress-arg] [--compression] [--compress-arg]
[--live-rootfs-size LIVE_ROOTFS_SIZE]
[--keep-image] [--no-virt] [--proxy PROXY] [--keep-image] [--no-virt] [--proxy PROXY]
[--anaconda-arg ANACONDA_ARGS] [--anaconda-arg ANACONDA_ARGS]
[--armplatform ARMPLATFORM] [--location LOCATION] [--armplatform ARMPLATFORM] [--location LOCATION]
@ -191,6 +192,11 @@ Path to template to use for appliance data.
\fB\-\-app\-file APP_FILE\fR \fB\-\-app\-file APP_FILE\fR
Appliance template results file. 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: .SH VIRT\-INSTALL ARGUMENTS:
.TP .TP
\fB\-\-ram MEMORY\fR \fB\-\-ram MEMORY\fR

View File

@ -89,7 +89,7 @@ def mkrootfsimg(rootdir, outfile, label, size=2, sysroot=""):
:param str rootdir: Root directory :param str rootdir: Root directory
:param str outfile: Path of output image file :param str outfile: Path of output image file
:param str label: Filesystem label :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 :param str sysroot: path to system (deployment) root relative to physical root
""" """
if size: if size:

View File

@ -884,7 +884,7 @@ def make_image(opts, ks):
return disk_img 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 Create live images from direcory or rootfs image
@ -910,7 +910,7 @@ def make_live_images(opts, work_dir, root_dir, rootfs_image=None):
shutil.copy2(rootfs_image, joinpaths(liveos_dir, "rootfs.img")) shutil.copy2(rootfs_image, joinpaths(liveos_dir, "rootfs.img"))
else: else:
log.info("Creating live rootfs image") 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") log.info("Packing live rootfs image")
add_pxe_args = [] add_pxe_args = []
@ -1071,6 +1071,11 @@ if __name__ == '__main__':
"once for each argument. NOTE: this " "once for each argument. NOTE: this "
"overrides the default. (default: %s)" % (DRACUT_DEFAULT,) ) "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", parser.add_argument( "--title", default="Linux Live Media",
help="Substituted for @TITLE@ in bootloader config files" ) help="Substituted for @TITLE@ in bootloader config files" )
parser.add_argument( "--project", default="Red Hat Enterprise Linux", parser.add_argument( "--project", default="Red Hat Enterprise Linux",
@ -1271,7 +1276,8 @@ if __name__ == '__main__':
mounted_sysroot_boot_dir = None mounted_sysroot_boot_dir = None
if opts.ostree: if opts.ostree:
mounted_sysroot_boot_dir = mount_boot_part_over_root(img_mount) 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: finally:
if mounted_sysroot_boot_dir: if mounted_sysroot_boot_dir:
umount(mounted_sysroot_boot_dir) umount(mounted_sysroot_boot_dir)