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

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Feb 6 06:53:41 CET 2019


Am 2/4/19 um 2:02 PM schrieb Oguz Bektas:
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>  proxinstall | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)

looks OK, did you run into the situation where multiple dhclient processes
listened on a single interface or is the killall just precautionary?
Anyway, as this is not to urgent I'll have it at the back of my queue,
but I didn't oversee it, just FYI.

> 
> 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);
>  
> 




More information about the pve-devel mailing list