提交 9619d8a6 编写于 作者: J Jiri Denemark

qemu: Don't break domain with 0:0:2.0 assigned to anything but VGA

In the past we didn't reserve 0:0:2.0 PCI address if there was no video
device assigned to a domain, which made it impossible to add a video
device later on. So we fixed it (commit v0.9.0-37-g7b2cac12) by always
reserving that address. However, that breaks existing domains without
video devices that already have another device assigned to the
problematic address.

This patch reserves address 0:0:2.0 only in case it was not explicitly
assigned to another device, which means libvirt will try to keep this
address free and will not automatically assign it new devices. But
existing domains for which older libvirt already assigned the address to
a non-video device will keep working as they used to work before 0.9.1.
Moreover, users who want to create a domain without a video device and
use its address for another device may do so by explicitly configuring
the PCI address in domain XML.
上级 dccf45f3
......@@ -1206,7 +1206,6 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
int i;
bool reservedIDE = false;
bool reservedUSB = false;
bool reservedVGA = false;
int function;
/* Host bridge */
......@@ -1287,19 +1286,29 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
}
/* If TYPE==PCI, then qemuCollectPCIAddress() function
* has already reserved the address, so we must skip */
reservedVGA = true;
} else {
def->videos[0]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
def->videos[0]->info.addr.pci.domain = 0;
def->videos[0]->info.addr.pci.bus = 0;
def->videos[0]->info.addr.pci.slot = 2;
def->videos[0]->info.addr.pci.function = 0;
if (qemuDomainPCIAddressReserveSlot(addrs, 2) < 0)
goto error;
}
}
} else {
virDomainDeviceInfo dev;
memset(&dev, 0, sizeof(dev));
dev.addr.pci.slot = 2;
if (!reservedVGA
&& qemuDomainPCIAddressReserveSlot(addrs, 2) < 0)
if (qemuDomainPCIAddressCheckSlot(addrs, &dev) < 0) {
VIR_DEBUG("PCI address 0:0:2.0 in use, future addition of a video"
" device will not be possible without manual"
" intervention");
virResetLastError();
} else if (qemuDomainPCIAddressReserveSlot(addrs, 2) < 0) {
goto error;
}
}
for (i = 0; i < def->nfss ; i++) {
if (def->fss[i]->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册