[pve-devel] [RFC 1/1 v2 installer] add button for renewing dhcp lease

Oguz Bektas o.bektas at proxmox.com
Mon Feb 4 14:02:25 CET 2019


Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 proxinstall | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/proxinstall b/proxinstall
index f2414db..c0887b5 100755
--- a/proxinstall
+++ b/proxinstall
@@ -2052,12 +2052,27 @@ sub create_ipconf_view {
 	$device_cb->set_active(0);
     }
 
+    my $dhcp_button = Gtk3::Button->new_from_icon_name('view-refresh', 1);
+    $dhcp_button->set_tooltip_text("Renew DHCP Lease on interface");
+    $dhcp_button->signal_connect(clicked => sub {
+	# release current dhcp lease
+	run_command("dhclient -r");
+	# killall dhclient instances just in case,
+	# otherwise we might get multiple processes
+	# running on the same interface
+	run_command("killall dhclient || true");
+	# attempt new lease with the given management interface
+	run_command("dhclient -v $config->{mngmt_nic}");
+	create_ipconf_view();
+    });
+
     my $devicebox = Gtk3::HBox->new(0, 0);
     my $label = Gtk3::Label->new("Management Interface:");
     $label->set_size_request(150, -1);
     $label->set_alignment(1, 0.5);
     $devicebox->pack_start($label, 0, 0, 10);
     $devicebox->pack_start($device_cb, 0, 0, 0);
+    $devicebox->pack_start($dhcp_button, 0, 0, 0);
 
     $vbox2->pack_start($devicebox, 0, 0, 2);
 
-- 
2.11.0





More information about the pve-devel mailing list