[libvirt] [PATCH 0/3] security: misc cleanups
by Ján Tomko
Ján Tomko (3):
security_dac: check if virSecurityDACGetIds returns negative
security: remove extra security from function names
security_selinux: fix indentation
src/security/security_dac.c | 242 ++++++++++++++++++++--------------------
src/security/security_selinux.c | 205 +++++++++++++++++-----------------
2 files changed, 223 insertions(+), 224 deletions(-)
--
2.4.6
9 years
[libvirt] [PATCH 0/2] Fix coverity build and resolve new issue
by John Ferlan
The first patch is a Coverity build breaker... The second one popped up
recently and while some may consider it noise or a false positive, it is
the only call that didn't check status. Not sure why it "popped up" after
the recent changes, but that does happen.
John Ferlan (2):
qemu: Fix build error in Coverity environment
vbox: Resolve Coverity CHECKED_RETURN
src/qemu/qemu_command.h | 2 +-
src/vbox/vbox_common.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
--
2.5.0
9 years
[libvirt] [PATCH 0/6] Fixes for memory locking limit
by Andrea Bolognani
The code dealing with RLIMIT_MEMLOCK contained a few
assumptions that hold for x86 but don't necessarily work
as well for other platforms, eg. that qemu will need to
lock memory only when VFIO passthrough is involved.
This series removes such assumptions by removing ad-hoc
code and making sure that the function containing the
correct logic is called instead; it also implements the
platform-specific calculations needed to calculate the
correct RLIMIT_MEMLOCK value for ppc64 guests.
Patches 1-4 are architecture-agnostic, patches 5-6 are
specific to ppc64.
Cheers.
Andrea Bolognani (6):
process: Log when limiting the amount of locked memory
qemu: Use qemuDomainRequiresMlock() in qemuBuildCommandLine()
qemu: Use qemuDomainRequiresMlock() when attaching PCI hostdev
qemu: Reduce memlock limit after detaching hostdev
qemu: Always set locked memory limit for ppc64 domains
qemu: Add ppc64-specific math to qemuDomainGetMlockLimitBytes()
src/qemu/qemu_command.c | 9 ++---
src/qemu/qemu_domain.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_hotplug.c | 29 ++++++++++++----
src/util/virprocess.c | 4 +++
4 files changed, 116 insertions(+), 15 deletions(-)
--
2.5.0
9 years
[libvirt] [PATCHv4 0/6] Hyper-v crash feature support
by Dmitry Andreev
A new Hyper-V cpu feature 'hv_crash' was added to QEMU. The feature
will become available in v2.5.0.
What is changed in v4:
* panic model attribute is added even if it wasn't specified
by the user [5/6], tests updated.
* configuration with multiple panic defices of same model is
rejected [6/6]
1-4 commits have no changes.
The previous version:
https://www.redhat.com/archives/libvir-list/2015-November/msg00457.html
Dmitry Andreev (6):
conf: add 'model' attribute for panic device with values isa, pseries,
hyperv
qemu: add support for hv_crash feature as a panic device
schema: allow multiple panic devices
tests: add tests for panic models and multiple panic devices
qemu: set panic device model if not specified by the user
conf: reject multiple panic devices of same model
docs/formatdomain.html.in | 19 ++-
docs/schemas/domaincommon.rng | 13 ++-
src/conf/domain_conf.c | 128 +++++++++++++--------
src/conf/domain_conf.h | 15 ++-
src/qemu/qemu_command.c | 74 ++++++++++--
src/qemu/qemu_domain.c | 30 ++++-
tests/qemuargv2xmltest.c | 1 +
.../qemuxml2argv-hyperv-panic.args | 21 ++++
.../qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml | 25 ++++
.../qemuxml2argv-panic-double.args | 21 ++++
.../qemuxml2argvdata/qemuxml2argv-panic-double.xml | 28 +++++
tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml | 31 +++++
.../qemuxml2argv-panic-no-address.xml | 2 +-
.../qemuxml2argv-panic-pseries.xml | 30 +++++
.../qemuxml2argvdata/qemuxml2argv-pseries-disk.xml | 2 +-
.../qemuxml2argv-pseries-nvram.xml | 2 +-
tests/qemuxml2argvtest.c | 3 +
tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml | 31 +++++
.../qemuxml2xmlout-pseries-panic-missing.xml | 2 +-
.../qemuxml2xmlout-pseries-panic-no-address.xml | 30 +++++
tests/qemuxml2xmltest.c | 8 +-
21 files changed, 446 insertions(+), 70 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hyperv-panic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hyperv-panic.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-double.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-double.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-isa.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-pseries.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-panic-no-address.xml
--
1.8.3.1
9 years
[libvirt] qemuParseCommandLine and virDomainDefPostParse (and virDomaniDefAddImplicitControllers)
by Laine Stump
While playing with the idea of forcing explicit USB controller models, I
ended up with the qemuargv2xml test failing; it ended up that this was
because changes I had made to qemuDomainDefPostParse() were affecting
the XML produced by qemuParseCommandline(). The reason - after
constructing a virDomainDef object by parsing a qemu commandline,
qemuParseCommandline() calls two functions that are supposed to be
called after parsing domain XML - virDomainDefPostParse() (which calls
qemuDomainDefPostParse()).
In my opinion, qemuParseCommandLine() shouldn't be calling
virDomainDefPostParse() (or virDomainefAddImplicitControllers(), which
it calls in the wrong order relative to virDomainDefPostParse() BTW).
The reasons are:
1) this is causing the argv-to-xml conversion to include things in the
XML that were not on the original commandline, in particular "default"
devices like PCI and USB controllers (added in qemuDomainDefPostParse()
based on machinetype) as well as disk, smartcard, virtio-serial, and
hostdev-scsi controllers in virDomainDefAddImplicitControllers() (why
the duality there, anyway?)
2) If the output of argv-to-xml is used for a virDomainDefine, those
post-parse functions will be called then, and the implicit/auto devices
will be added at that time anyway, so in practice nothing is gained by
adding them during argv-to-xml.
Does anyone else have an opinion about this?
9 years
[libvirt] [PATCH v2] vz: implementation of domainReboot callback
by Mikhail Feoktistov
Diff from v1.
1. Add virCheckFlags() call in vzDomainReboot
---
src/vz/vz_driver.c | 8 ++++++++
src/vz/vz_sdk.c | 8 ++++++++
src/vz/vz_sdk.h | 1 +
3 files changed, 17 insertions(+)
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 0a968b9..39f58a4 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -923,6 +923,13 @@ static int vzDomainShutdown(virDomainPtr domain)
return prlsdkDomainChangeState(domain, prlsdkStop);
}
+static int vzDomainReboot(virDomainPtr domain,
+ unsigned int flags)
+{
+ virCheckFlags(0, -1);
+ return prlsdkDomainChangeState(domain, prlsdkRestart);
+}
+
static int vzDomainIsActive(virDomainPtr domain)
{
virDomainObjPtr dom = NULL;
@@ -1486,6 +1493,7 @@ static virHypervisorDriver vzDriver = {
.domainShutdown = vzDomainShutdown, /* 0.10.0 */
.domainCreate = vzDomainCreate, /* 0.10.0 */
.domainCreateWithFlags = vzDomainCreateWithFlags, /* 1.2.10 */
+ .domainReboot = vzDomainReboot, /* 1.2.22 */
.domainDefineXML = vzDomainDefineXML, /* 0.10.0 */
.domainDefineXMLFlags = vzDomainDefineXMLFlags, /* 1.2.12 */
.domainUndefine = vzDomainUndefine, /* 1.2.10 */
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 89c9e89..bf71e96 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -1831,6 +1831,14 @@ PRL_RESULT prlsdkSuspend(PRL_HANDLE sdkdom)
return waitJob(job);
}
+PRL_RESULT prlsdkRestart(PRL_HANDLE sdkdom)
+{
+ PRL_HANDLE job = PRL_INVALID_HANDLE;
+
+ job = PrlVm_Restart(sdkdom);
+ return waitJob(job);
+}
+
int
prlsdkDomainChangeStateLocked(vzConnPtr privconn,
virDomainObjPtr dom,
diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
index ebe4591..88ee7d9 100644
--- a/src/vz/vz_sdk.h
+++ b/src/vz/vz_sdk.h
@@ -41,6 +41,7 @@ PRL_RESULT prlsdkStop(PRL_HANDLE sdkdom);
PRL_RESULT prlsdkPause(PRL_HANDLE sdkdom);
PRL_RESULT prlsdkResume(PRL_HANDLE sdkdom);
PRL_RESULT prlsdkSuspend(PRL_HANDLE sdkdom);
+PRL_RESULT prlsdkRestart(PRL_HANDLE sdkdom);
typedef PRL_RESULT (*prlsdkChangeStateFunc)(PRL_HANDLE sdkdom);
int
--
1.8.3.1
9 years
[libvirt] [PATCH] vz: allow only en-us keymap for VNC
by Mikhail Feoktistov
In virtuozzo we support only en-us keymap for VMs and containers.
If keymap is specified than check that it's en-us, otherwise
show error message.
---
src/vz/vz_sdk.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 89c9e89..526c0f2 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -2220,10 +2220,11 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def)
return -1;
}
- if (gr->data.vnc.keymap != 0) {
+ if (gr->data.vnc.keymap != 0 &&
+ STRNEQ(gr->data.vnc.keymap, "en-us")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("vz driver doesn't support "
- "keymap setting for VNC graphics."));
+ _("vz driver supports only "
+ "\"en-us\" keymap for VNC graphics."));
return -1;
}
--
1.8.3.1
9 years
[libvirt] [PATCH] set UID and GID according to dynamicOwnership
by Matteo Cafasso
When called with dynamicOwnership set, the qemuOpenFileAs function ignores it resulting in files not created with proper permissions.
The issue is reported in:
https://www.redhat.com/archives/libvirt-users/2015-November/msg00039.html
and also mentioned in:
https://www.redhat.com/archives/libvir-list/2015-November/msg00453.html
Signed-off-by: Matteo Cafasso <noxdafox(a)gmail.com>
---
src/qemu/qemu_driver.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 92a9961..b3b59b6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2932,6 +2932,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
if (path_shared <= 0 || dynamicOwnership)
vfoflags |= VIR_FILE_OPEN_FORCE_OWNER;
+ if (dynamicOwnership) {
+ uid = fallback_uid;
+ gid = fallback_gid;
+ }
+
if (stat(path, &sb) == 0) {
/* It already exists, we don't want to delete it on error */
need_unlink = false;
--
2.6.2
9 years
[libvirt] [[PATCH v6] autocreate tap device for VIR_DOMAIN_NET_TYPE_ETHERNET] autocreate tap device for VIR_DOMAIN_NET_TYPE_ETHERNET
by Vasiliy Tolstov
If a user specify ehernet device create it via libvirt and run
script if it provided. After this commit user does not need to
run external script to create tap device or add root to qemu
process.
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
src/qemu/qemu_command.c | 142 +++++++++++++++++++++++++++++++-----------------
src/qemu/qemu_hotplug.c | 13 ++---
src/qemu/qemu_process.c | 6 ++
3 files changed, 101 insertions(+), 60 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3886b4f..6d26d28 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -332,10 +332,39 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg,
return *tapfd < 0 ? -1 : 0;
}
+/**
+ * qemuExecuteEthernetScript:
+ * @ifname: the interface name
+ * @script: the script name
+ *
+ * This function executes script for new tap device created by libvirt.
+ * Returns 0 in case of success or -1 on failure
+ */
+static int
+qemuExecuteEthernetScript(const char *ifname, const char *script)
+{
+ virCommandPtr cmd;
+ int ret;
+
+ cmd = virCommandNew(script);
+ virCommandAddArgFormat(cmd, "%s", ifname);
+ virCommandClearCaps(cmd);
+#ifdef CAP_NET_ADMIN
+ virCommandAllowCap(cmd, CAP_NET_ADMIN);
+#endif
+ virCommandAddEnvPassCommon(cmd);
+
+ ret = virCommandRun(cmd, NULL);
+
+ virCommandFree(cmd);
+ return ret;
+}
+
/* qemuNetworkIfaceConnect - *only* called if actualType is
- * VIR_DOMAIN_NET_TYPE_NETWORK or VIR_DOMAIN_NET_TYPE_BRIDGE (i.e. if
- * the connection is made with a tap device connecting to a bridge
- * device)
+ * VIR_DOMAIN_NET_TYPE_NETWORK, VIR_DOMAIN_NET_TYPE_BRIDGE
+ * VIR_DOMAIN_NET_TYPE_ETHERNET (i.e. if the connection is
+ * made with a tap device connecting to a bridge device or
+ * use plain tap device)
*/
int
qemuNetworkIfaceConnect(virDomainDefPtr def,
@@ -351,6 +380,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
bool template_ifname = false;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
const char *tunpath = "/dev/net/tun";
+ virMacAddr tapmac;
if (net->backend.tap) {
tunpath = net->backend.tap;
@@ -361,11 +391,6 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
}
}
- if (!(brname = virDomainNetGetActualBridgeName(net))) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing bridge name"));
- goto cleanup;
- }
-
if (!net->ifname ||
STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
strchr(net->ifname, '%')) {
@@ -381,40 +406,65 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
}
- if (cfg->privileged) {
- if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
- def->uuid, tunpath, tapfd, *tapfdSize,
- virDomainNetGetActualVirtPortProfile(net),
- virDomainNetGetActualVlan(net),
- tap_create_flags) < 0) {
+ if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_ETHERNET) {
+ if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, *tapfdSize,
+ tap_create_flags) < 0) {
virDomainAuditNetDevice(def, net, tunpath, false);
goto cleanup;
}
- if (virDomainNetGetActualBridgeMACTableManager(net)
- == VIR_NETWORK_BRIDGE_MAC_TABLE_MANAGER_LIBVIRT) {
- /* libvirt is managing the FDB of the bridge this device
- * is attaching to, so we need to turn off learning and
- * unicast_flood on the device to prevent the kernel from
- * adding any FDB entries for it. We will add add an fdb
- * entry ourselves (during qemuInterfaceStartDevices(),
- * using the MAC address from the interface config.
- */
- if (virNetDevBridgePortSetLearning(brname, net->ifname, false) < 0)
- goto cleanup;
- if (virNetDevBridgePortSetUnicastFlood(brname, net->ifname, false) < 0)
+ virMacAddrSet(&tapmac, &net->mac);
+
+ if (virNetDevSetMAC(net->ifname, &tapmac) < 0)
+ goto cleanup;
+
+ if (virNetDevSetOnline(net->ifname, true) < 0)
+ goto cleanup;
+
+ if (net->script) {
+ if (qemuExecuteEthernetScript(net->ifname, net->script) < 0)
goto cleanup;
}
} else {
- if (qemuCreateInBridgePortWithHelper(cfg, brname,
- &net->ifname,
- tapfd, tap_create_flags) < 0) {
- virDomainAuditNetDevice(def, net, tunpath, false);
+ if (!(brname = virDomainNetGetActualBridgeName(net))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Missing bridge name"));
goto cleanup;
}
- /* qemuCreateInBridgePortWithHelper can only create a single FD */
- if (*tapfdSize > 1) {
- VIR_WARN("Ignoring multiqueue network request");
- *tapfdSize = 1;
+
+ if (cfg->privileged) {
+ if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
+ def->uuid, tunpath, tapfd, *tapfdSize,
+ virDomainNetGetActualVirtPortProfile(net),
+ virDomainNetGetActualVlan(net),
+ tap_create_flags) < 0) {
+ virDomainAuditNetDevice(def, net, tunpath, false);
+ goto cleanup;
+ }
+ if (virDomainNetGetActualBridgeMACTableManager(net)
+ == VIR_NETWORK_BRIDGE_MAC_TABLE_MANAGER_LIBVIRT) {
+ /* libvirt is managing the FDB of the bridge this device
+ * is attaching to, so we need to turn off learning and
+ * unicast_flood on the device to prevent the kernel from
+ * adding any FDB entries for it. We will add add an fdb
+ * entry ourselves (during qemuInterfaceStartDevices(),
+ * using the MAC address from the interface config.
+ */
+ if (virNetDevBridgePortSetLearning(brname, net->ifname, false) < 0)
+ goto cleanup;
+ if (virNetDevBridgePortSetUnicastFlood(brname, net->ifname, false) < 0)
+ goto cleanup;
+ }
+ } else {
+ if (qemuCreateInBridgePortWithHelper(cfg, brname,
+ &net->ifname,
+ tapfd, tap_create_flags) < 0) {
+ virDomainAuditNetDevice(def, net, tunpath, false);
+ goto cleanup;
+ }
+ /* qemuCreateInBridgePortWithHelper can only create a single FD */
+ if (*tapfdSize > 1) {
+ VIR_WARN("Ignoring multiqueue network request");
+ *tapfdSize = 1;
+ }
}
}
@@ -5221,6 +5271,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_DIRECT:
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
virBufferAsprintf(&buf, "tap%c", type_sep);
/* for one tapfd 'fd=' shall be used,
* for more than one 'fds=' is the right choice */
@@ -5238,20 +5289,6 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
is_tap = true;
break;
- case VIR_DOMAIN_NET_TYPE_ETHERNET:
- virBufferAddLit(&buf, "tap");
- if (net->ifname) {
- virBufferAsprintf(&buf, "%cifname=%s", type_sep, net->ifname);
- type_sep = ',';
- }
- if (net->script) {
- virBufferAsprintf(&buf, "%cscript=%s", type_sep,
- net->script);
- type_sep = ',';
- }
- is_tap = true;
- break;
-
case VIR_DOMAIN_NET_TYPE_CLIENT:
virBufferAsprintf(&buf, "socket%cconnect=%s:%d",
type_sep,
@@ -8226,7 +8263,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
- actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
+ actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
+ actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported for: %s"),
virDomainNetTypeToString(actualType));
@@ -8235,7 +8273,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
if (net->backend.tap &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
- actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
+ actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
+ actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Custom tap device path is not supported for: %s"),
virDomainNetTypeToString(actualType));
@@ -8245,7 +8284,8 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
cfg = virQEMUDriverGetConfig(driver);
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
- actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
+ actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
+ actualType == VIR_DOMAIN_NET_TYPE_ETHERNET) {
tapfdSize = net->driver.virtio.queues;
if (!tapfdSize)
tapfdSize = 1;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index cc86a3b..21ea3fd 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -908,7 +908,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
/* Currently nothing besides TAP devices supports multiqueue. */
if (net->driver.virtio.queues > 0 &&
!(actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
- actualType == VIR_DOMAIN_NET_TYPE_BRIDGE)) {
+ actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
+ actualType == VIR_DOMAIN_NET_TYPE_ETHERNET)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Multiqueue network is not supported for: %s"),
virDomainNetTypeToString(actualType));
@@ -916,7 +917,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
}
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
- actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
+ actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
+ actualType == VIR_DOMAIN_NET_TYPE_ETHERNET) {
tapfdSize = vhostfdSize = net->driver.virtio.queues;
if (!tapfdSize)
tapfdSize = vhostfdSize = 1;
@@ -947,13 +949,6 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
iface_connected = true;
if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, vhostfd, &vhostfdSize) < 0)
goto cleanup;
- } else if (actualType == VIR_DOMAIN_NET_TYPE_ETHERNET) {
- vhostfdSize = 1;
- if (VIR_ALLOC(vhostfd) < 0)
- goto cleanup;
- *vhostfd = -1;
- if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, vhostfd, &vhostfdSize) < 0)
- goto cleanup;
}
/* Set device online immediately */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 64ee049..d866e44 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5205,6 +5205,12 @@ void qemuProcessStop(virQEMUDriverPtr driver,
cfg->stateDir));
VIR_FREE(net->ifname);
break;
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
+ if (net->ifname) {
+ ignore_value(virNetDevTapDelete(net->ifname, net->backend.tap));
+ VIR_FREE(net->ifname);
+ }
+ break;
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
#ifdef VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP
--
2.3.3
9 years