|
|
97ae69 |
From af775f107327930e5d81bd63b5c682bb6925ba21 Mon Sep 17 00:00:00 2001
|
|
|
0d20ef |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
0d20ef |
Date: Thu, 2 Oct 2014 16:44:07 +0100
|
|
|
0d20ef |
Subject: [PATCH] RHEL 7: Revert "launch: libvirt: Use qemu-bridge-helper to
|
|
|
0d20ef |
implement a full network (RHBZ#1148012)."
|
|
|
0d20ef |
|
|
|
0d20ef |
This reverts commit 224de20b9a8d5ea56f6337f19b4ca237bb88eca0.
|
|
|
0d20ef |
---
|
|
|
90a56e |
lib/guestfs.pod | 10 ----------
|
|
|
90a56e |
lib/launch-libvirt.c | 44 +++++++++++++++++++++-----------------------
|
|
|
0d20ef |
2 files changed, 21 insertions(+), 33 deletions(-)
|
|
|
0d20ef |
|
|
|
90a56e |
diff --git a/lib/guestfs.pod b/lib/guestfs.pod
|
|
|
97ae69 |
index 684f8dc6c..0b8c9f7d2 100644
|
|
|
90a56e |
--- a/lib/guestfs.pod
|
|
|
90a56e |
+++ b/lib/guestfs.pod
|
|
|
97ae69 |
@@ -1451,16 +1451,6 @@ On Fedora, install C<kernel-debuginfo> for the C<vmlinux> file
|
|
|
0d20ef |
(containing symbols). Make sure the symbols precisely match the
|
|
|
0d20ef |
kernel being used.
|
|
|
0d20ef |
|
|
|
0d20ef |
-=head3 network_bridge
|
|
|
0d20ef |
-
|
|
|
0d20ef |
-The libvirt backend supports:
|
|
|
0d20ef |
-
|
|
|
0d20ef |
- export LIBGUESTFS_BACKEND_SETTINGS=network_bridge=virbrX
|
|
|
0d20ef |
-
|
|
|
0d20ef |
-This allows you to override the bridge that is connected to when the
|
|
|
0d20ef |
-network is enabled. The default is C<virbr0>. See also
|
|
|
0d20ef |
-L</guestfs_set_network>.
|
|
|
0d20ef |
-
|
|
|
0d20ef |
=head2 ATTACHING TO RUNNING DAEMONS
|
|
|
0d20ef |
|
|
|
0d20ef |
I<Note (1):> This is B<highly experimental> and has a tendency to eat
|
|
|
90a56e |
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
|
|
|
97ae69 |
index 844023b80..f0f52fba0 100644
|
|
|
90a56e |
--- a/lib/launch-libvirt.c
|
|
|
90a56e |
+++ b/lib/launch-libvirt.c
|
|
|
e76f14 |
@@ -115,7 +115,6 @@ struct backend_libvirt_data {
|
|
|
0d20ef |
char *selinux_label;
|
|
|
0d20ef |
char *selinux_imagelabel;
|
|
|
0d20ef |
bool selinux_norelabel_disks;
|
|
|
0d20ef |
- char *network_bridge;
|
|
|
0d20ef |
char name[DOMAIN_NAME_LEN]; /* random name */
|
|
|
0d20ef |
bool is_kvm; /* false = qemu, true = kvm (from capabilities)*/
|
|
|
90a56e |
struct version libvirt_version; /* libvirt version */
|
|
|
97ae69 |
@@ -437,12 +436,6 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
|
|
|
0d20ef |
guestfs_get_backend_setting (g, "internal_libvirt_imagelabel");
|
|
|
0d20ef |
data->selinux_norelabel_disks =
|
|
|
e76f14 |
guestfs_int_get_backend_setting_bool (g, "internal_libvirt_norelabel_disks");
|
|
|
0d20ef |
- if (g->enable_network) {
|
|
|
0d20ef |
- data->network_bridge =
|
|
|
0d20ef |
- guestfs_get_backend_setting (g, "network_bridge");
|
|
|
0d20ef |
- if (!data->network_bridge)
|
|
|
0d20ef |
- data->network_bridge = safe_strdup (g, "virbr0");
|
|
|
0d20ef |
- }
|
|
|
0d20ef |
guestfs_pop_error_handler (g);
|
|
|
0d20ef |
|
|
|
e76f14 |
if (g->enable_network && check_bridge_exists (g, data->network_bridge) == -1)
|
|
|
97ae69 |
@@ -1402,19 +1395,6 @@ construct_libvirt_xml_devices (guestfs_h *g,
|
|
|
0d20ef |
} end_element ();
|
|
|
0d20ef |
} end_element ();
|
|
|
0d20ef |
|
|
|
0d20ef |
- /* Connect to libvirt bridge (see: RHBZ#1148012). */
|
|
|
0d20ef |
- if (g->enable_network) {
|
|
|
0d20ef |
- start_element ("interface") {
|
|
|
0d20ef |
- attribute ("type", "bridge");
|
|
|
0d20ef |
- start_element ("source") {
|
|
|
0d20ef |
- attribute ("bridge", params->data->network_bridge);
|
|
|
0d20ef |
- } end_element ();
|
|
|
0d20ef |
- start_element ("model") {
|
|
|
0d20ef |
- attribute ("type", "virtio");
|
|
|
0d20ef |
- } end_element ();
|
|
|
0d20ef |
- } end_element ();
|
|
|
0d20ef |
- }
|
|
|
0d20ef |
-
|
|
|
90a56e |
/* Libvirt adds some devices by default. Indicate to libvirt
|
|
|
90a56e |
* that we don't want them.
|
|
|
90a56e |
*/
|
|
|
97ae69 |
@@ -1810,6 +1790,27 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g,
|
|
|
0d20ef |
attribute ("value", tmpdir);
|
|
|
0d20ef |
} end_element ();
|
|
|
0d20ef |
|
|
|
0d20ef |
+ /* Workaround because libvirt user networking cannot specify "net="
|
|
|
0d20ef |
+ * parameter.
|
|
|
0d20ef |
+ */
|
|
|
0d20ef |
+ if (g->enable_network) {
|
|
|
0d20ef |
+ start_element ("qemu:arg") {
|
|
|
0d20ef |
+ attribute ("value", "-netdev");
|
|
|
0d20ef |
+ } end_element ();
|
|
|
0d20ef |
+
|
|
|
0d20ef |
+ start_element ("qemu:arg") {
|
|
|
0d20ef |
+ attribute ("value", "user,id=usernet,net=169.254.0.0/16");
|
|
|
0d20ef |
+ } end_element ();
|
|
|
0d20ef |
+
|
|
|
0d20ef |
+ start_element ("qemu:arg") {
|
|
|
0d20ef |
+ attribute ("value", "-device");
|
|
|
0d20ef |
+ } end_element ();
|
|
|
0d20ef |
+
|
|
|
0d20ef |
+ start_element ("qemu:arg") {
|
|
|
97ae69 |
+ attribute ("value", VIRTIO_DEVICE_NAME ("virtio-net") ",netdev=usernet");
|
|
|
0d20ef |
+ } end_element ();
|
|
|
0d20ef |
+ }
|
|
|
0d20ef |
+
|
|
|
0d20ef |
/* The qemu command line arguments requested by the caller. */
|
|
|
0d20ef |
for (hp = g->hv_params; hp; hp = hp->next) {
|
|
|
0d20ef |
start_element ("qemu:arg") {
|
|
|
97ae69 |
@@ -2135,9 +2136,6 @@ shutdown_libvirt (guestfs_h *g, void *datav, int check_for_errors)
|
|
|
0d20ef |
free (data->selinux_imagelabel);
|
|
|
0d20ef |
data->selinux_imagelabel = NULL;
|
|
|
0d20ef |
|
|
|
0d20ef |
- free (data->network_bridge);
|
|
|
0d20ef |
- data->network_bridge = NULL;
|
|
|
0d20ef |
-
|
|
|
e76f14 |
for (i = 0; i < data->nr_secrets; ++i)
|
|
|
e76f14 |
free (data->secrets[i].secret);
|
|
|
e76f14 |
free (data->secrets);
|
|
|
0d20ef |
--
|
|
|
c71420 |
2.20.1
|
|
|
0d20ef |
|