Getting Started: Red Hat Enterprise Linux 7.5

First off, note that for proper KVM support, the so-called Red Hat Enterprise Linux for System z Structure A 7.5 ISO images are used. This will provide Linux kernel 4.14 instead of 3.10 as the regular images would.

The following instructions assume that we are currently logged in as user root.

If you did not choose Virtualization Host as the base environment during initial install, you need to install the required packages now:
   $ yum groupinstall virtualization-hypervisor
Once completed, don't forget to start the libvirt daemon:
   $ sudo systemctl start libvirtd
Next up, we define a sample guest. We will install the regular Red Hat Enterprise Linux 7.5 ISO image, not the alternate architecture ISO, although that would work just as well.
Furthermore, we use a virtual disk backed by an image file in our host's filesystem.
To do so, create a file rhel7.xml with the following content:
   <domain type='kvm'>
     <name>rhel7</name>
     <memory unit='GiB'>4</memory>
     <vcpu>2</vcpu>
     <os>
       <type arch='s390x' machine='s390-ccw-virtio'>hvm</type>
     </os>
     <iothreads>1</iothreads>
     <on_poweroff>destroy</on_poweroff>
     <on_reboot>restart</on_reboot>
     <on_crash>preserve</on_crash>
     <devices>
       <disk type='file' device='disk'>
         <driver name='qemu' type='qcow2' io='native' cache='none' iothread='1'/>
         <source file='/var/lib/libvirt/images/rhel7.img'/>
         <target dev='vda' bus='virtio'/>
       </disk>
       <disk type='file' device='cdrom'>
         <source file='/var/lib/libvirt/images/RHEL-7.5-Server-s390x-dvd1.iso'/>
         <target dev='sda' bus='scsi'/>
         <readonly/>
         <boot order='1'/>
       </disk>
       <interface type="network">
         <source network="default"/>
       </interface>
       <console type='pty'>
         <target type='sclp'/>
       </console>
       <memballoon model='none'/> 
     </devices>
   </domain>
Modify the highlighted parts as follows (in sequence):
  • image file: Image file backing the guest's virtual disk. Note that this file is defined in the next step, might grow, and sufficient free space should be available.
  • ISO file: ISO image of the Linux distribution to install in the guest. Could be any Linux distribution supported by the host distro as a guest.
Create the image file as indicated above:
   $ sudo qemu-img create -f qcow2 /var/lib/libvirt/images/rhel7.img 8G
   Formatting '/var/lib/libvirt/images/rhel.img', fmt=qcow2 size=8589934592
   cluster_size=65536 lazy_refcounts=off refcount_bits=16
Define the guest and start it (which will boot the ISO image), connecting to the console:
   $ virsh define rhel7.xml
   $ virsh start --console rhel7
This will bring up the installer:
Make sure to configure all options that are indicated to require input (i.e. all options marked with '[!]'). Pay attention to 'Network configuration' -
select 'Configure device eth0':
Then choose option 'Apply configuration in installer':
Finally start the installation.
Once done, Red Hat Enterprise Linux will reboot - and start the whole installation process again from the beginning, as it still tries to boot from the install ISO first.Therefore, we need to modify the guest definition to boot from its virtual disk rather than the ISO image - or we would be prompted to re-install the guest on each restart.
To do so, stop the guest and bring up its configuration in an editor by running
   $ virsh shutdown rhel7
   $ virsh edit rhel7
Either remove the entire <disk> element, or the indicated <boot> element only:
   <disk type='file' device='cdrom'>
     <driver name='qemu' type='raw'/>
     <source file='/var/lib/libvirt/images/RHEL-7.5-Server-s390x-dvd1.iso'/>
     <target dev='sda' bus='scsi'/>
     <readonly/>
     <boot order='1'/>
     <address type='drive' controller='0' bus='0' target='0' unit='0'/>
   </disk>
Finally, restart the guest:

   $ virsh start --console rhel7

4 comments:

  1. Pino ToscanoMay 14, 2018

    An alternative to the copy&paste of the above XML for libvirt is to install virt-install, and use it to define the new guest -- for example, for the above snippet, a rough equivalent would be:
    # virt-install \
    --name rhel7 \
    --memory 4096 \
    --vcpus 2 \
    --location /var/lib/libvirt/images/RHEL-7.5-Server-s390x-dvd1.iso \
    --disk size=8G \
    --network network=default \
    --graphics none \
    --hvm \
    --console pty \
    --memballoon none
    which does most of the job, including creating the disk, and rebooting at the end of the installation (after detaching the cdrom).

    ReplyDelete
    Replies
    1. Good point - we tried to keep these instructions as simple as possible (i.e. keeping additional dependencies to a minimum). But, true, there's quite a few tools out there that could make the process more convenient.
      Thanks for sharing!

      Delete
  2. Hello, the correct name of the product is Red Hat Enterprise Linux for System z Structure A.
    Structure A was created to provide kernel 4.14 that includes support for many features for Linux on Z, including native KVM support (qemu-kvm) and also containers support.
    Thank you,

    ReplyDelete
    Replies
    1. Thanks for clarifying - fixed in the article!

      Delete