|
|
ffd6ed |
From 4e28a0b054a80fe6f4ad09b584eac253b2b10c8b Mon Sep 17 00:00:00 2001
|
|
|
ffd6ed |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
ffd6ed |
Date: Wed, 6 May 2015 10:50:21 +0100
|
|
|
ffd6ed |
Subject: [PATCH] p2v: Add Configure Network button (RHBZ#1167921).
|
|
|
ffd6ed |
|
|
|
ffd6ed |
The old version of virt-p2v had a whole custom-written dialog which
|
|
|
ffd6ed |
interacted with NetworkManager over dbus. After trying that approach,
|
|
|
ffd6ed |
it's really complex to get right.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Instead this button simply opens NetworkManager's connection editor.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
This also adds nm-applet to the disk and starts it. However nm-applet
|
|
|
ffd6ed |
does not display any visible indication -- probably because we are
|
|
|
ffd6ed |
lacking a system tray.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(cherry picked from commit e464774a79ff9eeedcdb3fd53efd5a7898ca036e)
|
|
|
ffd6ed |
---
|
|
|
ffd6ed |
p2v/gui.c | 14 +++++++++++++-
|
|
|
ffd6ed |
p2v/launch-virt-p2v.in | 1 +
|
|
|
ffd6ed |
p2v/p2v.ks.in | 2 ++
|
|
|
ffd6ed |
p2v/virt-p2v-make-disk.in | 11 +++++++----
|
|
|
ffd6ed |
4 files changed, 23 insertions(+), 5 deletions(-)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/p2v/gui.c b/p2v/gui.c
|
|
|
ffd6ed |
index bba0c1c..43d6165 100644
|
|
|
ffd6ed |
--- a/p2v/gui.c
|
|
|
ffd6ed |
+++ b/p2v/gui.c
|
|
|
ffd6ed |
@@ -94,6 +94,7 @@ gui_application (struct config *config)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
static void test_connection_clicked (GtkWidget *w, gpointer data);
|
|
|
ffd6ed |
static void *test_connection_thread (void *data);
|
|
|
ffd6ed |
+static void configure_network_button_clicked (GtkWidget *w, gpointer data);
|
|
|
ffd6ed |
static void about_button_clicked (GtkWidget *w, gpointer data);
|
|
|
ffd6ed |
static void connection_next_clicked (GtkWidget *w, gpointer data);
|
|
|
ffd6ed |
static void repopulate_output_combo (struct config *config);
|
|
|
ffd6ed |
@@ -108,6 +109,7 @@ create_connection_dialog (struct config *config)
|
|
|
ffd6ed |
GtkWidget *password_label;
|
|
|
ffd6ed |
GtkWidget *test_hbox, *test;
|
|
|
ffd6ed |
GtkWidget *about;
|
|
|
ffd6ed |
+ GtkWidget *configure_network;
|
|
|
ffd6ed |
char port_str[64];
|
|
|
ffd6ed |
|
|
|
ffd6ed |
conn_dlg = gtk_dialog_new ();
|
|
|
ffd6ed |
@@ -198,7 +200,7 @@ create_connection_dialog (struct config *config)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
/* Buttons. */
|
|
|
ffd6ed |
gtk_dialog_add_buttons (GTK_DIALOG (conn_dlg),
|
|
|
ffd6ed |
- /* _("Configure network ..."), 1, */
|
|
|
ffd6ed |
+ _("Configure network ..."), 1,
|
|
|
ffd6ed |
_("About virt-p2v " PACKAGE_VERSION " ..."), 2,
|
|
|
ffd6ed |
_("Next"), 3,
|
|
|
ffd6ed |
NULL);
|
|
|
ffd6ed |
@@ -206,6 +208,8 @@ create_connection_dialog (struct config *config)
|
|
|
ffd6ed |
next_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 3);
|
|
|
ffd6ed |
gtk_widget_set_sensitive (next_button, FALSE);
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+ configure_network =
|
|
|
ffd6ed |
+ gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 1);
|
|
|
ffd6ed |
about = gtk_dialog_get_widget_for_response (GTK_DIALOG (conn_dlg), 2);
|
|
|
ffd6ed |
|
|
|
ffd6ed |
/* Signals. */
|
|
|
ffd6ed |
@@ -213,6 +217,8 @@ create_connection_dialog (struct config *config)
|
|
|
ffd6ed |
G_CALLBACK (gtk_main_quit), NULL);
|
|
|
ffd6ed |
g_signal_connect (G_OBJECT (test), "clicked",
|
|
|
ffd6ed |
G_CALLBACK (test_connection_clicked), config);
|
|
|
ffd6ed |
+ g_signal_connect (G_OBJECT (configure_network), "clicked",
|
|
|
ffd6ed |
+ G_CALLBACK (configure_network_button_clicked), NULL);
|
|
|
ffd6ed |
g_signal_connect (G_OBJECT (about), "clicked",
|
|
|
ffd6ed |
G_CALLBACK (about_button_clicked), NULL);
|
|
|
ffd6ed |
g_signal_connect (G_OBJECT (next_button), "clicked",
|
|
|
ffd6ed |
@@ -342,6 +348,12 @@ test_connection_thread (void *data)
|
|
|
ffd6ed |
}
|
|
|
ffd6ed |
|
|
|
ffd6ed |
static void
|
|
|
ffd6ed |
+configure_network_button_clicked (GtkWidget *w, gpointer data)
|
|
|
ffd6ed |
+{
|
|
|
ffd6ed |
+ ignore_value (system ("nm-connection-editor &"));
|
|
|
ffd6ed |
+}
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+static void
|
|
|
ffd6ed |
about_button_clicked (GtkWidget *w, gpointer data)
|
|
|
ffd6ed |
{
|
|
|
ffd6ed |
gtk_show_about_dialog (GTK_WINDOW (conn_dlg),
|
|
|
ffd6ed |
diff --git a/p2v/launch-virt-p2v.in b/p2v/launch-virt-p2v.in
|
|
|
ffd6ed |
index d2bafe3..e4a5a80 100755
|
|
|
ffd6ed |
--- a/p2v/launch-virt-p2v.in
|
|
|
ffd6ed |
+++ b/p2v/launch-virt-p2v.in
|
|
|
ffd6ed |
@@ -23,6 +23,7 @@
|
|
|
ffd6ed |
if [ "$1" = "run" ]; then
|
|
|
ffd6ed |
cd /
|
|
|
ffd6ed |
metacity &
|
|
|
ffd6ed |
+ nm-applet &
|
|
|
ffd6ed |
exec @libexecdir@/virt-p2v
|
|
|
ffd6ed |
else
|
|
|
ffd6ed |
xinit "$0" run
|
|
|
ffd6ed |
diff --git a/p2v/p2v.ks.in b/p2v/p2v.ks.in
|
|
|
ffd6ed |
index 6a3b24b..66ca025 100644
|
|
|
ffd6ed |
--- a/p2v/p2v.ks.in
|
|
|
ffd6ed |
+++ b/p2v/p2v.ks.in
|
|
|
ffd6ed |
@@ -69,6 +69,8 @@ metacity
|
|
|
ffd6ed |
pcre
|
|
|
ffd6ed |
libxml2
|
|
|
ffd6ed |
gtk2
|
|
|
ffd6ed |
+network-manager-applet
|
|
|
ffd6ed |
+dbus-x11
|
|
|
ffd6ed |
@hardware-support --optional
|
|
|
ffd6ed |
|
|
|
ffd6ed |
%end
|
|
|
ffd6ed |
diff --git a/p2v/virt-p2v-make-disk.in b/p2v/virt-p2v-make-disk.in
|
|
|
ffd6ed |
index 2bb364b..e2ea7f5 100644
|
|
|
ffd6ed |
--- a/p2v/virt-p2v-make-disk.in
|
|
|
ffd6ed |
+++ b/p2v/virt-p2v-make-disk.in
|
|
|
ffd6ed |
@@ -95,11 +95,14 @@ trap cleanup INT QUIT TERM EXIT ERR
|
|
|
ffd6ed |
# - some fonts
|
|
|
ffd6ed |
# - hardware support (firmware etc, RHBZ#1157679)
|
|
|
ffd6ed |
# - metacity (window manager, another could be used)
|
|
|
ffd6ed |
+# - NetworkManager
|
|
|
ffd6ed |
+# - nm-applet
|
|
|
ffd6ed |
+# - dbus-x11 (required by nm-applet, but not specified as a dep in Fedora)
|
|
|
ffd6ed |
#
|
|
|
ffd6ed |
# Note that libguestfs is NOT a dependency.
|
|
|
ffd6ed |
case "$osversion" in
|
|
|
ffd6ed |
centos-*|fedora-*|rhel-*|scientificlinux-*)
|
|
|
ffd6ed |
- deps=pcre,libxml2,gtk2,/usr/bin/xinit,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/Xorg,xorg-x11-drivers,xorg-x11-fonts-Type1,metacity,@hardware-support
|
|
|
ffd6ed |
+ deps=pcre,libxml2,gtk2,/usr/bin/xinit,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/Xorg,xorg-x11-drivers,xorg-x11-fonts-Type1,metacity,NetworkManager,network-manager-applet,dbus-x11,@hardware-support
|
|
|
ffd6ed |
cat > $tmpdir/p2v.conf <<'EOF'
|
|
|
ffd6ed |
add_drivers+=" usb-storage "
|
|
|
ffd6ed |
EOF
|
|
|
ffd6ed |
@@ -117,13 +120,13 @@ EOF
|
|
|
ffd6ed |
"
|
|
|
ffd6ed |
;;
|
|
|
ffd6ed |
debian-*|ubuntu-*)
|
|
|
ffd6ed |
- deps=libpcre3,libxml2,libgtk2.0-0,openssh-client,qemu-utils,xorg,xserver-xorg-video-all,metacity
|
|
|
ffd6ed |
+ deps=libpcre3,libxml2,libgtk2.0-0,openssh-client,qemu-utils,xorg,xserver-xorg-video-all,metacity,network-manager,network-manager-applet,dbus-x11
|
|
|
ffd6ed |
;;
|
|
|
ffd6ed |
archlinux-*)
|
|
|
ffd6ed |
- deps=pcre,libxml2,gtk2,openssh,qemu,xorg-xinit,xorg-server,xf86-video-*,metacity
|
|
|
ffd6ed |
+ deps=pcre,libxml2,gtk2,openssh,qemu,xorg-xinit,xorg-server,xf86-video-*,metacity,NetworkManager,network-manager-applet,dbus-x11
|
|
|
ffd6ed |
;;
|
|
|
ffd6ed |
opensuse-*|suse-*)
|
|
|
ffd6ed |
- deps=pcre,libxml2,gtk2,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/xinit,/usr/bin/Xorg,xf86-video-*,metacity
|
|
|
ffd6ed |
+ deps=pcre,libxml2,gtk2,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/xinit,/usr/bin/Xorg,xf86-video-*,metacity,NetworkManager,network-manager-applet,dbus-x11
|
|
|
ffd6ed |
;;
|
|
|
ffd6ed |
*)
|
|
|
ffd6ed |
echo "$program: internal error: could not work out the Linux distro from '$osversion'"
|
|
|
ffd6ed |
--
|
|
|
ffd6ed |
1.8.3.1
|
|
|
ffd6ed |
|