mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 06:25:19 +00:00
Move vnet_hdr logic into qemudNetworkIfaceConnect() and export it
* src/qemu_conf.h: export qemudNetworkIfaceConnect() * src/qemu_conf.c: move vnet_hdr logic into qemudNetworkIfaceConnect() since we need it for hotplug too
This commit is contained in:
parent
707302b2cf
commit
a3f33b6531
@ -1014,15 +1014,16 @@ int qemudExtractVersion(virConnectPtr conn,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
qemudNetworkIfaceConnect(virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainNetDefPtr net,
|
||||
int vnet_hdr)
|
||||
int qemuCmdFlags)
|
||||
{
|
||||
char *brname;
|
||||
int err;
|
||||
int tapfd = -1;
|
||||
int vnet_hdr = 0;
|
||||
|
||||
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
||||
virNetworkPtr network = virNetworkLookupByName(conn,
|
||||
@ -1062,6 +1063,10 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_VNET_HDR &&
|
||||
net->model && STREQ(net->model, "virtio"))
|
||||
vnet_hdr = 1;
|
||||
|
||||
if ((err = brAddTap(driver->brctl, brname,
|
||||
&net->ifname, vnet_hdr, &tapfd))) {
|
||||
if (errno == ENOTSUP) {
|
||||
@ -1816,13 +1821,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
||||
|
||||
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||
net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||
int vnet_hdr = 0;
|
||||
|
||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_VNET_HDR &&
|
||||
net->model && STREQ(net->model, "virtio"))
|
||||
vnet_hdr = 1;
|
||||
|
||||
tapfd = qemudNetworkIfaceConnect(conn, driver, net, vnet_hdr);
|
||||
tapfd = qemudNetworkIfaceConnect(conn, driver, net, qemuCmdFlags);
|
||||
if (tapfd < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -165,6 +165,11 @@ int qemuBuildNicStr (virConnectPtr conn,
|
||||
int vlan,
|
||||
char **str);
|
||||
|
||||
int qemudNetworkIfaceConnect (virConnectPtr conn,
|
||||
struct qemud_driver *driver,
|
||||
virDomainNetDefPtr net,
|
||||
int qemuCmdFlags);
|
||||
|
||||
int qemuAssignNetNames (virDomainDefPtr def,
|
||||
virDomainNetDefPtr net);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user