remove -M flag implementation
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12464 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -3468,7 +3468,7 @@ sub usage_dsh | ||||
|     my $usagemsg2  = "      [-B bypass ] [-c] [-e] [-E environment_file] | ||||
|       [--devicetype type_of_device] [-f fanout]\n"; | ||||
|     my $usagemsg3 = "      [-l user_ID] [-L]  "; | ||||
|     my $usagemsg4 = "[-m] [-M]  [-o options][-q] [-Q] [-r remote_shell] | ||||
|     my $usagemsg4 = "[-m] [-o options][-q] [-Q] [-r remote_shell] | ||||
|       [-i image] [-s] [-S ksh | csh] [-t timeout]\n"; | ||||
|     my $usagemsg5 = "      [-T] [-X environment variables] [-v] [-z]\n"; | ||||
|     my $usagemsg6 = "      <command_list>"; | ||||
| @@ -3560,7 +3560,6 @@ sub parse_and_run_dsh | ||||
|             'f|fanout=i'               => \$options{'fanout'}, | ||||
|             'h|help'                   => \$options{'help'}, | ||||
|             'l|user=s'                 => \$options{'user'}, | ||||
|             'M|mgmtnode'               => \$options{'mgmtnode'},  | ||||
|             'm|monitor'                => \$options{'monitor'}, | ||||
|             'o|node-options=s'         => \$options{'node-options'}, | ||||
|             'q|show-config'            => \$options{'show-config'}, | ||||
| @@ -3599,19 +3598,8 @@ sub parse_and_run_dsh | ||||
|         xCAT::DSHCLI->usage_dsh; | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     my $rsp = {}; | ||||
|     # if option management node and not on the management node exit error | ||||
|     if ($options{'mgmtnode'}) | ||||
|     { | ||||
|      if (!xCAT::Utils->isMN()) { | ||||
|         $rsp->{data}->[0] = | ||||
|           "To use the -M flag, the command must be run on the Management Node."; | ||||
|         xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); | ||||
|        return 1; | ||||
|      } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     if ($options{'show-config'}) | ||||
|     { | ||||
|         xCAT::DSHCLI->show_dsh_config; | ||||
| @@ -3654,23 +3642,12 @@ sub parse_and_run_dsh | ||||
|         $options{'user'} = $ENV{'DSH_TO_USERID'}; | ||||
|     } | ||||
|  | ||||
|     #  no nodes and not -i or -M option, error | ||||
|     if (!(defined(@$nodes))) { | ||||
|       if ((!(defined($options{'rootimg'}))) && (!(defined($options{'mgmtnode'})))) | ||||
|       {    | ||||
|     if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'})))) | ||||
|     {    #  no nodes and not -i option, error | ||||
|         my $rsp = (); | ||||
|         $rsp->{data}->[0] = "Unless using -i or -M  option,  noderange is required."; | ||||
|         $rsp->{data}->[0] = "Unless using -i option,  noderange is required."; | ||||
|         xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|     if ((defined($options{'rootimg'})) && (defined($options{'mgmtnode'}))) | ||||
|     {    | ||||
|         my $rsp = (); | ||||
|         $rsp->{data}->[0] = "Cannot use  -i and -M  options together."; | ||||
|         xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); | ||||
|         return; | ||||
|        | ||||
|     } | ||||
|     # Determine switch type, processing Mellanox not the same as QLogic | ||||
|     my $switchtype = $options{'devicetype'}; | ||||
| @@ -3871,25 +3848,21 @@ sub parse_and_run_dsh | ||||
|  | ||||
|         } | ||||
|     } | ||||
|     else  # run on MN and other nodes | ||||
|     else | ||||
|     { | ||||
|         # if running command on MN | ||||
|         if (defined $options{'mgmtnode'}) | ||||
|         { | ||||
|           @results = xCAT::DSHCLI->run_on_mgmtnode(\%options); | ||||
|           if ($::RUNCMD_RC) | ||||
|           {    # error from dsh | ||||
|             my $rsp = (); | ||||
|             $rsp->{data}->[0] = "Error from xdsh. Return Code = $::RUNCMD_RC"; | ||||
|             xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); | ||||
|  | ||||
|           } | ||||
|         } | ||||
|         # Execute xdsh to the nodes other than the MN | ||||
|         # | ||||
|         # Execute the dsh api | ||||
|         #@results = xCAT::DSHCLI->runDsh_api(\%options, 0); | ||||
|         #if ($::RUNCMD_RC) | ||||
|         #{    # error from dsh | ||||
|         #   $rsp->{data}->[0] = "Error from xdsh. Return Code = $::RUNCMD_RC"; | ||||
|         #  xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); | ||||
|  | ||||
|         #} | ||||
|         # Execute the dsh command | ||||
|         # number of nodes failed becomes the xdsh return code | ||||
|         if (defined(@$nodes)) {  # if there are other nodes in the command | ||||
|           $::FAILED_NODES = xCAT::DSHCLI->execute_dsh(\%options); | ||||
|         } | ||||
|         $::FAILED_NODES = xCAT::DSHCLI->execute_dsh(\%options); | ||||
|     } | ||||
|     return (@results); | ||||
| } | ||||
| @@ -3921,7 +3894,7 @@ sub usage_dcp | ||||
| { | ||||
|     ### usage message | ||||
|     my $usagemsg1 = " xdcp -h \n xdcp -q\n xdcp -V \n xdcp <noderange>\n"; | ||||
|     my $usagemsg2 = "      [-M] [-B bypass] [-c] [-f fanout] [-l user_ID]\n"; | ||||
|     my $usagemsg2 = "      [-B bypass] [-c] [-f fanout] [-l user_ID]\n"; | ||||
|     my $usagemsg3 = | ||||
|       "      [-o options] [-p] [-P] [-q] [-Q] [-r node_remote_copy]\n"; | ||||
|     my $usagemsg4 = | ||||
| @@ -4014,7 +3987,6 @@ sub parse_and_run_dcp | ||||
|                     'F|File=s'         => \$options{'File'}, | ||||
|                     'h|help'           => \$options{'help'}, | ||||
|                     'l|user=s'         => \$options{'user'}, | ||||
|                     'M|mgmtnode'       => \$options{'mgmtnode'},  | ||||
|                     'o|node-options=s' => \$options{'node-options'}, | ||||
|                     'q|show-config'    => \$options{'show-config'}, | ||||
|                     'p|preserve'       => \$options{'preserve'}, | ||||
| @@ -4044,16 +4016,6 @@ sub parse_and_run_dcp | ||||
|         usage_dcp; | ||||
|         return (0); | ||||
|     } | ||||
|     # if option management node and not on the management node exit error | ||||
|     if ($options{'mgmtnode'}) | ||||
|     { | ||||
|      if (!xCAT::Utils->isMN()) { | ||||
|         $rsp->{data}->[0] = | ||||
|           "To use the -M flag, the command must be run on the Management Node."; | ||||
|         xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); | ||||
|        return 1; | ||||
|      } | ||||
|     } | ||||
|     if ($options{'show-config'}) | ||||
|     { | ||||
|         xCAT::DSHCLI->show_dsh_config; | ||||
| @@ -4070,23 +4032,12 @@ sub parse_and_run_dcp | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
|     #  no nodes and not -i or -M option, error | ||||
|     if (!(defined(@$nodes))) { | ||||
|       if ((!(defined($options{'rootimg'}))) && (!(defined($options{'mgmtnode'})))) | ||||
|       {    | ||||
|     if ((!(defined(@$nodes))) && (!(defined($options{'rootimg'})))) | ||||
|     {    #  no nodes and not -i option, error | ||||
|         my $rsp = (); | ||||
|         $rsp->{data}->[0] = "Unless using -i or -M  option,  noderange is required."; | ||||
|         $rsp->{data}->[0] = "Unless using -i option,  noderange is required."; | ||||
|         xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|     if ((defined($options{'rootimg'})) && (defined($options{'mgmtnode'}))) | ||||
|     {    | ||||
|         my $rsp = (); | ||||
|         $rsp->{data}->[0] = "Cannot use  -i and -M  options together."; | ||||
|         xCAT::MsgUtils->message("E", $rsp, $::CALLBACK, 1); | ||||
|         return; | ||||
|        | ||||
|     } | ||||
|  | ||||
|     if ($options{'version'}) | ||||
| @@ -5095,31 +5046,6 @@ sub run_always_rsync_postscripts | ||||
| } | ||||
| #------------------------------------------------------------------------------- | ||||
|  | ||||
| =head3 | ||||
|       run_on_mgmtnode | ||||
|  | ||||
|   This subroutine runs the xdsh command on the Management Node | ||||
|   Arguments: | ||||
|       $optionRef: | ||||
|          Specifies a hash in which the xdsh options are provided | ||||
|       $exitCode: | ||||
| 		  reference to an array for efficiency. | ||||
|   Example: | ||||
|       my @outref = xCAT::DSHCLI->run_on_mgmtnode(\%options); | ||||
|  | ||||
|  | ||||
| =cut | ||||
|  | ||||
| #------------------------------------------------------------------------------- | ||||
|  | ||||
| sub run_on_mgmtnode | ||||
| { | ||||
|     my ($class, $options) = @_; | ||||
|     my $cmd; | ||||
|     return; | ||||
| } | ||||
| #------------------------------------------------------------------------------- | ||||
|  | ||||
| =head3 | ||||
|       runlocal_on_rootimg | ||||
|  | ||||
| @@ -5131,7 +5057,7 @@ sub run_on_mgmtnode | ||||
|       $exitCode: | ||||
| 		  reference to an array for efficiency. | ||||
|   Example: | ||||
|       my @outref = xCAT::DSHCLI->runlocal_rootimg(\%options,$imagename); | ||||
|       my @outref = xCAT::DSHCLI->runlocal_rootimg(\%options); | ||||
|  | ||||
|  | ||||
| =cut | ||||
|   | ||||
		Reference in New Issue
	
	Block a user