KVM VM config from command line - good and bad

Post Reply

Topic author
vaxman65
Member
Posts: 7
Joined: Wed Apr 28, 2021 9:07 pm
Reputation: 0
Status: Offline

KVM VM config from command line - good and bad

Post by vaxman65 » Mon May 08, 2023 4:48 pm

My home lab is a Rocky Linux KVM environment running on an AMD processor. The host system is setup as minimally as possible, so i do not run a graphics head on it, nor do I install X-windows there. I currently run 16 VMs (all but one are Linux), with two of those hosting a VAX and Alpha simulator respectively (nested virtualization - works better than it should!).

Without a graphics head, I had to use the virt-install command line directly to create the VM for the install. This mostly worked, but I cannot figure how to get VirstIO SCSI disks presented to the guest. Here is the shell script I used to create the guest:

Code: Select all

#!/bin/bash
#
DVD1_ISO=$(ls  /repo/OpenVMS/X86E921OE.ISO)


NEW_MACHINE=$1
MACO6=$2
VPORT=$3


virt-install    \
        --connect qemu:///system -n $NEW_MACHINE                                        \
        --ram 8192 --vcpus=4                                                            \
        --cdrom=/usr/share/OVMF/UefiShell.iso                                   \
        --disk device=disk,discard='unmap',path=/dev/T0/$NEW_MACHINE-disk0      \
        --disk device=disk,discard='unmap',,path=/dev/T0/$NEW_MACHINE-disk1     \
        --disk device=disk,path=/dev/T1/$NEW_MACHINE-disk2                      \
        --disk device=cdrom,path=$DVD1_ISO                                      \
        --network=bridge:kvm-guests,model='e1000',target.dev=vn.$1.0                    \
        --mac=00:16:3e:01:08:$MACO6                                                     \
        --noreboot --vnc --vncport=$VPORT                                               \
        --os-type generic --machine q35                                                 \
        --boot uefi
To create my system, I invoked it with: ./make_vms-3disk uv044 C0 5944

This script is derived from the one I use for building my Linux VMs. After running this, I connected to the console which was running the generic KVM UEFI menus. I accessed the Device Manager section, then the Secure Boot Configuration and disabled "Attempt Secure Boot". I saved the change then used the Reset option and the virtual system powered down. I then restarted and was put directly into the VSI Boot Manager.

Things are working quite nicely, but I have two issues that I need help with: VirtIO SCSI disk devices and console width.

VirtIO SCSI from command line?
---------------------------
The disk devices are presented to the guest VM as SATA devices. They are quite fast, but I would rather use the most efficient IO possible. When I create my Linux VMs, the disk stanzas would have "bus=virtio" added. With this syntax, the devices appear to the guest as vda, vdb, etc. instead of sda, sdb, etc. However, using this setting for the creation of the VMS guest made the disk devices invisible to VMS. That was true of both the install environment and the fully built system.

From the install documentation, it appears that when building the KVM guest using the Virtual Machine Manager GUI, it is possible to get VirtIO SCSI disks. How can I do this from the command line? Alternatively, what does the XML definition of the disk devices look like?

132 Column Hardware Console
--------------------------
The other issue i have is incredibly minor, yet annoying. How can I establish a 132 column width for the hardware console. As the system boots, the system appears to be wrapping at 80 columns and I cannot figure how to lock the console at 132 columns until well into startup.
Last edited by vaxman65 on Mon May 08, 2023 9:47 pm, edited 2 times in total.

User avatar

martin
Valued Contributor
Posts: 70
Joined: Tue Mar 22, 2022 6:47 pm
Reputation: 0
Location: England
Status: Offline

Re: KVM VM config from command line - good and bad

Post by martin » Tue May 09, 2023 12:01 pm

Re your last question:

Code: Select all

$ set term/width=132
works for me.
Martin
  • Retired System Manager: VMS/UNIX/UNICOS/Linux.
  • Started on a VAX 11/782 in 1984 with VMS 3.6.


hb
Valued Contributor
Posts: 63
Joined: Mon May 01, 2023 12:11 pm
Reputation: 0
Status: Offline

Re: KVM VM config from command line - good and bad

Post by hb » Tue May 09, 2023 2:23 pm

Which "console"? What does "stty -a" show? And has an "stty columns 132" an effect?

I use xterm to connect to the host and there I have

Code: Select all

alias w132='echo -e "\e[8;36;132t"'
and after entering w132 I do something like

Code: Select all

virsh console myDomain
Then the UEFI and VMS Boot Manager output is 132 columns wide.

What annoys me is that in the provided UEFI shell the console can only be

Code: Select all

Available modes for console output device.
Col    80 Row    25  *
Col   100 Row    31 
Which seems wrong for the columns but correct for the rows. Who has a terminal with 31 rows? My xterm usually has 36. Even more annoying is that both UEFI and the VMS Boot Manager have a kind of "page mode", so that previous output is overwritten. I haven't figured out how to avoid this. So in the UEFI shell I often use cls, sometime in a pipe command like "cls | map". And NOPAGE in the VMS boot manger does not help where commands like DEVICES clear the screen anyway.


Topic author
vaxman65
Member
Posts: 7
Joined: Wed Apr 28, 2021 9:07 pm
Reputation: 0
Status: Offline

Re: KVM VM config from command line - good and bad

Post by vaxman65 » Tue May 09, 2023 3:00 pm

I would like to see the OpenVMS OPA0: console to operate at 132 columns during system startup BEFORE any logins take place. I am using the ConsoleWorks console management system to capture and monitor all console output (and manage access to the console). I setup socat on the Linux host to provide a listener on a port on the host that is then mapped to the console of the guest, so there is no Linux terminal session involved. The ConsoleWorks instance maintains connection to this and I am off to the races.

Because the OpenVMS system detects the "physical" console device as 80 columns (or assumes it to be), OPCOM messages during boot look like:

Code: Select all

%%%%%%%%%%% OPCOM 9-MAY-2023 03:59:16.87 %%%%%%%%%%%
Message from user INTERnet on PORTER
INTERnet ACP Error during process startup, Nolisten Service Disabled - LBROKER S
erver

Instead of:

Code: Select all

%%%%%%%%%%% OPCOM 9-MAY-2023 03:59:16.87 %%%%%%%%%%%
Message from user INTERnet on PORTER
INTERnet ACP Error during process startup, Nolisten Service Disabled - LBROKER Server

I can fix this after boot with SET TERM /PERM OPA0:. However, I'd rather have this effective from the start of the boot sequence so that I may record the console messages at 132 columns all the way through.

Added in 3 hours 34 minutes 46 seconds:
In reference to my main issue, I am still looking for a KVM specification for the VirtIO SCSI devices presented to the guest. If somebody has a KVM instance running with this working, I'd appreciate it if you could send me a copy of the output from virsh dumpxml as run from the KVM host. Here's what I got for mine (guest is now renamed vv044):

Code: Select all

[psmode@wort ~]$ virsh dumpxml vv044
<domain type='kvm' id='78'>
  <name>vv044</name>
  <uuid>7b7a8970-c8e2-41f1-93e1-6b7e007d8d21</uuid>
  <title>porter (VSI OpenVMS x86)</title>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <vcpu placement='static'>4</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-rhel8.6.0'>hvm</type>
    <loader readonly='yes' secure='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/vv044_VARS.fd</nvram>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <smm state='on'/>
  </features>
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>EPYC-Rome</model>
    <vendor>AMD</vendor>
    <feature policy='require' name='x2apic'/>
    <feature policy='require' name='tsc-deadline'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='stibp'/>
    <feature policy='require' name='arch-capabilities'/>
    <feature policy='require' name='ssbd'/>
    <feature policy='require' name='xsaves'/>
    <feature policy='require' name='cmp_legacy'/>
    <feature policy='require' name='amd-ssbd'/>
    <feature policy='require' name='virt-ssbd'/>
    <feature policy='disable' name='tsc-scale'/>
    <feature policy='disable' name='vmcb-clean'/>
    <feature policy='disable' name='svme-addr-chk'/>
    <feature policy='require' name='rdctl-no'/>
    <feature policy='require' name='skip-l1dfl-vmentry'/>
    <feature policy='require' name='mds-no'/>
    <feature policy='require' name='pschange-mc-no'/>
    <feature policy='disable' name='svm'/>
    <feature policy='require' name='topoext'/>
    <feature policy='disable' name='npt'/>
    <feature policy='disable' name='nrip-save'/>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/>
      <source dev='/dev/T0/vv044-disk0' index='6'/>
      <backingStore/>
      <target dev='sda' bus='sata'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/T0/vv044-disk1' index='5'/>
      <backingStore/>
      <target dev='sdb' bus='sata'/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/T1/vv044-disk2' index='4'/>
      <backingStore/>
      <target dev='sdc' bus='sata'/>
      <alias name='sata0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/T3/vv044-disk3' index='3'/>
      <backingStore/>
      <target dev='sdd' bus='sata'/>
      <alias name='sata0-0-3'/>
      <address type='drive' controller='0' bus='0' target='0' unit='3'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <target dev='sde' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-4'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/repo/OpenVMS/X86E921OE.ISO' index='1'/>
      <backingStore/>
      <target dev='sdf' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-5'/>
      <address type='drive' controller='0' bus='0' target='0' unit='5'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x11'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x12'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='00:16:3e:01:08:c0'/>
      <source bridge='kvm-guests'/>
      <target dev='vn.vv044.0'/>
      <model type='e1000'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/17'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/17'>
      <source path='/dev/pts/17'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5944' autoport='no' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='bochs' vram='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c753,c868</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c753,c868</imagelabel>
  </seclabel>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+107:+107</label>
    <imagelabel>+107:+107</imagelabel>
  </seclabel>
</domain>


sodjan
Active Contributor
Posts: 40
Joined: Mon Apr 24, 2023 3:51 am
Reputation: 0
Status: Offline

Re: KVM VM config from command line - good and bad

Post by sodjan » Wed May 10, 2023 6:11 am

> I would like to see the OpenVMS OPA0: console to operate at 132 columns...

I'm sorry, but I actually never during my 30 years with VMS seen *that* as an issue.

User avatar

martin
Valued Contributor
Posts: 70
Joined: Tue Mar 22, 2022 6:47 pm
Reputation: 0
Location: England
Status: Offline

Re: KVM VM config from command line - good and bad

Post by martin » Wed May 10, 2023 6:41 am

Ah! The good old days when the console was an LA120 or the later DECwriter IV. The distinctive screech followed by the sound of a stack dump as the VAX crashed! Joking aside, hardcopy did make installations and upgrades a doddle, no trying to write down messages as the flashed past your eyes - and all in glorious 132 columns. :-)
Martin
  • Retired System Manager: VMS/UNIX/UNICOS/Linux.
  • Started on a VAX 11/782 in 1984 with VMS 3.6.


Topic author
vaxman65
Member
Posts: 7
Joined: Wed Apr 28, 2021 9:07 pm
Reputation: 0
Status: Offline

Re: KVM VM config from command line - good and bad

Post by vaxman65 » Wed May 10, 2023 10:52 am

Where this sort of thing does become a little more annoying is when using console management systems with text pattern recognition and presentation. Admittedly, this is more of an annoyance than anything, but it can cause trouble now in certain edge cases with some highly automated environments that factor in automated ticketing and alerting systems. It is more of a problem on presentation of the context filling a pattern match, where the number of lines is inconsistent for output that flows naturally at 132 columns vs wrapped at by 80. When certain event definitions will fire, their relay of the context information can be impacted if extra lines are required because of the text wrapping.

This has been around a while though. I don’t remember this 80 column force on any VAX systems through the 7000 series, nor on the early Alphas. However, I seem to recall it showing up at least on Marvel systems, even when connecting to the virtual console through the internal LAN. Not sure if Wildfire had this.

While not a huge issue, this does seems to be an unnecessary annoyance that should be easy enough for the vendor to fix.

Post Reply