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

Oguz Bektas o.bektas at proxmox.com
Wed Feb 6 10:15:14 CET 2019


On Wed, Feb 06, 2019 at 06:53:41AM +0100, Thomas Lamprecht wrote:
> 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.
i did run into this situation. it happens when you choose an interface
which can't do a dhcp lease, so it keeps waiting and doesn't get
killed by 'dhclient -r' when you press the button again, resulting in
multiple processes.
> 
> > 
> > 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