diff --git a/perl-xCAT/xCAT/Scope.pm b/perl-xCAT/xCAT/Scope.pm index 39bb3da44..215709361 100644 --- a/perl-xCAT/xCAT/Scope.pm +++ b/perl-xCAT/xCAT/Scope.pm @@ -219,6 +219,10 @@ sub get_broadcast_disjoint_scope_with_parallel { my $reqs = get_parallel_scope($req); my $handled4me = 0; # indicate myself is already handled. + if (xCAT::Utils->isMN()) { # For MN, add itself always. + push @requests, @$reqs; + $handled4me = 1; + } my %prehandledhash = ();# the servers which is already handled. foreach (@$extras) { my $xcatdest = $_; diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 13ce40aa4..b402164a9 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -978,48 +978,6 @@ sub check_options return 0; } - # if not help and not -n, dhcpd needs to be running - if (!($opt->{h}) && (!($opt->{n}))) { - if (xCAT::Utils->isLinux()) { - - #my $DHCPSERVER="dhcpd"; - #if( -e "/etc/init.d/isc-dhcp-server" ){ - # $DHCPSERVER="isc-dhcp-server"; - #} - - #my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1); - #if ($::RUNCMD_RC != 0) { # not running - my $ret = 0; - $ret = xCAT::Utils->checkservicestatus("dhcp"); - if ($ret != 0) - { - my $rsp = {}; - $rsp->{data}->[0] = "dhcp server is not running. please start the dhcp server."; - xCAT::MsgUtils->message("E", $rsp, $callback, 1); - return 1; - } - } else { # AIX - my @output = xCAT::Utils->runcmd("lssrc -s dhcpsd ", -1); - if ($::RUNCMD_RC != 0) { # not running - my $rsp = {}; - $rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command."; - xCAT::MsgUtils->message("E", $rsp, $callback, 1); - return 1; - } else { # check the status - # the return output varies, sometime status is the third sometimes the 4th col - if (grep /inoperative/, @output) - { - my $rsp = {}; - $rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command."; - xCAT::MsgUtils->message("E", $rsp, $callback, 1); - return 1; - - } - } - } - } - - # check to see if -q is listed with any other options which is not allowed if ($opt->{q} and ($opt->{a} || $opt->{d} || $opt->{n} || $opt->{r} || $opt->{l} || $statements)) { my $rsp = {}; @@ -1132,9 +1090,11 @@ sub preprocess_request xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: dhcp server on $_->{net}: $_->{dhcpserver}"); } } + } elsif ($snonly == 1) { + $snonly = 0; + xCAT::MsgUtils->trace($verbose_on_off, "d", "dhcp: disjointdhcps mode is disabled as no service nodes are running dhcp service."); } - my @nodes = (); # if the new option is not specified @@ -1381,17 +1341,6 @@ sub process_request return []; } - - # if option is query then call listnode for each node and return - if ($opt{q}) - { - # call listnode for each node requested - foreach my $node (@{ $req->{node} }) { - listnode($node, $callback); - } - return; - } - # if current node is a servicenode, make sure that it is also a dhcpserver my $isok = 1; if (xCAT::Utils->isServiceNode()) { @@ -1413,6 +1362,57 @@ sub process_request return; } + # if not -n, dhcpd needs to be running + if (!($opt{n})) { + if (xCAT::Utils->isLinux()) { + + #my $DHCPSERVER="dhcpd"; + #if( -e "/etc/init.d/isc-dhcp-server" ){ + # $DHCPSERVER="isc-dhcp-server"; + #} + + #my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1); + #if ($::RUNCMD_RC != 0) { # not running + my $ret = 0; + $ret = xCAT::Utils->checkservicestatus("dhcp"); + if ($ret != 0) + { + my $rsp = {}; + $rsp->{data}->[0] = "dhcp server is not running. please start the dhcp server."; + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + return; + } + } else { # AIX + my @output = xCAT::Utils->runcmd("lssrc -s dhcpsd ", -1); + if ($::RUNCMD_RC != 0) { # not running + my $rsp = {}; + $rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command."; + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + return; + } else { # check the status + # the return output varies, sometime status is the third sometimes the 4th col + if (grep /inoperative/, @output) + { + my $rsp = {}; + $rsp->{data}->[0] = "dhcpsd is not running. Run startsrc -s dhcpsd and rerun your command."; + xCAT::MsgUtils->message("E", $rsp, $callback, 1); + return; + + } + } + } + } + + # if option is query then call listnode for each node and return + if ($opt{q}) + { + # call listnode for each node requested + foreach my $node (@{ $req->{node} }) { + listnode($node, $callback); + } + return; + } + my $servicenodetab = xCAT::Table->new('servicenode'); my @nodeinfo = xCAT::NetworkUtils->determinehostname; my $nodename = pop @nodeinfo; # get hostname