mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0010-RHEL-7-Revert-launch-libvirt-Better-error-when-bridg.patch

90a56e
From 39c453f02083fa1b17a826a3b44b3405b601d792 Mon Sep 17 00:00:00 2001
e76f14
From: "Richard W.M. Jones" <rjones@redhat.com>
e76f14
Date: Mon, 21 Sep 2015 12:38:50 -0400
e76f14
Subject: [PATCH] RHEL 7: Revert "launch: libvirt: Better error when bridge /
e76f14
 virbr0 doesn't exist (RHBZ#1262127)."
e76f14
e76f14
This reverts commit edcd02a965ae6675c0ee9ecd8d98a1a641c6ef60.
e76f14
---
90a56e
 lib/launch-libvirt.c | 47 -----------------------------------------------
e76f14
 1 file changed, 47 deletions(-)
e76f14
90a56e
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
90a56e
index bc5d4d2..0c2879d 100644
90a56e
--- a/lib/launch-libvirt.c
90a56e
+++ b/lib/launch-libvirt.c
90a56e
@@ -155,7 +155,6 @@ static int is_blk (const char *path);
e76f14
 static void ignore_errors (void *ignore, virErrorPtr ignore2);
e76f14
 static void set_socket_create_context (guestfs_h *g);
e76f14
 static void clear_socket_create_context (guestfs_h *g);
e76f14
-static int check_bridge_exists (guestfs_h *g, const char *brname);
e76f14
 
e76f14
 #if HAVE_LIBSELINUX
e76f14
 static void selinux_warning (guestfs_h *g, const char *func, const char *selinux_op, const char *data);
90a56e
@@ -437,9 +436,6 @@ launch_libvirt (guestfs_h *g, void *datav, const char *libvirt_uri)
e76f14
     guestfs_int_get_backend_setting_bool (g, "internal_libvirt_norelabel_disks");
e76f14
   guestfs_pop_error_handler (g);
e76f14
 
e76f14
-  if (g->enable_network && check_bridge_exists (g, data->network_bridge) == -1)
e76f14
-    goto cleanup;
e76f14
-
e76f14
   /* Locate and/or build the appliance. */
e76f14
   TRACE0 (launch_build_libvirt_appliance_start);
e76f14
 
90a56e
@@ -2009,49 +2005,6 @@ is_blk (const char *path)
e76f14
   return S_ISBLK (statbuf.st_mode);
e76f14
 }
e76f14
 
e76f14
-static int
e76f14
-is_dir (const char *path)
e76f14
-{
e76f14
-  struct stat statbuf;
e76f14
-
e76f14
-  if (stat (path, &statbuf) == -1)
e76f14
-    return 0;
e76f14
-  return S_ISDIR (statbuf.st_mode);
e76f14
-}
e76f14
-
e76f14
-/* Used to check the network_bridge exists, or give a useful error
e76f14
- * message.
e76f14
- */
e76f14
-static int
e76f14
-check_bridge_exists (guestfs_h *g, const char *brname)
e76f14
-{
e76f14
-  CLEANUP_FREE char *path = NULL;
e76f14
-
e76f14
-  /* If this doesn't look like Linux, give up. */
e76f14
-  if (!is_dir ("/sys/class/net"))
e76f14
-    return 0;
e76f14
-
e76f14
-  /* Does the interface exist and is it a bridge? */
e76f14
-  path = safe_asprintf (g, "/sys/class/net/%s/bridge", brname);
e76f14
-  if (is_dir (path))
e76f14
-    return 0;
e76f14
-
e76f14
-  error (g,
e76f14
-         _("bridge '%s' not found.  Try running:\n"
e76f14
-           "\n"
e76f14
-           "  brctl show\n"
e76f14
-           "\n"
e76f14
-           "to get a list of bridges on the host, and then selecting the\n"
e76f14
-           "bridge you wish the appliance network to connect to using:\n"
e76f14
-           "\n"
e76f14
-           "  export LIBGUESTFS_BACKEND_SETTINGS=network_bridge=<bridge name>\n"
e76f14
-           "\n"
e76f14
-           "You may also need to allow the bridge in /etc/qemu/bridge.conf.\n"
e76f14
-           "For further information see guestfs(3)."),
e76f14
-	 brname);
e76f14
-  return -1;
e76f14
-}
e76f14
-
e76f14
 static void
e76f14
 ignore_errors (void *ignore, virErrorPtr ignore2)
e76f14
 {
e76f14
-- 
90a56e
2.9.4
e76f14