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.
This commit is contained in:
Brian C. Lane 2018-07-27 15:10:22 -07:00
parent c3987cc4cb
commit 619026ff3d
4 changed files with 12 additions and 19 deletions

View File

@ -25,7 +25,7 @@ minimum you need:
``--ks`` to select the kickstart file describing what to install. ``--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 If you are going to be using Anaconda directly, with ``--no-virt`` mode, make sure
you have the anaconda-tui package installed. you have the anaconda-tui package installed.

View File

@ -90,16 +90,15 @@ Anaconda's image install feature.
%package lmc-virt %package lmc-virt
Summary: livemedia-creator libvirt dependencies Summary: livemedia-creator libvirt dependencies
Requires: lorax = %{version}-%{release} Requires: lorax = %{version}-%{release}
Requires: qemu Requires: qemu-kvm
# Fedora edk2 builds currently only support these arches # Fedora edk2 builds currently only support these arches
%ifarch %{ix86} x86_64 %{arm} aarch64 %ifarch %{ix86} x86_64 %{arm} aarch64
Requires: edk2-ovmf Requires: edk2-ovmf
%endif %endif
Recommends: qemu-kvm
%description lmc-virt %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 %package lmc-novirt
Summary: livemedia-creator no-virt dependencies Summary: livemedia-creator no-virt dependencies

View File

@ -135,15 +135,6 @@ class QEMUInstall(object):
""" """
Run qemu using an iso and a kickstart 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, def __init__(self, opts, iso, ks_paths, disk_img, img_size=2048,
kernel_args=None, memory=1024, vcpus=None, vnc=None, arch=None, kernel_args=None, memory=1024, vcpus=None, 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,
@ -170,9 +161,9 @@ class QEMUInstall(object):
:param bool boot_uefi: Use OVMF to boot the VM in UEFI mode :param bool boot_uefi: Use OVMF to boot the VM in UEFI mode
:param str ovmf_path: Path to the OVMF firmware :param str ovmf_path: Path to the OVMF firmware
""" """
# Lookup qemu-system- for arch if passed, or try to guess using host arch # RHEL8 only has /usr/libexec/qemu-kvm so we have to use that.
qemu_cmd = [self.QEMU_CMDS.get(arch or os.uname().machine, "qemu-system-"+os.uname().machine)] qemu_cmd = ["/usr/libexec/qemu-kvm"]
if not os.path.exists("/usr/bin/"+qemu_cmd[0]): if not os.path.exists(qemu_cmd[0]):
raise InstallError("%s does not exist, cannot run qemu" % qemu_cmd[0]) raise InstallError("%s does not exist, cannot run qemu" % qemu_cmd[0])
qemu_cmd += ["-nodefconfig"] qemu_cmd += ["-nodefconfig"]
@ -225,13 +216,16 @@ class QEMUInstall(object):
log.info("qemu %s", display_args) log.info("qemu %s", display_args)
qemu_cmd += ["-nographic", "-display", 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 # Setup the virtio log port
qemu_cmd += ["-device", "virtio-serial-pci,id=virtio-serial0"] qemu_cmd += ["-device", "virtio-serial-pci,id=virtio-serial0"]
qemu_cmd += ["-device", "virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0" qemu_cmd += ["-device", "virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0"
",id=channel0,name=org.fedoraproject.anaconda.log.0"] ",id=channel0,name=org.fedoraproject.anaconda.log.0"]
qemu_cmd += ["-chardev", "socket,id=charchannel0,host=%s,port=%s" % (virtio_host, virtio_port)] 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": if opts.with_rng != "none":
qemu_cmd += ["-object", "rng-random,id=virtio-rng0,filename=%s" % opts.with_rng] 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"] qemu_cmd += ["-device", "virtio-rng-pci,rng=virtio-rng0,id=rng0,bus=pci.0,addr=0x9"]

View File

@ -84,8 +84,8 @@ def main():
errors.append("the volume id cannot be longer than 32 characters") errors.append("the volume id cannot be longer than 32 characters")
if is_install and not opts.no_virt \ if is_install and not opts.no_virt \
and not any(glob.glob("/usr/bin/qemu-system-*")): and not any(glob.glob("/usr/libexec/qemu-kvm")):
errors.append("qemu needs to be installed.") errors.append("qemu-kvm needs to be installed.")
if is_install and opts.no_virt \ if is_install and opts.no_virt \
and not os.path.exists("/usr/sbin/anaconda"): and not os.path.exists("/usr/sbin/anaconda"):