mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 18:03:32 +00:00
qemu: Set proper PCI backend for <interface/>-s that are actually hostdevs
When starting a domain, it's done so in two steps (actually more,
but lets focus on just the following two):
1) qemuProcessPrepareDomain(), followed by
2) qemuProcessPrepareHost().
Now, in the first step (PrepareDomain()), PCI backends for all
hostdevs is set (qemuProcessPrepareDomain() ->
qemuProcessPrepareDomainHostdevs() -> qemuDomainPrepareHostdev()
-> qemuDomainPrepareHostdevPCI()). Perfect.
But then, additional hostdevs may appear, because in the host
prepare phase we may insert some hostdevs into domain definition
(qemuProcessPrepareHost() -> qemuProcessNetworkPrepareDevices()).
Now, these additional hostdevs don't undergo the same prepare as
hostdevs that were already present in the domain definition (i.e.
in qemuProcessPrepareDomain() phase). Therefore, we have to call
corresponding prepare function explicitly.
NB, the interface hotplug code (qemuDomainAttachNetDevice()) does
not suffer from this problem, because it calls top level
qemuDomainAttachHostDevice() which is used to hotplug regular
hostdevs too and as such calls qemuDomainPrepareHostdev().
Fixes: 3b87709c76
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2209853
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
adf67ca987
commit
8b9d2bda8a
@ -5834,6 +5834,13 @@ qemuProcessNetworkPrepareDevices(virQEMUDriver *driver,
|
|||||||
net->data.network.name, def->name);
|
net->data.network.name, def->name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For hostdev present in qemuProcessPrepareDomain() phase this was
|
||||||
|
* done already, but this code runs after that, so we have to call
|
||||||
|
* it ourselves. */
|
||||||
|
if (qemuDomainPrepareHostdev(hostdev, priv) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (virDomainHostdevInsert(def, hostdev) < 0)
|
if (virDomainHostdevInsert(def, hostdev) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
} else if (actualType == VIR_DOMAIN_NET_TYPE_USER &&
|
} else if (actualType == VIR_DOMAIN_NET_TYPE_USER &&
|
||||||
|
Loading…
Reference in New Issue
Block a user