livemedia-creator: Add minimal disk example kickstart (#1019728)

Also adds a check for a bad url repo, and fix ram calculation for
appliance mode. Updates the README.livemedia-creator documentation.

Resolves: rhbz#1019728
This commit is contained in:
Brian C. Lane 2013-10-30 11:06:37 -07:00
parent 149d2229ea
commit fca6a13875
3 changed files with 88 additions and 12 deletions

View File

@ -16,6 +16,14 @@ minimum you need:
--iso to specify the Anaconda install media to use with virt-install --iso to specify the Anaconda install media to use with virt-install
--ks is the kickstart to use to install the system --ks is the kickstart to use to install the system
To use livemedia-creator with virt-install you will need to install the
following packages, as well as have libvirtd setup correctly.
virt-install
libvirt-python
If you are going to be using Anaconda directly, with --no-virt mode, make sure
you have the anaconda package installed.
QUICKSTART QUICKSTART
---------- ----------
@ -74,13 +82,18 @@ written using the Mako template system which is very flexible.
KICKSTARTS KICKSTARTS
---------- ----------
Existing spin kickstarts can be used to create live media with a few changes. The docs/ directory includes two example kickstarts, one to create a live desktop
Here are the steps I used to convert the XFCE spin. iso using GNOME, and the other to create a minimal disk image. When creating your
own kickstarts you should start with the minimal example, it includes several
needed packages that are not always included by dependencies.
Or you can use existing spin kickstarts to create live media with a few
changes. Here are the steps I used to convert the Fedora XFCE spin.
1. Flatten the xfce kickstart using ksflatten 1. Flatten the xfce kickstart using ksflatten
2. Add zerombr so you don't get the disk init dialog 2. Add zerombr so you don't get the disk init dialog
3. Add clearpart --all 3. Add clearpart --all
4. Add swap and biosboot partitions 4. Add swap partition
5. bootloader target 5. bootloader target
6. Add shutdown to the kickstart 6. Add shutdown to the kickstart
7. Add network --bootproto=dhcp --activate to activate the network 7. Add network --bootproto=dhcp --activate to activate the network
@ -96,7 +109,6 @@ network --bootproto=dhcp --activate
zerombr zerombr
clearpart --all clearpart --all
bootloader --location=mbr bootloader --location=mbr
part biosboot --size=1
part swap --size=512 part swap --size=512
shutdown shutdown
@ -110,6 +122,9 @@ passwd -d root > /dev/null
cat /dev/null > /dev/fstab cat /dev/null > /dev/fstab
Do this only for live iso's, the filesystem will be mounted read only if
there is no /etc/fstab
11. Don't delete initramfs files from /boot in %post 11. Don't delete initramfs files from /boot in %post
12. Have dracut-config-generic, grub-efi, memtest86+ and syslinux in the package 12. Have dracut-config-generic, grub-efi, memtest86+ and syslinux in the package
list. list.
@ -180,7 +195,7 @@ switch. This will create the partitioned disk image and an XML file that can be
used with virt-image to setup a virtual system. used with virt-image to setup a virtual system.
The XML is generated using the Mako template from The XML is generated using the Mako template from
/usr/share/lorax/appliance/virt-image.xml You can use a different template by /usr/share/lorax/appliance/libvirt.xml You can use a different template by
passing --app-template <template path> passing --app-template <template path>
Documentation on the Mako template system can be found here: Documentation on the Mako template system can be found here:
@ -205,6 +220,10 @@ title from --title
project from --project project from --project
releasever from --releasever releasever from --releasever
The created image can be imported into libvirt using:
virt-image appliance.xml
DEBUGGING PROBLEMS DEBUGGING PROBLEMS
------------------ ------------------

51
docs/fedora-minimal.ks Normal file
View File

@ -0,0 +1,51 @@
# Minimal Disk Image
#
sshpw --username=root --plaintext randOmStrinGhERE
# Firewall configuration
firewall --enabled
# Use network installation
url --url="http://dl.fedoraproject.org/pub/fedora/linux/development/20/x86_64/os/"
# Root password
rootpw --plaintext removethispw
# Network information
network --bootproto=dhcp --onboot=on --activate
# System authorization information
auth --useshadow --enablemd5
# System keyboard
keyboard --xlayouts=us --vckeymap=us
# System language
lang en_US.UTF-8
# SELinux configuration
selinux --enforcing
# Installation logging level
logging --level=info
# Shutdown after installation
shutdown
# System timezone
timezone US/Eastern
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part / --fstype="ext4" --size=4000
part swap --size=1000
%post
# Remove root password
passwd -d root > /dev/null
%end
%packages
@core
kernel
memtest86+
grub2-efi
grub2
shim
syslinux
-dracut-config-rescue
%end

View File

@ -36,6 +36,7 @@ from time import sleep
import shutil import shutil
import argparse import argparse
import hashlib import hashlib
import re
# Use pykickstart to calculate disk image size # Use pykickstart to calculate disk image size
from pykickstart.parser import KickstartParser from pykickstart.parser import KickstartParser
@ -127,8 +128,13 @@ class LogRequestHandler(SocketServer.BaseRequestHandler):
"Out of memory:", "Out of memory:",
"Call Trace:", "Call Trace:",
"insufficient disk space:"] "insufficient disk space:"]
re_tests = [r"WARNING packaging: base repo .* not valid"]
for t in simple_tests: for t in simple_tests:
if line.find( t ) > -1: if t in line:
self.server.log_error = True
return
for t in re_tests:
if re.search(t, line):
self.server.log_error = True self.server.log_error = True
return return
@ -406,7 +412,7 @@ def make_appliance(disk_img, name, template, outfile, networks=None, ram=1024,
if not (disk_img and template and outfile): if not (disk_img and template and outfile):
return None return None
log.info("Creating appliance definition using ${0}".format(template)) log.info("Creating appliance definition using {0}".format(template))
if not arch: if not arch:
arch = "x86_64" arch = "x86_64"
@ -791,7 +797,7 @@ if __name__ == '__main__':
virt_group = parser.add_argument_group("virt-install arguments (DISABLED -- no libvirt)") virt_group = parser.add_argument_group("virt-install arguments (DISABLED -- no libvirt)")
else: else:
virt_group = parser.add_argument_group("virt-install arguments") virt_group = parser.add_argument_group("virt-install arguments")
virt_group.add_argument("--ram", metavar="MEMORY", default=1024, virt_group.add_argument("--ram", metavar="MEMORY", type=int, default=1024,
help="Memory to allocate for installer in megabytes." ) help="Memory to allocate for installer in megabytes." )
virt_group.add_argument("--vcpus", default=1, virt_group.add_argument("--vcpus", default=1,
help="Passed to --vcpus command" ) help="Passed to --vcpus command" )