* src/qemu_conf.h: export qemudNetworkIfaceConnect()
* src/qemu_conf.c: move vnet_hdr logic into qemudNetworkIfaceConnect()
since we need it for hotplug too
---
src/qemu_conf.c | 17 ++++++++---------
src/qemu_conf.h | 5 +++++
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 96f83cb..ed77153 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -743,15 +743,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,
@@ -791,6 +792,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) {
@@ -1545,13 +1550,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;
diff --git a/src/qemu_conf.h b/src/qemu_conf.h
index 50d7c0a..8ad5f94 100644
--- a/src/qemu_conf.h
+++ b/src/qemu_conf.h
@@ -160,6 +160,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);
--
1.6.2.5