mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
qemu: Handle host devices not being available better
We can't retrieve the isolation group of a device that's not present in the system. However, it's very common for VFs to be created late in the boot, so they might not be present yet when libvirtd starts, which would cause the guests using them to disappear. Moreover, for other architectures and even ppc64 before isolation groups were introduced, it's considered perfectly fine to configure a guest to use a device that's not yet (or no longer) available to the host, with the obvious caveat that such a guest won't be able to start before the device is available. In order to be consistent, when a device's isolation group can't be determined fall back to not isolating it rather than erroring out or, worse, making the guest disappear. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1484254 Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
e02ff020ca
commit
1f43393283
@ -982,8 +982,6 @@ int
|
|||||||
qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
||||||
virDomainDeviceDefPtr dev)
|
virDomainDeviceDefPtr dev)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
/* Only host devices need their isolation group to be different from
|
/* Only host devices need their isolation group to be different from
|
||||||
* the default. Interfaces of type hostdev are just host devices in
|
* the default. Interfaces of type hostdev are just host devices in
|
||||||
* disguise, but we don't need to handle them separately because for
|
* disguise, but we don't need to handle them separately because for
|
||||||
@ -1012,12 +1010,11 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr);
|
tmp = virPCIDeviceAddressGetIOMMUGroupNum(hostAddr);
|
||||||
|
|
||||||
if (tmp < 0) {
|
if (tmp < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
VIR_WARN("Can't look up isolation group for host device "
|
||||||
_("Can't look up isolation group for host device "
|
"%04x:%02x:%02x.%x, device won't be isolated",
|
||||||
"%04x:%02x:%02x.%x"),
|
hostAddr->domain, hostAddr->bus,
|
||||||
hostAddr->domain, hostAddr->bus,
|
hostAddr->slot, hostAddr->function);
|
||||||
hostAddr->slot, hostAddr->function);
|
goto skip;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The isolation group for a host device is its IOMMU group,
|
/* The isolation group for a host device is its IOMMU group,
|
||||||
@ -1057,12 +1054,11 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
tmp = qemuDomainFindUnusedIsolationGroup(def);
|
tmp = qemuDomainFindUnusedIsolationGroup(def);
|
||||||
|
|
||||||
if (tmp == 0) {
|
if (tmp == 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
VIR_WARN("Can't obtain usable isolation group for interface "
|
||||||
_("Can't obtain usable isolation group for "
|
"configured to use hostdev-backed network '%s', "
|
||||||
"interface configured to use hostdev-backed "
|
"device won't be isolated",
|
||||||
"network '%s'"),
|
iface->data.network.name);
|
||||||
iface->data.network.name);
|
goto skip;
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
info->isolationGroup = tmp;
|
info->isolationGroup = tmp;
|
||||||
@ -1073,10 +1069,7 @@ qemuDomainFillDeviceIsolationGroup(virDomainDefPtr def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user