mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
qemuDomainAttachNetDevice: Move hostdev handling a bit further
The idea is to have function that does some checking at its beginning and then have one big switch for all the interface types it supports. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
0bce012d7f
commit
5b65d772dd
@ -946,20 +946,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
actualType = virDomainNetGetActualType(net);
|
actualType = virDomainNetGetActualType(net);
|
||||||
|
|
||||||
if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
||||||
/* This is really a "smart hostdev", so it should be attached
|
|
||||||
* as a hostdev (the hostdev code will reach over into the
|
|
||||||
* netdev-specific code as appropriate), then also added to
|
|
||||||
* the nets list (see cleanup:) if successful.
|
|
||||||
*
|
|
||||||
* qemuDomainAttachHostDevice uses a connection to resolve
|
|
||||||
* a SCSI hostdev secret, which is not this case, so pass NULL.
|
|
||||||
*/
|
|
||||||
ret = qemuDomainAttachHostDevice(NULL, driver, vm,
|
|
||||||
virDomainNetGetActualHostdev(net));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Currently only TAP/macvtap devices supports multiqueue. */
|
/* Currently only TAP/macvtap devices supports multiqueue. */
|
||||||
if (net->driver.virtio.queues > 0 &&
|
if (net->driver.virtio.queues > 0 &&
|
||||||
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||||
@ -1037,6 +1023,18 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
|
|||||||
if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps,
|
if (qemuInterfaceOpenVhostNet(vm->def, net, priv->qemuCaps,
|
||||||
vhostfd, &vhostfdSize) < 0)
|
vhostfd, &vhostfdSize) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
} else if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
||||||
|
/* This is really a "smart hostdev", so it should be attached
|
||||||
|
* as a hostdev (the hostdev code will reach over into the
|
||||||
|
* netdev-specific code as appropriate), then also added to
|
||||||
|
* the nets list (see cleanup:) if successful.
|
||||||
|
*
|
||||||
|
* qemuDomainAttachHostDevice uses a connection to resolve
|
||||||
|
* a SCSI hostdev secret, which is not this case, so pass NULL.
|
||||||
|
*/
|
||||||
|
ret = qemuDomainAttachHostDevice(NULL, driver, vm,
|
||||||
|
virDomainNetGetActualHostdev(net));
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set device online immediately */
|
/* Set device online immediately */
|
||||||
|
Loading…
Reference in New Issue
Block a user