Cannot deploy virtual machine using q35 chipset with pci-passthrough

Cannot deploy virtual machine using q35 chipset with pci-passthrough.

error log is this

Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: error: XML error: Invalid PCI address 0000:01:01.0. slot must be <= 0

seem to be slot must be 0 in q35 chipset.

so, I change bus and slot in deployment file, and deployment from virsh.
It’s working correctly.

Can I change VM_SLOT and VM_BUS manually?


Versions of the related components and OS (frontend, hypervisors, VMs):

opennebula 5.12.0.1
hypervisor: ubuntu 20.04(KVM)
vm: Windows 10 Pro

Steps to reproduce:

create template these step and create instance

  1. set chipset q35.
  2. set any pci passthrough

example template

CONTEXT = [
  NETWORK = "YES",
  SET_HOSTNAME = "$name",
  SSH_PUBLIC_KEY = "$USER[SSH_PUBLIC_KEY]" ]
CPU = "12"
CPU_MODEL = [
  MODEL = "host-passthrough" ]
DISK = [
  DEV_PREFIX = "vd",
  DRIVER = "qcow2",
  IMAGE = "Windows10-nebula",
  IMAGE_UNAME = "oneadmin" ]
GRAPHICS = [
  CLASS = "0403",
  DEVICE = "aab0",
  LISTEN = "0.0.0.0",
  TYPE = "SPICE",
  VENDOR = "1002" ]
HYPERVISOR = "kvm"
INPUTS_ORDER = ""
LOGO = "images/logos/windows8.png"
MEMORY = "16384"
MEMORY_UNIT_COST = "MB"
NIC = [
  NETWORK = "br-vm-pub",
  NETWORK_UNAME = "oneadmin",
  SECURITY_GROUPS = "0" ]
OS = [
  ARCH = "x86_64",
  BOOT = "disk0",
  MACHINE = "q35" ]
PCI = [
  CLASS = "0300",
  DEVICE = "6810",
  VENDOR = "1002" ]
PCI = [
  CLASS = "0403",
  DEVICE = "aab0",
  VENDOR = "1002" ]
RAW = [
  DATA = "<features>
    <hyperv>
      <vendor_id state='on' value='1234567890ab'/>
    </hyperv>
</features>
<devices>
  <hostdev mode='subsystem' type='usb' managed='yes'>
    <source>
      <vendor id='0x0a12'/>
      <product id='0x0001'/>
    </source>
  </hostdev>
</devices>",
  TYPE = "kvm" ]
SAVED_TEMPLATE_ID = "10"
TOPOLOGY = [
  CORES = "6",
  PIN_POLICY = "NONE",
  SOCKETS = "1",
  THREADS = "2" ]
USER_INPUTS = [
  CPU = "O|fixed|| |12",
  VCPU = "O|fixed|| |12" ]
VCPU = "12"

example instance configuration

AUTOMATIC_DS_REQUIREMENTS = "(\"CLUSTERS/ID\" @> 0)"
AUTOMATIC_NIC_REQUIREMENTS = "(\"CLUSTERS/ID\" @> 0)"
AUTOMATIC_REQUIREMENTS = "(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)"
CONTEXT = [
  DISK_ID = "1",
  ETH0_CONTEXT_FORCE_IPV4 = "",
  ETH0_DNS = "192.168.3.254",
  ETH0_EXTERNAL = "",
  ETH0_GATEWAY = "10.10.0.1",
  ETH0_GATEWAY6 = "",
  ETH0_IP = "10.10.64.0",
  ETH0_IP6 = "",
  ETH0_IP6_PREFIX_LENGTH = "",
  ETH0_IP6_ULA = "",
  ETH0_MAC = "00:00:6c:10:b7:13",
  ETH0_MASK = "255.255.0.0",
  ETH0_METRIC = "",
  ETH0_METRIC6 = "",
  ETH0_MTU = "",
  ETH0_NETWORK = "10.10.0.0",
  ETH0_SEARCH_DOMAIN = "",
  ETH0_VLAN_ID = "",
  ETH0_VROUTER_IP = "",
  ETH0_VROUTER_IP6 = "",
  ETH0_VROUTER_MANAGEMENT = "",
  NETWORK = "YES",
  PCI0_ADDRESS = "01:01.0",
  PCI1_ADDRESS = "01:02.0",
  SET_HOSTNAME = "Windows10-VGA-VM-132",
  SSH_PUBLIC_KEY = "ssh-rsa  ",
  TARGET = "hda",
  IMAGE = "Context",
  CONTEXT = "true" ]
CPU = "12"
CPU_MODEL = [
  MODEL = "host-passthrough" ]
DISK = [
  ALLOW_ORPHANS = "NO",
  CLONE = "YES",
  CLONE_TARGET = "SYSTEM",
  CLUSTER_ID = "0",
  DATASTORE = "image-main",
  DATASTORE_ID = "103",
  DEV_PREFIX = "vd",
  DISK_ID = "0",
  DISK_SNAPSHOT_TOTAL_SIZE = "0",
  DISK_TYPE = "FILE",
  DRIVER = "qcow2",
  IMAGE = "Windows10-nebula",
  IMAGE_ID = "27",
  IMAGE_STATE = "2",
  IMAGE_UNAME = "oneadmin",
  LN_TARGET = "NONE",
  ORDER = "1",
  ORIGINAL_SIZE = "40960",
  READONLY = "NO",
  SAVE = "NO",
  SIZE = "40960",
  SOURCE = "/var/lib/one//datastores/103/2096dc11f767560ecafef2ca6843ed47",
  TARGET = "vda",
  TM_MAD = "shared",
  TYPE = "FILE" ]
GRAPHICS = [
  CLASS = "0403",
  DEVICE = "aab0",
  LISTEN = "0.0.0.0",
  PORT = "6032",
  TYPE = "SPICE",
  VENDOR = "1002" ]
MEMORY = "16384"
NIC = [
  AR_ID = "0",
  BRIDGE = "br-vm-pub",
  BRIDGE_TYPE = "linux",
  CLUSTER_ID = "0",
  IP = "10.10.64.0",
  MAC = "00:00:6c:10:b7:13",
  NAME = "NIC0",
  NETWORK = "br-vm-pub",
  NETWORK_ID = "0",
  NETWORK_UNAME = "oneadmin",
  NIC_ID = "0",
  SECURITY_GROUPS = "0",
  TARGET = "one-132-0",
  VN_MAD = "fw" ]
OS = [
  ARCH = "x86_64",
  BOOT = "disk0",
  MACHINE = "q35" ]
PCI = [
  ADDRESS = "0000:81:00:0",
  BUS = "81",
  CLASS = "0300",
  DEVICE = "6810",
  DOMAIN = "0000",
  FUNCTION = "0",
  NUMA_NODE = "0",
  PCI_ID = "0",
  SLOT = "00",
  VENDOR = "1002",
  VM_ADDRESS = "01:01.0",
  VM_BUS = "0x01",
  VM_DOMAIN = "0x0000",
  VM_FUNCTION = "0",
  VM_SLOT = "0x01" ]
PCI = [
  ADDRESS = "0000:81:00:1",
  BUS = "81",
  CLASS = "0403",
  DEVICE = "aab0",
  DOMAIN = "0000",
  FUNCTION = "1",
  NUMA_NODE = "0",
  PCI_ID = "1",
  SLOT = "00",
  VENDOR = "1002",
  VM_ADDRESS = "01:02.0",
  VM_BUS = "0x01",
  VM_DOMAIN = "0x0000",
  VM_FUNCTION = "0",
  VM_SLOT = "0x02" ]
RAW = [
  DATA = "<features>
    <hyperv>
      <vendor_id state='on' value='1234567890ab'/>
    </hyperv>
</features>
<devices>
  <hostdev mode='subsystem' type='usb' managed='yes'>
    <source>
      <vendor id='0x0a12'/>
      <product id='0x0001'/>
    </source>
  </hostdev>
</devices>",
  TYPE = "kvm" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "OUTBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
SECURITY_GROUP_RULE = [
  PROTOCOL = "ALL",
  RULE_TYPE = "INBOUND",
  SECURITY_GROUP_ID = "0",
  SECURITY_GROUP_NAME = "default" ]
TEMPLATE_ID = "20"
TM_MAD_SYSTEM = "shared"
TOPOLOGY = [
  CORES = "6",
  PIN_POLICY = "NONE",
  SOCKETS = "1",
  THREADS = "2" ]
VCPU = "12"
VMID = "132"

Current results:

deployment failure with these log.

Mon Sep 21 02:37:50 2020 [Z0][VM][I]: New state is ACTIVE
Mon Sep 21 02:37:50 2020 [Z0][VM][I]: New LCM state is PROLOG
Mon Sep 21 02:38:32 2020 [Z0][VM][I]: New LCM state is BOOT
Mon Sep 21 02:38:32 2020 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/132/deployment.0
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: ExitCode: 0
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/kvm/deploy '/var/lib/one//datastores/104/132/deployment.0' '172.21.0.2' 132 172.21.0.2
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: error: Failed to create domain from /var/lib/one//datastores/104/132/deployment.0
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: error: XML error: Invalid PCI address 0000:01:01.0. slot must be <= 0
Mon Sep 21 02:38:34 2020 [Z0][VMM][E]: Could not create domain from /var/lib/one//datastores/104/132/deployment.0
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: ExitCode: 255
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: ExitCode: 0
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: Successfully execute network driver operation: clean.
Mon Sep 21 02:38:34 2020 [Z0][VMM][I]: Failed to execute virtualization driver operation: deploy.
Mon Sep 21 02:38:34 2020 [Z0][VMM][E]: Error deploying virtual machine: Could not create domain from /var/lib/one//datastores/104/132/deployment.0
Mon Sep 21 02:38:34 2020 [Z0][VM][I]: New LCM state is BOOT_FAILURE

Expected results:

VM_SLOT must be 0 on q35 chipset.
and assign deferent VM_BUS between pci.

(note: VM_SLOT > 0 is correctly setting if use i440 chipset)

I’ve got exactly the same issue.