qemu-init

A virtual machine manager to make life with qemu more comfortable

User Tools

Site Tools


Overview: files
Advanced configuration (cfg-file)        man page of qemu-init(5)


Basic configuration (rc-file)

The rc-file is required by each virtual machine handled by qemu-init. The format is  KEY=VALUE . It will be read line sequential by qemud-cfg, lines starting with a '#\ ' will be ignored. If a value is empty or 0 (zero), the key will not be set. Exception: the keys NAME and TGTARCH MUST contain a valid value. There are a lot of comments and instructions for the keys in the rc-file itself.

The following table gives an overview and additional information1).

Key Severity Description
Section 1: NAME is the interface between qemu-init and qemu
NAME required Set the <name> of the guest and the qemu option  -name  a)
DESC optional optional, used by qemu-init for informational purposes only (extends NAME)
Section 2: core settings for qemu
TGTARCH required Set the target arch binary for qemu (default:  qemu-system-x86_64 ) b)
RUNAS optional Define a different user than SYSUSR to be used with qemu's option  -runas  (default: empty)
DAEMON recommended Run in daemon mode, does set qemu's option  -daemonize  (default: true c))
KVM recommended Set the qemu option  -enable-kvm  (default: true c))
MONITOR optional Define the ip address family for tcp monitor redirection (default: empty, let the system take the choice)
Section 3: options to control qemu-init
BOOTDELAY optional Define timeout in seconds before the virtual machine starts - takes effect with “autostart” only
STOPDELAY optional Define timeout in seconds qemu-init will wait for shutdown of <name> (default: empty, lower values than 40 will be ignored)
PRECMD optional A command\ *) which will be executed before the virtual machine starts
POSTCMD optional A command\ *) which will be executed after the virtual machine was started
Section 4: mainboard style qemu options
RAM recommended Define the size of RAM (default: 2GB), set via qemu's option  -m 
DISPLAY recommended Set the qemu option  -display vnc:=<port> , commonly for administrative purposes (default, the <port> will be calculated)
VNCKEYB optional Set a keyboard layout for vnc via qemu's option  -k , takes effect with  DISPLAY=“vnc”  only
Section 5: default built-in hardware d)
DSK recommended Use a harddisk with  -drive file=<name>-sda.img,snapshot=off 
CDR recommended Create a CD-drive with qemu's option  -drive media=cdrom,file=<VALUE> ; if <VALUE> is invalid, the drive is empty.
NIC recommended Define a qemu network driver to create a tap device for bridged networking (default: virtio-net-pci)\ *)

a)\ the qemu option  -name  should not be used elsewhere
b)\ if this differs from the host architecture, the qemu option  -cpu  have to be set in cfg-file accordingly
c)\ boolean variable: if not true it defaults to false; values to be true are: 1, on, y, yes (case insensitive)
d)\ key names in this section could be used multiple times, each key creates one device (DSK values couldn't be used twice)

qemu-init does set some qemu options2) automatically. Some depend on other keys of the rc-file, some are build-in defaults. If any of these qemu options appears in the cfg-file, it will not be used:

  • the cpu will be set to  -cpu host  by
  • boot parameters are  -boot order=dc,menu=off -no-fd-bootchk 
  • a mouse will be created automatically with  -usb -device usb-tablet  if DISPLAY=“vnc”

Some more info to elected keys:

PRECMD / POSTCMD

Both keys works in the same way (simply replace pre by post). Single commands have to be quoted properly :

PRECMD="cp /usr/local/lib/ovmf-x64/OVMF_VARS-pure-efi.fd /tmp/my_vars.fd"

Multiple commands can be put in a batch file, one per line. A batch file does not require to have the executable bit set. It have to be defined with an absolute path is required:

PRECMD=/path/to/<name>-pre.cmd

Batch files could be shared between multiple guests. If a batch file belongs to a dedicated virtual machine only, it should be called  <name>-pre.cmd  (recommened).

NIC's

All NIC's defined in the rc-file will be handled as tap devices (for bridged networking). The host bridge device have to exist, and

  • the default name of the bridge device is br0 on linux and bridge0 on (Free)BSD
  • the number of NIC's is limited to 100 per guest ;-)
  • qemu-init does calculate a unique mac address for all NIC's interfaces (prefix is always  DE:BE )

The qemu parameter to create a NIC is like:

-device virtio-net-pci,netdev=net0,mac=DE:AD:BE:EF:37:36
-netdev tap,id=net0,script=/usr/local/lib/qemud-br0

The driver  virtio-net-pci  comes from the rc-file.  net0  will be increased by 1 for each NIC,  script=  is not set on (Free)BSD.

1)
reference: rc-file template version 0.66
2)
some options are cumulative, others not