From 619026ff3d0d397aebdd66edf3008acc83a5b8bd Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Fri, 27 Jul 2018 15:10:22 -0700 Subject: [PATCH] Update to use only qemu-kvm We only have qemu-kvm available, so use that. This also means that there will not me any support for using qemu with arches that are different from the host. --- docs/livemedia-creator.rst | 2 +- lorax.spec | 5 ++--- src/pylorax/installer.py | 20 +++++++------------- src/sbin/livemedia-creator | 4 ++-- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/docs/livemedia-creator.rst b/docs/livemedia-creator.rst index 94ae0ad1..d3805952 100644 --- a/docs/livemedia-creator.rst +++ b/docs/livemedia-creator.rst @@ -25,7 +25,7 @@ minimum you need: ``--ks`` to select the kickstart file describing what to install. -To use livemedia-creator with virtualization you will need to have qemu installed. +To use livemedia-creator with virtualization you will need to have qemu-kvm installed. If you are going to be using Anaconda directly, with ``--no-virt`` mode, make sure you have the anaconda-tui package installed. diff --git a/lorax.spec b/lorax.spec index ab1b517c..117d39ad 100644 --- a/lorax.spec +++ b/lorax.spec @@ -90,16 +90,15 @@ Anaconda's image install feature. %package lmc-virt Summary: livemedia-creator libvirt dependencies Requires: lorax = %{version}-%{release} -Requires: qemu +Requires: qemu-kvm # Fedora edk2 builds currently only support these arches %ifarch %{ix86} x86_64 %{arm} aarch64 Requires: edk2-ovmf %endif -Recommends: qemu-kvm %description lmc-virt -Additional dependencies required by livemedia-creator when using it with qemu. +Additional dependencies required by livemedia-creator when using it with qemu-kvm. %package lmc-novirt Summary: livemedia-creator no-virt dependencies diff --git a/src/pylorax/installer.py b/src/pylorax/installer.py index 45ec8af9..b61040b8 100644 --- a/src/pylorax/installer.py +++ b/src/pylorax/installer.py @@ -135,15 +135,6 @@ class QEMUInstall(object): """ Run qemu using an iso and a kickstart """ - # Mapping of arch to qemu command - QEMU_CMDS = {"x86_64": "qemu-system-x86_64", - "i386": "qemu-system-i386", - "arm": "qemu-system-arm", - "aarch64": "qemu-system-aarch64", - "ppc": "qemu-system-ppc", - "ppc64": "qemu-system-ppc64" - } - def __init__(self, opts, iso, ks_paths, disk_img, img_size=2048, kernel_args=None, memory=1024, vcpus=None, vnc=None, arch=None, log_check=None, virtio_host="127.0.0.1", virtio_port=6080, @@ -170,9 +161,9 @@ class QEMUInstall(object): :param bool boot_uefi: Use OVMF to boot the VM in UEFI mode :param str ovmf_path: Path to the OVMF firmware """ - # Lookup qemu-system- for arch if passed, or try to guess using host arch - qemu_cmd = [self.QEMU_CMDS.get(arch or os.uname().machine, "qemu-system-"+os.uname().machine)] - if not os.path.exists("/usr/bin/"+qemu_cmd[0]): + # RHEL8 only has /usr/libexec/qemu-kvm so we have to use that. + qemu_cmd = ["/usr/libexec/qemu-kvm"] + if not os.path.exists(qemu_cmd[0]): raise InstallError("%s does not exist, cannot run qemu" % qemu_cmd[0]) qemu_cmd += ["-nodefconfig"] @@ -225,13 +216,16 @@ class QEMUInstall(object): log.info("qemu %s", display_args) qemu_cmd += ["-nographic", "-display", display_args ] + # Setup virtio networking + qemu_cmd += ["-netdev", "user,id=n1", "-device", "virtio-net-pci,netdev=n1"] + # Setup the virtio log port qemu_cmd += ["-device", "virtio-serial-pci,id=virtio-serial0"] qemu_cmd += ["-device", "virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0" ",id=channel0,name=org.fedoraproject.anaconda.log.0"] qemu_cmd += ["-chardev", "socket,id=charchannel0,host=%s,port=%s" % (virtio_host, virtio_port)] - # PAss through rng from host + # Pass through rng from host if opts.with_rng != "none": qemu_cmd += ["-object", "rng-random,id=virtio-rng0,filename=%s" % opts.with_rng] qemu_cmd += ["-device", "virtio-rng-pci,rng=virtio-rng0,id=rng0,bus=pci.0,addr=0x9"] diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator index fb7c80aa..e987132c 100755 --- a/src/sbin/livemedia-creator +++ b/src/sbin/livemedia-creator @@ -84,8 +84,8 @@ def main(): errors.append("the volume id cannot be longer than 32 characters") if is_install and not opts.no_virt \ - and not any(glob.glob("/usr/bin/qemu-system-*")): - errors.append("qemu needs to be installed.") + and not any(glob.glob("/usr/libexec/qemu-kvm")): + errors.append("qemu-kvm needs to be installed.") if is_install and opts.no_virt \ and not os.path.exists("/usr/sbin/anaconda"):