mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	Add ondiscover support for chain table (#4903)
* Add ondiscover support for chain table * For ondiscover, run nextdestiny after the current operation is done * Don't set OpenPower server boot from network if boot
This commit is contained in:
		| @@ -359,17 +359,17 @@ while :; do | ||||
| 		logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." | ||||
| 		destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` | ||||
| 		logger -s -t $log_label -p local4.info "nextdestiny - Complete." | ||||
|         elif [ "$dest" = ondiscover ]; then | ||||
| 		logger -s -t $log_label -p local4.info "Running nextdestiny (ondiscover) $XCATMASTER:$XCATPORT..." | ||||
| 		destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` | ||||
| 		logger -s -t $log_label -p local4.info "nextdestiny (ondiscover) - Complete." | ||||
| 	elif [ "$dest" = runcmd ]; then | ||||
| 		$destparameter | ||||
| 		logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." | ||||
| 		destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` | ||||
| 		dest=`echo $destiny|awk -F= '{print $1}'` | ||||
| 		$destparameter | ||||
| 		logger -s -t $log_label -p local4.info "nextdestiny - Complete." | ||||
| 	elif [ "$dest" = runimage ]; then | ||||
| 		logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." | ||||
| 		destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` | ||||
| 		dest=`echo $destiny|awk -F= '{print $1}'` | ||||
| 		logger -s -t $log_label -p local4.info "nextdestiny - Complete." | ||||
| 		mkdir /tmp/`basename $destparameter` | ||||
| 		cd /tmp/`basename $destparameter` | ||||
| 		eval destparameter=$destparameter | ||||
| @@ -389,12 +389,20 @@ while :; do | ||||
| 		tar xvf `basename $destparameter` | ||||
| 		./runme.sh | ||||
| 		cd - | ||||
|                 logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." | ||||
| 		destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` | ||||
| 		dest=`echo $destiny|awk -F= '{print $1}'` | ||||
| 		logger -s -t $log_label -p local4.info "nextdestiny - Complete." | ||||
|  | ||||
| 	elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then | ||||
| 		logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." | ||||
| 		/bin/nextdestiny $XCATMASTER:$XCATPORT | ||||
| 		logger -s -t $log_label -p local4.info "nextdestiny - Complete." | ||||
| 		if [ $IPMI_SUPPORT -ne 0 ]; then | ||||
| 		    ipmitool chassis bootdev pxe | ||||
|                     # Set boot from network will cause OpenPOWER server wait at petitboot menu, so do nothing here | ||||
|                     if uname -m | grep x86_64; then | ||||
| 		        ipmitool chassis bootdev pxe | ||||
|                     fi | ||||
| 		fi | ||||
| 		reboot -f | ||||
| 	elif [ "$dest" = "install" -o "$dest" = "netboot" ]; then | ||||
|   | ||||
| @@ -226,6 +226,25 @@ sub setdestiny { | ||||
|             if ($ient->{initrd})   { $bphash->{initrd}   = $ient->{initrd} } | ||||
|             if ($ient->{kcmdline}) { $bphash->{kcmdline} = $ient->{kcmdline} } | ||||
|         } | ||||
|     } elsif ($state =~ /ondiscover/) { | ||||
|         my $target; | ||||
|         if ($state =~ /=/) { | ||||
|             ($state, $target) = split '=', $state, 2; | ||||
|         } | ||||
|         if(!$target){ | ||||
|             $callback->({ error => "invalid argument: \"$state\"", errorcode => [1] }); | ||||
|             return; | ||||
|         } | ||||
|         my @cmds = split '\|', $target; | ||||
|         foreach my $tmpnode (@{ $req->{node} }) { | ||||
|             foreach my $cmd (@cmds) { | ||||
|                 my $action; | ||||
|                ($cmd, $action) = split ':', $cmd; | ||||
|                 my $runcmd = "$cmd $tmpnode $action"; | ||||
|                 xCAT::Utils->runcmd($runcmd, 0); | ||||
|                 xCAT::MsgUtils->trace($verbose, "d", "run ondiscover command: $runcmd"); | ||||
|             } | ||||
|         } | ||||
|     } elsif ($state =~ /^install[=\$]/ or $state eq 'install' or $state =~ /^netboot[=\$]/ or $state eq 'netboot' or $state eq "image" or $state eq "winshell" or $state =~ /^osimage/ or $state =~ /^statelite/) { | ||||
|         my $target; | ||||
|         my $action; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user