272 Commits
Author SHA1 Message Date
Pavel Hrdina bac5379d08 tests: Fix virt-install-iommufd
Regenerate output XML to fix boot order.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2026-09-04 18:57:00 +02:00
Pavel Hrdina 89d3c944df tests: Fix virt-install-aarch64-nested-smmuv3
Review of libvirt patches changes ssidSize to ssidsize but I missed
before merging the test case. Regenerate XML output to fix the expected
XML.

Reported-by: Cole Robinson <crobinso@redhat.com>
Fixes: b0024e3de4
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2026-09-04 18:57:00 +02:00
Nathan Chen ffffd35518 tests: Separate acpi nodeset test out of many-devices
Separate acpi nodeset test out of many-devices test to avoid Libvirt
version mismatch. Gate acpi nodeset test behind Libvirt 11.8.0.

Fixes: 53df7b496b ("virtinst: add support for acpi-generic-initiator")
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
2026-09-02 20:36:40 +02:00
Nathan Chen ae257955e3 tests: Separate iommufd test out of many-devices
Separate iommufd test out of many-devices test to avoid Libvirt
version mismatch. Gate iommufd test behind Libvirt 12.1.0.

Fixes: 9ab2918fac ("virtinst: add support for iommufd")
Signed-off-by: Nathan Chen <nathanc@nvidia.com>
2026-09-02 20:23:37 +02:00
Nathan Chen b0024e3de4 virtinst: add support for multi user-creatable accel SMMUv3
A minimal config to specify multiple user-creatable SMMUv3 IOMMUs
with HW-accelerated SMMUv3 features specified would be

 $ virt-install
     ...args...
     --iommu model=smmuv3,driver.pciBus=0,driver.accel=on,driver.ats=on,driver.ril=on,driver.ssidsize=20,driver.oas=48
     --iommu model=smmuv3,driver.pciBus=1,driver.accel=on,driver.ats=on,driver.ril=on,driver.ssidsize=20,driver.oas=48

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
2026-09-02 20:13:37 +02:00
Cole Robinson 19f18e9f55 cli: add --boot firmware.enrolled-keys=,firmware.secure-boot=
These are convenience options for just setting the XML features.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-25 09:44:04 -05:00
Cole Robinson 23d6f9088f tests: cli: fix aarch64-win11 with latest osinfo-db
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2026-02-19 11:12:20 -05:00
Pavel Hrdina 23dd48ae94 cli: add --boot secure-boot option
The new option can be used to enable/disable secure boot verification
of UEFI firmware.

If virt-xml is used to change secure-boot print warning that resetting
NVRAM is required to make the change effective.

Fixes: https://github.com/virt-manager/virt-manager/issues/495
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2026-02-06 17:06:41 +01:00
Nathan Chen 9ab2918fac virtinst: add support for iommufd
A minimal config to enable iommufd would be

 $ virt-install
     ...args...
     --host-device 0x062a:0x0001,driver.iommufd=yes

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
2026-02-03 07:17:03 +01:00
6543 6f1adcc925 virtinst: Add serial controller option to cli 2026-01-11 18:36:09 +01:00
Pavel Hrdina a2baaf789c installer: add support to use device boot order
Until now installer always used legacy boot order when creating VM XML.
Device boot order is supported for long time so start using it if
possible instead of the legacy boot order.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2025-12-04 16:55:51 +01:00
Nathan Chen 411f019f81 virtinst: add support for pcihole64
A minimal config to specify high MMIO region size would be

$ virt-install
  ...args...
  --controller pci,index=0,model=pcie-root,pcihole64=4294967296,pcihole64.unit=KiB

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
2025-11-21 10:47:37 +01:00
Nathan Chen 53df7b496b virtinst: add support for acpi-generic-initiator
A minimal config to enable acpi-generic-initiator would be

 $ virt-install
     ...args...
     --hostdev net_00_1c_25_10_b1_e4,acpi.nodeset=0,2-4

Signed-off-by: Nathan Chen <nathanc@nvidia.com>
2025-11-21 10:43:04 +01:00
Pavel Hrdina d57e2e738f virtinst: interface: add support for backend.hostname and backend.fqdn
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2025-11-21 10:18:56 +01:00
Lin Ma 52752d1bf2 virt-install: Add source.startupPolicy for USB passed through devices
When the attribute startupPolicy set for a USB passed through devices
allows such device to be missing.

The attribute accepts the following values:
* mandatory: fail if missing for any reason (the default)
* requisite: fail if missing on boot up, drop if missing on
             migrate/restore/revert
* optional:  drop if missing at any start attempt

eg:
root@localhost:~ # virt-install \
...... \
--hostdev 0x0781:0x5567,source.startupPolicy=optional

It results in the following domain XML snippet:

    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source startupPolicy='optional'>
        <vendor id='0x0781'/>
        <product id='0x5567'/>
        <address bus='2' device='5'/>
      </source>
      <alias name='hostdev0'/>
      <address type='usb' bus='0' port='1'/>
    </hostdev>

Signed-off-by: Lin Ma <lma@suse.de>
2025-08-25 19:43:44 +02:00
Akihiko Odaki 9bf51435da virtinst: Do not assume virtio is supported on Arm virt
Micorosft Windows 11 supports the Arm64 virt machine but does not
support virtio so choose something else if virtio is not supported by
the specified OS.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2025-08-21 18:14:22 +02:00
Akihiko Odaki dfcab03dc0 tests: Add virt-install-aarch64-win11
Please note that this is preliminary and some issues remain described
below:

The installation will not start because USB cdrom is not emulated as a
cdrom due to a bug in libvirt:
https://gitlab.com/libvirt/libvirt/-/issues/368

Pass bare QEMU command lines as a workaround.

Audio and TPM do not work because libosinfo cannot tell if an OS
supports devices on a particular architecture:
https://gitlab.com/libosinfo/libosinfo/-/issues/55

In reality, Windows on Arm64 lacks the ich9 driver and TPM fails,
spamming the Windows system logs. As a workaround, manually specify usb
for audio and drop the TPM.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
2025-08-21 18:14:22 +02:00
Daniel P. Berrangé 1ead880b2e virtinst: add support for creating TDX guests
A minimal config to enable TDX, with support for attestation
would be

 $ virt-install
     ...args...
     --boot uefi \
     --machine q35 \
     --launchSecurity type=tdx,quoteGenerationService=on

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2025-07-28 15:12:08 +02:00
Pavel Hrdina f901c32777 tests: add checks for cloud-init config files from URL
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2025-04-28 12:44:46 +02:00
Joren 297d1cd282 Separate virtio sound device testing into an individual test 2025-03-22 14:14:46 +01:00
Joren e5142f28fe virt-install: add support for vDPA network device 2025-03-18 20:34:22 +01:00
Marius Vollmer 92e90e6e27 xmlapi: Don't escape property values
libxml2 does that already.

Fixes #838
2025-03-05 19:20:15 +01:00
Akihiko Odaki fb54f37b60 tests: Increase virtio-mem block size
virtio-mem block size must be equal to or greater than the transparent
huge page size; otherwise, libvirt raises an error and a test will
fail. For example, on Asahi Linux, the transparent huge page size is 32
MiB, which is greater than 2 MiB, the specified virtio-mem block size.

On Linux 6.13, the configuration with the maximum transparent huge page
size is Arm64 with 64 KiB, and it has 512 MiB transparent huge pages.
Increase the block size to 512 MiB so that the test passes on every
Linux configuration.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
2025-03-03 12:19:33 -05:00
Lin Ma 6c43ab3863 tests: add pstore test
Signed-off-by: Lin Ma <lma@suse.de>
2025-03-03 12:01:09 -05:00
Lin Ma 9ef77c1892 tests: skip some hyperv feature tests for libvirt older than 10.7.0/11.0.0
Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma 81c873ba36 cli: Add --features hyperv.tlbflush.extended.state=on/off
Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma 5f2a2dbd0a cli: Add --features hyperv.tlbflush.direct.state=on/off
Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma 1f43c0d1d9 cli: Add --features hyperv.emsr_bitmap.state=on/off
Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma 5617330513 cli: Add --features hyperv.xmm_input.state=on/off
Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma dc89a02c75 cli: Add nvram.templateFormat to indicate template format
Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma f278c89b49 cli: Add --tpm backend.profile.{source,removeDisabled} support
Swtpm since v0.10 supports to configure a TPM2 with a profile from file.
eg:

root@localhost:~ # cat /etc/swtpm/profiles/mytest.json
{
      "Name": "custom:test",
      "Algorithms":"rsa,rsa-min-size=1024,......"
}

root@localhost:~ # swtpm_setup --tpm2 --print-profiles | jq
{
  "local": [
    {
      "Name": "mytest",
      "Algorithms": "rsa,rsa-min-size=1024,......"
    }
  ],
  "builtin": [
    {
      "Name": "default-v1",
      "StateFormatLevel": 7,
      "Commands": "......",
      "Algorithms": "rsa,rsa-min-size=1024,......",
      "Description": "......"
    },
    {
      "Name": "null",
      "StateFormatLevel": 1,
      "Commands": "......",
      "Algorithms": "rsa,rsa-min-size=1024,......",
      "Description": "......"
    },
    {
      "Name": "custom",
      "StateFormatLevel": 2,
      "Commands": "......",
      "Algorithms": "rsa,rsa-min-size=1024,......",
      "Description": "......"
    }
  ]
}

Libvirt supports it since v10.10.0

Let's add this feature into virt-install, eg:

root@localhost:~ # virt-install \
......\
--tpm model=tpm-tis,backend.version=2.0,\
backend.profile.source=local:mytest,backend.profile.removeDisabled=check

Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:48:57 +01:00
Lin Ma a7c455f460 cli: Add 'poll' settings for iothread
Since libvirt v9.4.0, It introduces 'poll' settings in domain XML to
override the hypervisor-default interval of polling for iothread.

Let's add it into virt-install.
Eg:
virt-install \
...... \
--iothreads iothreads=2,\
iothreadids.iothread0.id=1,\
iothreadids.iothread1.id=2,\
iothreadids.iothread1.poll.max=123,\
iothreadids.iothread1.poll.grow=456,\
iothreadids.iothread1.poll.shrink=789

It results in the following domain XML snippet:
  <iothreads>2</iothreads>
  <iothreadids>
    <iothread id='1'/>
    <iothread id='2'>
      <poll max='123' grow='456' shrink='789'/>
    </iothread>
  </iothreadids>

Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:25:37 +01:00
Lin Ma 36d00e0e79 cli: Add --disk driver.queue_size support
Eg:
virt-install \
......
--disk /tmp/disk0.qcow2,size=10,driver.type=qcow2,\
driver.queues=4,driver.queue_size=256 \
......

It results in the following domain XML snippet:
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' queues='4' queue_size='256'/>
      <source file='/tmp/disk0.qcow2' index='2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>

Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:25:37 +01:00
Lin Ma 79c333e364 cli: add target.memReserve for pci-bridge and pcie-root-port controllers
Libvirt(since v10.3.0) supports setting memReserve attribute to pci-bridge
and pcie-root-port, Let's add it into virt-install. Eg:

virt-install \
......
--controller pci,index=0,model=pcie-root \
--controller pci,index=1,model=pcie-root-port,target.memReserve=8196 \
--controller pci,index=2,model=dmi-to-pci-bridge \
--controller pci,index=3,model=pci-bridge,target.memReserve=8196 \
......

It results in the following domain XML snippet:
    <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' memReserve='8196'/>
      <alias name='pci.1'/>
      <address type='pci' ....../>
    </controller>
    <controller type='pci' index='2' model='dmi-to-pci-bridge'>
      <model name='i82801b11-bridge'/>
      <alias name='pci.2'/>
      <address type='pci' ....../>
    </controller>
    <controller type='pci' index='3' model='pci-bridge'>
      <model name='pci-bridge'/>
      <target chassisNr='3' memReserve='8196'/>
      <alias name='pci.3'/>
      <address type='pci' ....../>
    </controller>

Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:25:37 +01:00
Lin Ma 8564ace73a cli: Add --memdev target.dynamicMemslots support for virtio-mem
Libvirt supports setting dynamicMemslots attribute for virtio-mem since
v10.1.0, Let's add it into virt-install. Eg:

virt-install \
......
--vcpu 2 \
--cpu cell0.cpus=0,cell0.memory=4194304,\
cell1.cpus=1,cell1.memory=4194304 \
--memory maxMemory=65536,maxMemory.slots=8 \
--memdev model=virtio-mem,\
target.node=0,\
target.block=2048,\
target.size=8192,\
target.dynamicMemslots=yes \
......

It results in the following domain XML snippet:
    <memory model='virtio-mem'>
      <target dynamicMemslots='yes'>
        ......
    </memory>

Signed-off-by: Lin Ma <lma@suse.de>
2025-01-29 10:25:37 +01:00
Andrea Bolognani 8af438dd58 cpu: Prefer maximum mode for many emulated guests
The actual default CPU at the QEMU level is often a relatively
poor choice, which is stuck with just baseline functionality
and can sometimes not run modern guests at all.

Whenever possible, prefer maximum mode for a much nicer out of
the box experience.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-12-10 14:01:32 +01:00
Andrea Bolognani fca41cfaa9 cli: Support --cpu maximum
This mode has been introduced in libvirt 7.1.0 (March 2021) and
can be already used today with

  --cpu mode=maximum

This is however slightly inconvenient to type and is not
consistent with the special treatment that the other modes
(host-passthrough, host-model) get.

Introduce a proper special mode for it.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2024-12-10 14:01:32 +01:00
Cole Robinson 17f171cdb7 cli: add --network passt,portForward=8080:80 convenience syntax
Roughly mirroring `podman run -p` syntax. Examples:

--network passt,portForward=8080:80
--network passt,portForward0=7000-8000/udp,portForward1=127.0.0.1:2222:22

Resolves: https://github.com/virt-manager/virt-manager/issues/751

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:59:44 +01:00
Cole Robinson 2f8f0e8151 virt-xml: implement --edit --boot uefi=off
Disable all UEFI config bits for an existing VM

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:51:24 +01:00
Cole Robinson cfcd63b74e virt-install: implement --boot uefi=off
Tells virt-install to not use UEFI, if it would normally default
to it.

This likely isn't too useful in practice, since all occasions we
default to UEFI require it. But it future proofs opt out in case
we ever start defaulting to UEFI in cases where BIOS still works.

Resolves: https://github.com/virt-manager/virt-manager/issues/692

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-21 21:51:24 +01:00
Cole Robinson f3aa24bd5d virt-install: use default --cpu mode more often
Currently we will only apply the default `--cpu mode=host-passthrough`
config when _no_ `--cpu` config is passed. But this means if a user
configures ex. cpu `<topology>`, we don't set `host-passthrough` and
they get the libvirt/qemu default baseline CPU.

Instead, only skip the default config if the user manually
specified a `mode` or `model` value directly

https://issues.redhat.com/browse/RHEL-65371

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:21:25 +01:00
Cole Robinson 8fb78739e7 virt-clone: try harder to allow nonexisting images with --preserve
Input XML can have non-existent disk images as long as `--preserve`
is used, or those disks are skipped for any reason. We already
handle that correctly in some cases, but others we fail. This
covers another one.

Resolves: https://github.com/virt-manager/virt-manager/issues/563

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:19:25 +01:00
Cole Robinson 8eb87af411 cloner: Handle .qcow2 nvram extension
We were hardcoding .fd extension, but it can be different nowadays

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 21:19:25 +01:00
Cole Robinson 2835c250c7 virt-install: support --input none
Disables adding any default input devices

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 19:41:19 +01:00
Cole Robinson c78ec96933 virt-install: let libvirt handle --input bus=default
Our logic here is poorly duplicating libvirt's postparse logic.
Notably it will try to add bus=ps2 on non-x86, and misses obscure
cases like parallels.

https://issues.redhat.com/browse/RHEL-66768

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2024-11-19 19:41:19 +01:00
Lin Ma 301423b83a virt-install: Fix the active_pcr_banks issue for TPM emulator
The commit 6baa327d added active_pcr_banks support, but put it under the child
element <tpm>, which is wrong, It should be under sub child element <backend>.

Before:
  --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,\
      active_pcr_banks.sha1=on,\
	  active_pcr_banks.sha256=yes,\
	  active_pcr_banks.sha384=yes,\
	  active_pcr_banks.sha512=yes

  It results in the following domain xml:
    <tpm model='tpm-tis'>
      <backend type='emulator' version='2.0'/>
      <alias name='tpm0'/>
    </tpm>

After:
  --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,\
      backend.active_pcr_banks.sha1=on,\
	  backend.active_pcr_banks.sha256=yes,\
	  backend.active_pcr_banks.sha384=yes,\
	  backend.active_pcr_banks.sha512=yes

  It results in the following domain xml:
    <tpm model='tpm-tis'>
      <backend type='emulator' version='2.0'>
        <active_pcr_banks>
          <sha1/>
          <sha256/>
          <sha384/>
          <sha512/>
        </active_pcr_banks>
      </backend>
      <alias name='tpm0'/>
    </tpm>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma fd48e0be57 virt-install: Add --tpm backend.source support
E.g.
    virt-install \
    ... \
    --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,\
          backend.source.type=dir,backend.source.path=/some/dir

  It results in the following domain xml:
  <backend type="emulator" version="2.0">
    <source type="dir" path="/some/dir"/>
  </backend>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma 7e4f7ae3d8 virt-install: Add support for 'debug' parameter on TPM emulator
E.g.
    virt-install \
    ... \
    --tpm model=tpm-tis,backend.type=emulator,backend.version=2.0,backend.debug=3

  It results in the following domain xml:
  <tpm model="tpm-tis">
    <backend type="emulator" version="2.0" debug="3"/>
  </tpm>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma 1219030319 virt-install: Add support for streams attribute for 'virtio' sound card
E.g.
    virt-install \
    ... \
    --sound model=virtio,streams=4

  It results in the following domain xml:
  <sound model="virtio" streams="4"/>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00
Lin Ma e883e7d525 virt-install: Add support for multi-channel mode for 'usb' sound card
E.g.
    virt-install \
    ... \
    --sound model=usb,multichannel=yes

  It results in the following domain xml:
  <sound model="usb" multichannel="yes"/>

Signed-off-by: Lin Ma <lma@suse.de>
2024-11-13 11:29:09 +01:00