From 67133474cb7914e4666392eb02f8c24cfa083586 Mon Sep 17 00:00:00 2001
Message-Id: <67133474cb7914e4666392eb02f8c24cfa083586@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 8 Nov 2016 13:42:08 +0100
Subject: [PATCH] qemuBuildHostNetStr: Explicitly enumerate net types
RHEL-7.3: https://bugzilla.redhat.com/show_bug.cgi?id=1366108
RHEL-7.3.z: https://bugzilla.redhat.com/show_bug.cgi?id=1392032
We tend to prevent using 'default' in switches. And it is for a
good reason - control may end up in paths we wouldn't want for
new values. In this specific case, if qemuBuildHostNetStr is
called over VIR_DOMAIN_NET_TYPE_VHOSTUSER it would produce
meaningless output. Fortunately, there no such call yet.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 1dcbef8a0f4bdfb25bf6b8cac08afd1a589c1ccd)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 8bebe437a..d88ee5b6b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3676,9 +3676,21 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
break;
case VIR_DOMAIN_NET_TYPE_USER:
- default:
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
virBufferAddLit(&buf, "user");
break;
+
+ case VIR_DOMAIN_NET_TYPE_HOSTDEV:
+ /* Should have been handled earlier via PCI/USB hotplug code. */
+ virObjectUnref(cfg);
+ return NULL;
+
+ case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+ /* Unsupported yet. */
+ break;
+
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
if (vlan >= 0) {
--
2.11.0