Commit Graph

43750 Commits

Author SHA1 Message Date
Peter Krempa
7ac265bcd4 qemuBuildControllerDevStr: Split out formatting of SCSI controller
Move the code into a new function called qemuBuildControllerSCSIDevStr
so that the code is self contained and the original function easier to
follow.

This patch also moves the formatting of the properties relevant only for
the 'virtio-scsi' controller to the specific case so it's more clear
where they belong to.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
49f199f3fd qemu: command: Remove unused qemuBuildRomStr
Now that all users were converted to qemuBuildRomProps we can remove the
old code and un-mark qemuBuildRomProps as unused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
e840ed6f3d qemuBuildNicDevProps: Move formatting of bootindex
Move the bootindex before the address so that the code is simpler.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:05 +02:00
Peter Krempa
ee996fbf7a qemuBuildInterfaceCommandLine: Generate via JSON
virtio-net-pci specific properties and their types according to QEMU:
  tx=<str>
  ioeventfd=<bool>       - on/off (default: true)
  event_idx=<bool>       - on/off (default: true)
  csum=<bool>            - on/off (default: true)
  gso=<bool>             - on/off (default: true)
  host_tso4=<bool>       - on/off (default: true)
  host_tso6=<bool>       - on/off (default: true)
  host_ecn=<bool>        - on/off (default: true)
  host_ufo=<bool>        - on/off (default: true)
  mrg_rxbuf=<bool>       - on/off (default: true)
  guest_csum=<bool>      - on/off (default: true)
  guest_tso4=<bool>      - on/off (default: true)
  guest_tso6=<bool>      - on/off (default: true)
  guest_ecn=<bool>       - on/off (default: true)
  guest_ufo=<bool>       - on/off (default: true)
  mq=<bool>              - on/off (default: false)
  vectors=<uint32>       -  (default: 4294967295)
  rx_queue_size=<uint16> -  (default: 256)
  tx_queue_size=<uint16> -  (default: 256)
  host_mtu=<uint16>      -  (default: 0)
  failover=<bool>        -  (default: false)

properties common for all network interfaces:
  netdev=<str>           - ID of a netdev to use as a backend
  mac=<str>              - Ethernet 6-byte MAC Address, example: 52:54:00:12:34:56
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
dc481f11a6 qemuBuildDiskCommandLine: Generate via JSON
The types for the special fields of the 'virtio-blk-pci' according to
QEMU are:
  iothread=<link<iothread>>
  ioeventfd=<bool>       - on/off (default: true)
  event_idx=<bool>       - on/off (default: true)
  scsi=<bool>            - on/off (default: false)
  num-queues=<uint16>    -  (default: 65535)
  queue-size=<uint16>    -  (default: 256)

For all disks we also use the following properties (based on 'scsi-hd'):
  device_id=<str>
  share-rw=<bool>        -  (default: false)
  drive=<str>            - Node name or ID of a block device to use as a backend
  chardev=<str>          - ID of a chardev to use as a backend  <-  vhost-user-blk-pci
  bootindex=<int32>
  logical_block_size=<size> - A power of two between 512 B and 2 MiB (default: 0)
  physical_block_size=<size> - A power of two between 512 B and 2 MiB (default: 0)
  wwn=<uint64>           -  (default: 0)
  rotation_rate=<uint16> -  (default: 0)
  vendor=<str>
  product=<str>
  removable=<bool>       - on/off (default: false)
  write-cache=<OnOffAuto> - on/off/auto (default: "auto")
  cyls=<uint32>          -  (default: 0)
  heads=<uint32>         -  (default: 0)
  secs=<uint32>          -  (default: 0)
  bios-chs-trans=<BiosAtaTranslation> - Logical CHS translation algorithm, auto/none/lba/large/rechs (default: "auto") <- ide-hd
  serial=<str>
  werror=<BlockdevOnError> - Error handling policy, report/ignore/enospc/stop/auto (default: "auto")
  rerror=<BlockdevOnError> - Error handling policy, report/ignore/enospc/stop/auto (default: "auto")

The 'wwn' field is changed from a hex string to a number since qemu
actually treats it as a number.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
d06e3000c4 qemuBuildDiskFrontendAttributeErrorPolicy: Extract logic
Extract the logic to determine the actual settings into
'qemuBuildDiskGetErrorPolicy' so that it can be reused when we'll
convert the disk -device formatter to JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
9616976433 qemu: capabilities: Retire QEMU_CAPS_VIRTIO_(BLK|NET)_EVENT_IDX
Both are assumed as always present since last commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
ea0f408474 qemu: Always assume presence of QEMU_CAPS_VIRTIO_(BLK|NET)_EVENT_IDX
The 'event_idx' option for virtio devices was introduced by QEMU commit
bcbabae8f which is contained in v0.15.0-rc0 and can't be compiled out,
thus we don't need to conditionally enable it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
bc5c57ad7e qemu: capabilities: Retire QEMU_CAPS_VIRTIO_IOEVENTFD
It's not used since last commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
756ce0e50c qemuBuildIoEventFdStr: Always assume support for QEMU_CAPS_VIRTIO_IOEVENTFD
The support for the 'ioeventfd' knob of virtio devices was introduced by
QEMU commit 25db9ebe15125 contained in v0.14.0-rc0 and it can't be
compiled out. Thus libvirt can assume it's support and remove
conditional code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
6c3a85648c qemuBuildSCSIHostdevDevProps: Reorder 'drive','id' and 'bootindex' after address
Simplify the generator by shuffling around few fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
82d499c6c0 qemuBuildHostdevSCSICommandLine: Generate via JSON
Since 'qemuBuildDeviceAddressProps' now also builds 'drive' addresses
the generator is way simpler and doesn't use any special fields.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
03ed14d2d4 qemu: validate: Move disk address validation code
Move the code from 'qemuValidateDomainDeviceDefDiskFrontend' into
'qemuValidateDomainDeviceDefAddressDrive' which is called from
'qemuValidateDomainDeviceDefAddress' so that we have all address
validation code together.

This also allows us to remove the inline validation inside
'qemuBuildSCSIHostdevDevStr'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
3210c8b047 qemuBuildDeviceAddressProps: Format also 'drive' addresses
Introduce infrastructure to format 'drive' addresses via the standard
helper rather than hand-rolled generators used inline.

The code needs to know the disk bus to format the correct address which
is passed in via an internal field in virDomainDeviceDriveAddress.

The field types according to QEMU are as following:

'ide-hd' for VIR_DOMAIN_DISK_BUS_IDE and VIR_DOMAIN_DISK_BUS_SATA
  unit=<uint32>          -  (default: 4294967295)

'floppy' for VIR_DOMAIN_DISK_BUS_FDC
  unit=<uint32>          -  (default: 4294967295)

'scsi-hd' for VIR_DOMAIN_DISK_BUS_SCSI
  channel=<uint32>       -  (default: 0)
  scsi-id=<uint32>       -  (default: 4294967295)
  lun=<uint32>           -  (default: 4294967295)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
2e4bc16370 qemuBuildPCIHostdevDevProps: Move 'failover_pair_id' property before address
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:04 +02:00
Peter Krempa
fcf96b11ba qemuBuildHostdevCommandLine: Format PCI host devices via JSON
For properties we use these are the QEMU types:
  host=<str>             - Address (bus/device/function) of the host device, example: 04:10.0
  bootindex=<int32>
  failover_pair_id=<str>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
c3b1bd723e qemuCommandAddExtDevice: Generate via JSON
Generate the 'zpci' device via JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
478725b7c3 qemuBuildInputCommandLine: Generate via JSON
For 'usb-mouse'/'usb-tablet'/'usb-kbd' we don't use any special
property.

For 'virtio-input-pci' we only use the 'evdev' argument which is a
string so this conversion doesn't impact anything.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
31e509ad39 qemuBuildRedirdevCommandLine: Generate via JSON
The 'usb-redir' device has the following types according to QEMU for
properties we control:

  chardev=<str>          - ID of a chardev to use as a backend
  filter=<str>
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
1cbfe4385c qemuBuildHostdevMediatedDevProps: Format USB host devices via JSON
The 'usb-host' device has the following types according to QEMU for
properties we control:

  hostdevice=<str>
  hostbus=<uint32>       -  (default: 0)
  hostaddr=<uint32>      -  (default: 0)
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
9ac81c58d3 qemuBuildHostdevMediatedDevProps: Move 'ramfb' and 'bootindex' before the address
Simplify the generator by moving few properties earlier.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
73c352ab8c qemuBuildHostdevCommandLine: Build mediated device commandline via JSON
The 'vfio-pci-nohotplug' device has the following property types
according to QEMU:

  display=<OnOffAuto>    - on/off/auto (default: "off")
  sysfsdev=<str>
  ramfb=<bool>
  bootindex=<int32>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
172f64bb81 qemuBuildRNGCommandLine: Generate via JSON
The 'virtio-rng' has the following property types according to QEMU:
  rng=<link<rng-backend>>
  max-bytes=<uint64>     -  (default: 9223372036854775807)
  period=<uint32>        -  (default: 65536)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
c234430b73 qemuBuildMemballoonCommandLine: Reorder properties
Move the 'deflate-on-oom' and 'free-page-reporting' before the address
to simplify the genrator code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
5626327552 qemuBuildMemballoonCommandLine: Generate via JSON
The generated properties have the following types according to QEMU:
  deflate-on-oom=<bool>  - on/off (default: false)
  free-page-reporting=<bool> - on/off (default: false)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
82bf36e551 qemuBuildShmemCommandLine: Generate via JSON
Note that the legacy 'ivshmem' device was already removed upstream, but
it's converted so that the code is identical.

For the two modern devices QEMU considers the properties being of
following types:

'ivshmem-doorbell'
  chardev=<str>          - ID of a chardev to use as a backend
  ioeventfd=<bool>       - on/off (default: true)
  master=<OnOffAuto>     - on/off/auto (default: "off")
  vectors=<uint32>       -  (default: 1)

'ivshmem-plain'
  master=<OnOffAuto>     - on/off/auto (default: "off")
  memdev=<link<memory-backend>>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
04f007e7b3 qemuBuildMemoryDeviceCommandLine: Generate via JSON
This includes the 'pc-dimm', 'nvdimm', 'virtio-pmem-pci' and
'virtio-mem-pci' devices.

The value types according to QEMU are:

'pc-dimm'
  node=<uint32>          -  (default: 0)
  memdev=<link<memory-backend>>

'nvdimm'
  label-size=<int>
  memdev=<link<memory-backend>>
  node=<uint32>          -  (default: 0)
  unarmed=<bool>         -  (default: false)
  uuid=<QemuUUID>

'virtio-pmem-pci'
  memdev=<link<memory-backend>>

'virtio-mem-pci'
  block-size=<size>
  memdev=<link<memory-backend>>
  node=<uint32>          -  (default: 0)
  requested-size=<size>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
a4229c087e qemuBuildWatchdogCommandLine: Generate via JSON
The watchdog doesn't have any special properties.

Convert the command line generator and hotplug code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
8617d29abb qemuBuildPanicCommandLine: Generate via JSON
Format a JSON object with the device properties and then use
qemuBuildDeviceCommandlineFromJSON to convert it to the standard
commandline for now.

The 'ioport' property of 'pvpanic' is a number in QEMU:
  ioport=<uint16>        -  (default: 1285)

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
ab92e9decb qemu: command: Introduce JSON variant of qemuBuildRomProps
Add a JSON variant of the generator 'rom' properties. For convenience
both the old and new are for now marked as unused, which will be removed
once the conversion is complete.

The formatted properties have following types according to QEMU.
'virtio-blk-pci' was used as an example:
  rombar=<uint32>        -  (default: 1)
  romfile=<str>

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
feaeab09ea qemu: command: Introduce helper for building JSON props of -device into commandline
The helper converts the JSON object to a string and adds it to the
current command as arguments of '-device'. The helper also prepares for
'-device' taking JSON directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
89b5bc626a qemu: command: Introduce JSON variant of qemuBuildVirtioDevStr
Add a JSON variant of the generator of properties for virtio devices.
For convenience both the old and new are for now marked as unused, which
will be removed once the conversion is complete.

The formatted properties have following types according to QEMU.
'virtio-blk-pci' was used as an example:

  disable-legacy=<OnOffAuto> - on/off/auto (default: "auto")
  disable-modern=<bool>  -  (default: false)
  iommu_platform=<bool>  - on/off (default: false)
  ats=<bool>             - on/off (default: false)
  packed=<bool>          - on/off (default: false)

Note that <OnOffAuto> is an enum type without alternates in QMP so it
must be represented as a string in JSON.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:03 +02:00
Peter Krempa
24be92b8e3 qemu: validate: Move validation of device rom
Move the validation from 'qemuBuildRomStr' into the function which
validates device info. It was originally named
'qemuValidateDomainDeviceDefAddress' but this commit renames it to
'qemuValidateDomainDeviceDefInfo'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
98a574ca0d qemuValidateDomainDeviceDef: Avoid unneded variable and 'break' statements
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
68c80fcfe9 qemuValidateDomainDeviceDef: Optimize virDomainDeviceInfo validation
Commit ffda44030a added validation of the 'acpiIndex' field in
virDomainDeviceInfo by calling 'virDomainDeviceInfoIterate' from
'qemuValidateDomainDef'. This is overly complicated we have
'qemuValidateDomainDeviceDef' which is already called for every single
device so we can avoid the extra loop.

Restructure the code by calling 'qemuValidateDomainDeviceInfo' directly
from 'qemuValidateDomainDeviceDef' and avoid unnecessary calls to
'virDomainDeviceGetInfo' by calling 'qemuValidateDomainDeviceDefAddress'
from 'qemuValidateDomainDeviceInfo'

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
7a8694e5f3 virDomainDeviceGetInfo: Make argument const
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
9e9fc9ea10 qemu: Clean up after old-style passing of 'bootIndex' to network devices
Remove the now unused boot-index related attributes and the code which
is assigning it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
c3bd60ddc6 qemu: Use 'effectiveBootIndex' to handle <os><boot dev='network'>
Fill in the effective boot index for network devices (or hostdev-backed
network devices via 'qemuProcessPrepareDeviceBootorder'. This patch
doesn't clean up the cruft to make it more obvious what's happening.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
c90d17c812 qemu: process: Make qemuProcessPrepareDomainDiskBootorder more universal
Rename it to 'qemuProcessPrepareDeviceBootorder' and call it from
'qemuProcessPrepareDomain' rather than
'qemuProcessPrepareDomainStorage'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
aee82fe616 conf: Introduce 'effectiveBootIndex' into 'virDomainDeviceInfo'
'effectiveBootIndex' is a copy of 'bootIndex' if '<boot order=' was
present and left unassigned if not. This allows hypervisor drivers to
reinterpret <os><boot> without being visible in the XML.

QEMU driver had a internal implementation for disks, which is now
replaced. Additionally this will simplify a refactor of network boot
assignment.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
1419044940 qemuBuildDeviceVideoStr: Properly format virtio options for 'virtio-vga'
'virtio-vga' is a virtio device but we didn't use the virtio formatter
for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
ae28d3e760 qemuBuildVirtioOptionsStr: Remove empty function
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
d5ae0517dc qemuBuildVirtioDevStr: Format also virtioOptions
Merge the code from qemuBuildVirtioOptionsStr so that we don't have to
call two separate functions.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
4d03faf045 qemuBuildVirtioDevStr: Remove 'baseName' argument
The code doesn't need the name as it determines it internally. Remove
the argument and fix all callers. In certain cases it led to
simplification of the logic.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
c82be4320c qemuBuildVirtioDevGetConfigDev: Provide more information
Since we already have code for per-device behaviour we can also populate
the device name and extract virtioOptions in the switch statement so
that callers don't have to pass it in.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
95c8d0b21e qemuBuildVirtioDevGetConfig: Split up formatting of bus suffix
Add the bus suffix in a separate call. This will make it more obvious
what's happening in the next commit.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
927f189a36 qemuDeviceVideoGetModel: Move to the beginning
The function is static and will be needed in the virtio device config
helper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:02 +02:00
Peter Krempa
6cbbb83d32 qemuDeviceVideoGetModel: Clarify 'virtio' argument
The 'virtio' argument was misleadingly implying that it's true for all
virtio devices, but that's not the case. 'virtio-vga(-gl)' is a virtio
device but doesn't accept the usual bus-dependant suffix.

Add a comment for 'qemuDeviceVideoGetModel' and another boolean
'virtioBusSuffix' which carries the above meaning so that the 'virtio'
argument can be fixed (it will be used later).

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:01 +02:00
Peter Krempa
a1dc15e677 qemuBuildVirtioDevGetConfig: Split out per device type code
Split out the function a bit more to separate the per-device code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:01 +02:00
Peter Krempa
65d014fbf6 qemuBuildVirtioDevStr: Extract code for determining device model
Extract the code into 'qemuBuildVirtioDevGetConfig' so that we can
later reuse it when converting individual device code into the more
modern JSON approach as the extracted code will be necessary either way.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2021-10-12 10:26:01 +02:00