KVM(7) Standards, Environments, and Macros KVM(7)

kvmzone brand for running a virtual machine instance under the KVM hypervisor

A kvm branded zone uses the brands(7) framework to provide an environment for running a virtual machine under the KVM hypervisor.

kvm zones are configured mostly via custom attributes in the zone configuration.

Supported attributes are:

path[,serial=serial]

Specifies a ZFS volume dataset name which will be attached to the guest as the boot disk. Additional disks can be specified using the disk attribute, see below.

If the optional serial number is not provided, one will be automatically generated from the disk index. The ZFS volume must also be mapped into the zone using a device block as shown in the example below.

A suitable ZFS volume can be created using the ‘zfs create -V’ command, for example:

zfs create -V 30G rpool/bootdisk2
[N] path

Specifies the path to one or more CD/DVD image (.iso) files that will be inserted into virtual CD/DVD drive(s) in the guest. To specify multiple image files, create multiple attributes with different values of N, starting with 0. If only a single CD image is required, N can be omitted.

Each image file must also be mapped into the zone using an block, as shown in the example below.

options

This parameter configures where the guest's console device is presented. The default value is pipe,id=console0,path=/dev/zconsole which means that the guest's console can be accessed via:

zlogin -C <zone>
[N] dataset[,serial=serial]

Specifies one or more ZFS volume dataset names which will be attached to the guest as disks. To attach multiple disks, create multiple attributes with different values of N. In that case, the disk will be presented on target N. If only a single disk is required, N can be omitted. The disks specified via the disk attribute are in addition to the system boot disk, which is specified using bootdisk.

If the optional serial number is not provided, one will be automatically generated from the disk index. Each ZFS volume must also be mapped into the zone using a device block as shown in the example below.

type

Specifies the type of interface to which the disks will be attached. Available options are:

type

Specifies the type of network interface that will be used for the interfaces presented to the guest. Available options are:

size[KMGT]

Specify the guest's physical memory size. The size argument may be suffixed with one of K, M, G or T to indicate a multiple of kibibytes, mebibytes, gibibytes or tebibytes. If no suffix is given, the value is assumed to be in mebibytes.

The default value, if this attribute is not specified, is .

[N]

Any extra options to be passed directly to the kvm hypervisor. To add multiple options, create multiple attriutes with different values of N. If only a single extra option is required, N can be omitted.

type

Specifies the type of the virtual machine. This needs to be set for some guest operating systems so that things are set up as they expect. For most guests, this can be left unset. Supported values are:

number

Specify the number of guest virtual CPUs. The default value is .

on|off|options

This parameter controls whether a virtual frambuffer is attached to the guest and made available via VNC. Available options are:

An alias for which creates the VNC socket within /tmp inside the zone.
Disable the framebuffer. This is the same as omitting the vnc attribute.
:path
Sets up a VNC server on a UNIX socket at the specified path. Note that this path is relative to the zone root.

An example kvm zone is shown below:

create -t kvm
set zonepath=/zones/kvm
add net
    set allowed-address=10.0.0.112/24
    set physical=vm0
end
add device
    set match=/dev/zvol/rdsk/rpool/kvm0
end
add attr
    set name=ram
    set type=string
    set value=2G
end
add attr
    set name=vcpus
    set type=string
    set value=8
end
add attr
    set name=bootdisk
    set type=string
    set value=rpool/kvm0
end
add fs
    set dir=/rpool/iso/debian-9.4.0-amd64-netinst.iso
    set special=/rpool/iso/debian-9.4.0-amd64-netinst.iso
    set type=lofs
    add options ro
    add options nodevices
end
add attr
    set name=cdrom
    set type=string
    set value=/rpool/iso/debian-9.4.0-amd64-netinst.iso
end

mdb(1), proc(1), brands(7), privileges(7), resource_controls(7), zones(7), dtrace(8), zfs(8), zoneadm(8), zonecfg(8)

June 3, 2023 OmniOS