livemedia-creator: Hook up arch option

Pass arch to virt-install and make_appliance.
This commit is contained in:
Brian C. Lane 2012-05-29 11:21:15 -07:00
parent 6e2fdfe23f
commit cc384f6e7a

View File

@ -226,7 +226,7 @@ class VirtualInstall( object ):
Run virt-install using an iso and kickstart(s) Run virt-install using an iso and kickstart(s)
""" """
def __init__( self, iso, ks_paths, disk_img, img_size=2, def __init__( self, iso, ks_paths, disk_img, img_size=2,
kernel_args=None, memory=1024, vnc=None, kernel_args=None, memory=1024, vnc=None, arch=None,
log_check=None, virtio_host="127.0.0.1", virtio_port=6080 ): log_check=None, virtio_host="127.0.0.1", virtio_port=6080 ):
""" """
@ -238,6 +238,7 @@ class VirtualInstall( object ):
kernel_args are extra arguments to pass on the kernel cmdline kernel_args are extra arguments to pass on the kernel cmdline
memory is the amount of ram to assign to the virt memory is the amount of ram to assign to the virt
vnc is passed to the --graphics command verbatim vnc is passed to the --graphics command verbatim
arch is the optional architecture to use in the virt
log_check is a method that returns True of the log indicates an error log_check is a method that returns True of the log indicates an error
virtio_host and virtio_port are used to communicate with the log monitor virtio_host and virtio_port are used to communicate with the log monitor
""" """
@ -290,6 +291,10 @@ class VirtualInstall( object ):
cmd.append("--channel") cmd.append("--channel")
cmd.append(channel_args) cmd.append(channel_args)
if arch:
cmd.append("--arch")
cmd.append(arch)
log.debug( cmd ) log.debug( cmd )
rc = execWithRedirect( cmd[0], cmd[1:] ) rc = execWithRedirect( cmd[0], cmd[1:] )
@ -364,7 +369,8 @@ def get_kernels( boot_dir ):
def make_appliance(disk_img, name, template, outfile, networks=None, ram=1024, def make_appliance(disk_img, name, template, outfile, networks=None, ram=1024,
vcpus=1, title="Linux", project="Linux", releasever=17): vcpus=1, arch=None, title="Linux", project="Linux",
releasever=17):
""" """
Generate an appliance description file Generate an appliance description file
@ -375,6 +381,7 @@ def make_appliance(disk_img, name, template, outfile, networks=None, ram=1024,
networks List of networks from the kickstart networks List of networks from the kickstart
ram Ram, in MB, passed to template. Default is 1024 ram Ram, in MB, passed to template. Default is 1024
vcpus CPUs, passed to template. Default is 1 vcpus CPUs, passed to template. Default is 1
arch CPU architecture. Default is 'x86_64'
title Title, passed to template. Default is 'Linux' title Title, passed to template. Default is 'Linux'
project Project, passed to template. Default is 'Linux' project Project, passed to template. Default is 'Linux'
releasever Release version, passed to template. Default is 17 releasever Release version, passed to template. Default is 17
@ -384,8 +391,8 @@ def make_appliance(disk_img, name, template, outfile, networks=None, ram=1024,
log.info("Creating appliance definition using ${0}".format(template)) log.info("Creating appliance definition using ${0}".format(template))
# Mount the disk and figure out the arch if not arch:
arch = "x86_64" arch = "x86_64"
log.info("Calculating SHA256 checksum of {0}".format(disk_img)) log.info("Calculating SHA256 checksum of {0}".format(disk_img))
sha256 = hashlib.sha256() sha256 = hashlib.sha256()
@ -586,7 +593,7 @@ if __name__ == '__main__':
help="Passed to --vcpus command" ) help="Passed to --vcpus command" )
virt_group.add_argument("--vnc", virt_group.add_argument("--vnc",
help="Passed to --graphics command" ) help="Passed to --graphics command" )
virt_group.add_argument("--arch", virt_group.add_argument("--arch", default=None,
help="Passed to --arch command" ) help="Passed to --arch command" )
virt_group.add_argument( "--kernel-args", virt_group.add_argument( "--kernel-args",
help="Additional argument to pass to the installation kernel" ) help="Additional argument to pass to the installation kernel" )
@ -767,7 +774,7 @@ if __name__ == '__main__':
kernel_args += " proxy="+opts.proxy kernel_args += " proxy="+opts.proxy
virt = VirtualInstall( iso_mount, opts.ks, disk_img, disk_size, virt = VirtualInstall( iso_mount, opts.ks, disk_img, disk_size,
kernel_args, opts.ram, opts.vnc, kernel_args, opts.ram, opts.vnc, opts.arch,
log_check = log_monitor.server.log_check, log_check = log_monitor.server.log_check,
virtio_host = log_monitor.host, virtio_host = log_monitor.host,
virtio_port = log_monitor.port ) virtio_port = log_monitor.port )