|
|
e76f14 |
From 59f2770eb35f03d61fc708a6241628c83c4f786a 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 |
---
|
|
|
0d20ef |
src/guestfs.pod | 10 ----------
|
|
|
0d20ef |
src/launch-libvirt.c | 44 +++++++++++++++++++++-----------------------
|
|
|
0d20ef |
2 files changed, 21 insertions(+), 33 deletions(-)
|
|
|
0d20ef |
|
|
|
0d20ef |
diff --git a/src/guestfs.pod b/src/guestfs.pod
|
|
|
e76f14 |
index 17d9a62..af30406 100644
|
|
|
0d20ef |
--- a/src/guestfs.pod
|
|
|
0d20ef |
+++ b/src/guestfs.pod
|
|
|
e76f14 |
@@ -1432,16 +1432,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
|
|
|
0d20ef |
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
|
|
|
e76f14 |
index ec23fab..38ca4a5 100644
|
|
|
0d20ef |
--- a/src/launch-libvirt.c
|
|
|
0d20ef |
+++ b/src/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)*/
|
|
|
e76f14 |
unsigned long libvirt_version; /* libvirt version */
|
|
|
e76f14 |
@@ -422,12 +421,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)
|
|
|
e76f14 |
@@ -1366,19 +1359,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 |
-
|
|
|
0d20ef |
} end_element (); /* </devices> */
|
|
|
0d20ef |
|
|
|
0d20ef |
return 0;
|
|
|
e76f14 |
@@ -1741,6 +1721,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") {
|
|
|
0d20ef |
+ attribute ("value", 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") {
|
|
|
e76f14 |
@@ -2056,9 +2057,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 |
--
|
|
|
0d20ef |
1.8.3.1
|
|
|
0d20ef |
|