Files
vagrant-libvirt/spec/unit/templates/domain_all_settings.xml
Nils Ballmann 63d265d9ca add sysinfo support (#1500)
For testing certain scenarios with vagrant-libvirt, need in the guest system a
value for the systems serial number in the DMI/SMBIOS system information.
The domain https://libvirt.org/formatdomain.html#smbios-system-information
format of libvirt allows to specify those values.

While adding `-smbios type=1,serial=$serial_value` to the `qemuargs` parameter
of the libvirt provider is already able to achieve this, a dedicated provider config
value adds native support from the `Vagrantfile` layering system. For example,
in the .box included Vagrantfile a random serial number can be enforced by
adding the following:

require 'securerandom'
Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.dmi_system_serial = SecureRandom.alphanumeric(8).upcase
  end
end

Then in an instance specific Vagrantfile this value can be overwritten by adding:

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.dmi_system_serial = "ABCDEFGH"
  end
end

Co-authored-by: Nils Ballmann <nils.ballmann.ext@siemens.com>
Co-authored-by: Darragh Bailey <daragh.bailey@gmail.com>
2022-08-16 17:44:11 +01:00

163 lines
5.3 KiB
XML

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name></name>
<title>title</title>
<description>description</description>
<uuid></uuid>
<memory></memory>
<vcpu cpuset='1-4,^3,6'>1</vcpu>
<cpu mode='custom'>
<model fallback='allow'>qemu64</model>
<feature name='AAA' policy='required'/>
<topology sockets='1' cores='3' threads='2'/>
</cpu>
<numatune>
<memory nodeset='1-4,^3,6'/>
</numatune>
<cputune>
<shares>1024</shares>
</cputune>
<os>
<type arch='x86_64' machine='pc-compatible'>hvm</type>
<loader readonly='yes' type='rom'>/efi/loader</loader>
<bootmenu enable='yes'/>
<kernel></kernel>
<initrd></initrd>
<cmdline></cmdline>
<smbios mode='sysinfo'/>
</os>
<sysinfo type='smbios'>
<system>
<entry name='serial'>AAAAAAAA</entry>
</system>
<oemStrings>
<entry>AAAAAAAA</entry>
</oemStrings>
</sysinfo>
<features>
<acpi/>
<apic/>
<pae/>
<hyperv>
<BBB state='on' />
<spinlocks state='on' retries='4096' />
</hyperv>
</features>
<clock offset='variable'>
<timer name='t1'/>
<timer name='t2' track='b' tickpolicy='c' frequency='d' mode='e' present='yes'/>
</clock>
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<disk type='file' device='disk'>
<alias name='ua-box-volume-0'/>
<driver name='qemu' type='qcow2' cache='unsafe' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
<source file='/var/lib/libvirt/images/test.qcow2'/>
<target dev='vda' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-box-volume-1'/>
<driver name='qemu' type='qcow2' cache='unsafe' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
<source file='/var/lib/libvirt/images/test2.qcow2'/>
<target dev='vdb' bus='ide'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-disk-volume-0'/>
<driver name='qemu' type='qcow2' cache='default'/>
<source file='/var/lib/libvirt/images/test-disk1.qcow2'/>
<target dev='vdc' bus='virtio'/>
</disk>
<disk type='file' device='disk'>
<alias name='ua-disk-volume-1'/>
<driver name='qemu' type='qcow2' cache='default' io='threads' copy_on_read='on' discard='unmap' detect_zeroes='on'/>
<source file='/var/lib/libvirt/images/test-disk2.qcow2'/>
<target dev='vdd' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw' />
<source file=''/>
<target dev='hda' bus='ide'/>
<readonly/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw' />
<source file=''/>
<target dev='hdb' bus='ide'/>
<readonly/>
</disk>
<serial type='file'>
<source path='/var/log/vm_consoles/machine.log'/>
<target port='0'/>
</serial>
<console type='file'>
<source path='/var/log/vm_consoles/machine.log'/>
<target port='0'/>
</console>
<channel type='unix' >
<target type='virtio' name='org.qemu.guest_agent.0'/>
</channel>
<channel type='spicevmc' >
<target type='virtio' name='com.redhat.spice.0'/>
</channel>
<channel type='unix' >
<source path='/tmp/foo'/>
<target type='guestfwd' address='192.0.2.42' port='4242'/>
</channel>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
<gl enable='yes'/>
</graphics>
<video>
<model type='cirrus' vram='16384' heads='1'>
<acceleration accel3d='yes'/>
</model>
</video>
<rng model='virtio'>
<backend model='random'>/dev/random</backend>
</rng>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x06' slot='0x12' function='0x5'/>
</source>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0001' bus='0x03' slot='0x00' function='0x0'/>
</source>
</hostdev>
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0002' bus='0x04' slot='0x00' function='0x0'/>
</source>
<address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
</hostdev>
<hostdev mode='subsystem' type='usb'>
<source startupPolicy='mandatory'>
<vendor id='0x1234'/>
<product id='0xabcd'/>
<address bus='1' device='2'/>
</source>
</hostdev>
<redirdev bus='usb' type='tcp'>
</redirdev>
<redirfilter>
<usbdev class='0x0b' vendor='0x08e6' product='0x3437' version='2.00' allow='yes'/>
</redirfilter>
<watchdog model='i6300esb' action='reset'/>
<smartcard mode='passthrough' type='spicevmc'/>
<tpm model='tpm-tis'>
<backend type='passthrough'>
<device path='/dev/tpm0'/>
</backend>
</tpm>
<controller type='usb' model='nec-xhci' ports="4" />
</devices>
<qemu:commandline>
<qemu:arg value='-device'/>
<qemu:arg value='dummy-device'/>
<qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
<qemu:env name='QEMU_AUDIO_TIMER_PERIOD' value='150'/>
<qemu:env name='QEMU_PA_SAMPLES' value='1024'/>
<qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/>
</qemu:commandline>
</domain>