mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
qemu: Don't set address type too early during virtio disk hotplug
f946462e14
changed behavior by settings
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI upfront. If we do so before invoking
qemuDomainPCIAddressEnsureAddr we merely try to set the PCI slot via
qemuDomainPCIAddressReserveSlot instead reserving a new address via
qemuDomainPCIAddressSetNextAddr which fails with
$ ~/run-tck-test domain/200-disk-hotplug.t
./scripts/domain/200-disk-hotplug.t .. # Creating a new transient domain
./scripts/domain/200-disk-hotplug.t .. 1/5 # Attaching the new disk /var/lib/jenkins/jobs/libvirt-tck-build/workspace/scratchdir/200-disk-hotplug/extra.img
# Failed test 'disk has been attached'
# at ./scripts/domain/200-disk-hotplug.t line 67.
# died: Sys::Virt::Error (libvirt error code: 1, message: internal error unable to reserve PCI address 0:0:0.0
# )
This commit is contained in:
parent
41db895f9e
commit
ea2e31fa5b
@ -226,7 +226,6 @@ int qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
|
|||||||
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW;
|
||||||
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
|
else if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_S390))
|
||||||
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
|
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390;
|
||||||
else disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
for (i = 0 ; i < vm->def->ndisks ; i++) {
|
||||||
@ -253,7 +252,8 @@ int qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
|
|||||||
if (qemuDomainCCWAddressAssign(&disk->info, priv->ccwaddrs,
|
if (qemuDomainCCWAddressAssign(&disk->info, priv->ccwaddrs,
|
||||||
!disk->info.addr.ccw.assigned) < 0)
|
!disk->info.addr.ccw.assigned) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
} else if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
} else if (!disk->info.type ||
|
||||||
|
disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &disk->info) < 0)
|
if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &disk->info) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -291,14 +291,17 @@ int qemuDomainAttachVirtioDiskDevice(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI){
|
} else if (!disk->info.type ||
|
||||||
|
disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
virDevicePCIAddress guestAddr = disk->info.addr.pci;
|
virDevicePCIAddress guestAddr = disk->info.addr.pci;
|
||||||
ret = qemuMonitorAddPCIDisk(priv->mon,
|
ret = qemuMonitorAddPCIDisk(priv->mon,
|
||||||
disk->src,
|
disk->src,
|
||||||
type,
|
type,
|
||||||
&guestAddr);
|
&guestAddr);
|
||||||
if (ret == 0)
|
if (ret == 0) {
|
||||||
|
disk->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||||
memcpy(&disk->info.addr.pci, &guestAddr, sizeof(guestAddr));
|
memcpy(&disk->info.addr.pci, &guestAddr, sizeof(guestAddr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
qemuDomainObjExitMonitor(driver, vm);
|
qemuDomainObjExitMonitor(driver, vm);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user