mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +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,
|
qemudNetworkIfaceConnect(virConnectPtr conn,
|
||||||
struct qemud_driver *driver,
|
struct qemud_driver *driver,
|
||||||
virDomainNetDefPtr net,
|
virDomainNetDefPtr net,
|
||||||
int vnet_hdr)
|
int qemuCmdFlags)
|
||||||
{
|
{
|
||||||
char *brname;
|
char *brname;
|
||||||
int err;
|
int err;
|
||||||
int tapfd = -1;
|
int tapfd = -1;
|
||||||
|
int vnet_hdr = 0;
|
||||||
|
|
||||||
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
|
||||||
virNetworkPtr network = virNetworkLookupByName(conn,
|
virNetworkPtr network = virNetworkLookupByName(conn,
|
||||||
@ -1062,6 +1063,10 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qemuCmdFlags & QEMUD_CMD_FLAG_VNET_HDR &&
|
||||||
|
net->model && STREQ(net->model, "virtio"))
|
||||||
|
vnet_hdr = 1;
|
||||||
|
|
||||||
if ((err = brAddTap(driver->brctl, brname,
|
if ((err = brAddTap(driver->brctl, brname,
|
||||||
&net->ifname, vnet_hdr, &tapfd))) {
|
&net->ifname, vnet_hdr, &tapfd))) {
|
||||||
if (errno == ENOTSUP) {
|
if (errno == ENOTSUP) {
|
||||||
@ -1816,13 +1821,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
|
|||||||
|
|
||||||
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||||
net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
|
||||||
int vnet_hdr = 0;
|
tapfd = qemudNetworkIfaceConnect(conn, driver, net, qemuCmdFlags);
|
||||||
|
|
||||||
if (qemuCmdFlags & QEMUD_CMD_FLAG_VNET_HDR &&
|
|
||||||
net->model && STREQ(net->model, "virtio"))
|
|
||||||
vnet_hdr = 1;
|
|
||||||
|
|
||||||
tapfd = qemudNetworkIfaceConnect(conn, driver, net, vnet_hdr);
|
|
||||||
if (tapfd < 0)
|
if (tapfd < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -165,6 +165,11 @@ int qemuBuildNicStr (virConnectPtr conn,
|
|||||||
int vlan,
|
int vlan,
|
||||||
char **str);
|
char **str);
|
||||||
|
|
||||||
|
int qemudNetworkIfaceConnect (virConnectPtr conn,
|
||||||
|
struct qemud_driver *driver,
|
||||||
|
virDomainNetDefPtr net,
|
||||||
|
int qemuCmdFlags);
|
||||||
|
|
||||||
int qemuAssignNetNames (virDomainDefPtr def,
|
int qemuAssignNetNames (virDomainDefPtr def,
|
||||||
virDomainNetDefPtr net);
|
virDomainNetDefPtr net);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user