Skip to content

Commit

Permalink
Merge pull request #7465 from jlausuch/wicked_fix_dhcp_restart
Browse files Browse the repository at this point in the history
Wicked: Fix issue with restarting dhcp
  • Loading branch information
asmorodskyi committed May 15, 2019
2 parents e6b8f26 + 36fef17 commit 1f7fae7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/wickedbase.pm
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,21 @@ sub validate_macvtap {
validate_script_output("cat $macvtap_log", sub { m/Success listening to tap device/ });
}

sub wait_for_dhcpd {
my ($self) = @_;
my $timeout = 60;
while ($timeout > 0) {
if (!systemctl('is-active dhcpd.service', ignore_failure => 1)) {
record_info('DHCP', 'dhcp active');
return 1;
}
$timeout -= 1;
sleep 1;
}
systemctl('status dhcpd.service');
die('DHCP not comming up');
}

sub post_run {
my ($self) = @_;
$self->{wicked_post_run} = 1;
Expand Down
4 changes: 3 additions & 1 deletion tests/wicked/basic/ref/t08_setup_second_card.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ use lockapi;
sub run {
my ($self, $ctx) = @_;
record_info('Info', 'Set up a second card');
systemctl 'stop dhcpd.service';
$self->get_from_data('wicked/dhcp/dhcpd_2nics.conf', '/etc/dhcpd.conf');
systemctl 'restart dhcpd.service';
systemctl 'start dhcpd.service';
$self->wait_for_dhcpd();
die("Create mutex failed") unless mutex_create('t08_dhcpd_setup_complete');
}

Expand Down

0 comments on commit 1f7fae7

Please sign in to comment.