mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-04 05:12:30 +00:00 
			
		
		
		
	Use rinstall to replace nodeset to boot into genesis
close-issue: #1174
This commit is contained in:
		@@ -33,12 +33,11 @@ Traditionally, network interfaces in Linux are enumerated as eth[0123...], but t
 | 
			
		||||
 | 
			
		||||
\ **getadapter**\  use genesis to collect network adapters information, so that mean it need to restart the target node.
 | 
			
		||||
 | 
			
		||||
\ **getadapter**\  follows below scheme:
 | 
			
		||||
\ **getadapter**\  For each node within the <noderange>, follows below scheme:
 | 
			
		||||
 | 
			
		||||
If the target node is scaned for the first time, \ **getadapter**\  will trigger genesis to collect information then save the information at local.
 | 
			
		||||
If the target node has ever been scaned, i.e. this node has network device information in local, \ **getadapter**\  use the local information first.
 | 
			
		||||
If user doesn't want to use local information, can use \ **-f**\  option to force to trigger new round scan process.
 | 
			
		||||
if part nodes of \ *noderange*\  don't have network device information in local and the rest have, \ **getadapter**\  only trigger real scan process for these nodes which don't have local information, the nodes have network device information in local, \ **getadapter**\  still use the local information first.
 | 
			
		||||
If the target node is scaned for the first time, \ **getadapter**\  will trigger genesis to collect information then save the information at the \ **nicsadapter**\  column of nics table.
 | 
			
		||||
If the target node has ever been scaned,  \ **getadapter**\  will use the information from nics table first.
 | 
			
		||||
If user hopes to scan the adapter information for the node but these information already exist, \ **-f**\  option can be used to start rescan process.
 | 
			
		||||
 | 
			
		||||
\ **getadapter**\  tries to collect more information for the  target network device,  but doesn't guarantee collect same much information for every network device.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -14,12 +14,11 @@ Traditionally, network interfaces in Linux are enumerated as eth[0123...], but t
 | 
			
		||||
 | 
			
		||||
B<getadapter> use genesis to collect network adapters information, so that mean it need to restart the target node.
 | 
			
		||||
 | 
			
		||||
B<getadapter> follows below scheme:
 | 
			
		||||
B<getadapter> For each node within the <noderange>, follows below scheme:
 | 
			
		||||
 | 
			
		||||
If the target node is scaned for the first time, B<getadapter> will trigger genesis to collect information then save the information at local.
 | 
			
		||||
If the target node has ever been scaned, i.e. this node has network device information in local, B<getadapter> use the local information first.
 | 
			
		||||
If user doesn't want to use local information, can use B<-f> option to force to trigger new round scan process.
 | 
			
		||||
if part nodes of I<noderange> don't have network device information in local and the rest have, B<getadapter> only trigger real scan process for these nodes which don't have local information, the nodes have network device information in local, B<getadapter> still use the local information first.
 | 
			
		||||
If the target node is scaned for the first time, B<getadapter> will trigger genesis to collect information then save the information at the B<nicsadapter> column of nics table.
 | 
			
		||||
If the target node has ever been scaned,  B<getadapter> will use the information from nics table first.
 | 
			
		||||
If user hopes to scan the adapter information for the node but these information already exist, B<-f> option can be used to start rescan process.
 | 
			
		||||
 | 
			
		||||
B<getadapter> tries to collect more information for the  target network device,  but doesn't guarantee collect same much information for every network device.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -304,66 +304,16 @@ sub deploy_genesis {
 | 
			
		||||
        my ($node, $node_desc_ptr, $callback, $subreq) = @_;
 | 
			
		||||
        my $outref = xCAT::Utils->runxcmd(
 | 
			
		||||
            {
 | 
			
		||||
                command => ['nodeset'],
 | 
			
		||||
                command => ['rinstall'],
 | 
			
		||||
                node    => ["$node"],
 | 
			
		||||
                arg     => ['runcmd=getadapter'],
 | 
			
		||||
            },
 | 
			
		||||
            $subreq, 0, 1);
 | 
			
		||||
        if ($::RUNCMD_RC != 0) {
 | 
			
		||||
            $callback->({ error => "failed to run command: nodeset $node runcmd=getadapter", errorcode => 1 });
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        # TODO: use rinstall to replace the following code when rinstall is ready.
 | 
			
		||||
        if ($node_desc_ptr->{mgt} eq "ipmi") {
 | 
			
		||||
            $outref = xCAT::Utils->runxcmd(
 | 
			
		||||
                {
 | 
			
		||||
                    command => ["rsetboot"],
 | 
			
		||||
                    node    => ["$node"],
 | 
			
		||||
                    arg     => ['net'],
 | 
			
		||||
                },
 | 
			
		||||
                $subreq, 0, 1);
 | 
			
		||||
            if ($::RUNCMD_RC != 0) {
 | 
			
		||||
                $callback->({ error => "failed to run command: rsetboot $node net", errorcode => 1 });
 | 
			
		||||
                return 1;
 | 
			
		||||
            foreach my $out (@$outref) {
 | 
			
		||||
                $callback->({data => "$out"})
 | 
			
		||||
            }
 | 
			
		||||
            $outref = xCAT::Utils->runxcmd(
 | 
			
		||||
                {
 | 
			
		||||
                    command => ['rpower'],
 | 
			
		||||
                    node    => ["$node"],
 | 
			
		||||
                    arg     => ['reset'],
 | 
			
		||||
                },
 | 
			
		||||
                $subreq, 0, 1);
 | 
			
		||||
            if ($::RUNCMD_RC != 0) {
 | 
			
		||||
                $callback->({ error => "failed to run command: rpower $node reset", errorcode => 1 });
 | 
			
		||||
                return 1;
 | 
			
		||||
            }
 | 
			
		||||
        } elsif ($node_desc_ptr->{mgt} eq "kvm") {
 | 
			
		||||
            $outref = xCAT::Utils->runxcmd(
 | 
			
		||||
                {
 | 
			
		||||
                    command => ['rpower'],
 | 
			
		||||
                    node    => ["$node"],
 | 
			
		||||
                    arg     => ['reset'],
 | 
			
		||||
                },
 | 
			
		||||
                $subreq, 0, 1);
 | 
			
		||||
            if ($::RUNCMD_RC != 0) {
 | 
			
		||||
                $callback->({ error => "failed to run command: rpower $node reset", errorcode => 1 });
 | 
			
		||||
                return 1;
 | 
			
		||||
            }
 | 
			
		||||
        } elsif ($node_desc_ptr->{mgt} eq "hmc") {
 | 
			
		||||
            $outref = xCAT::Utils->runxcmd(
 | 
			
		||||
                {
 | 
			
		||||
                    command => ["rnetboot"],
 | 
			
		||||
                    node    => ["$node"],
 | 
			
		||||
                },
 | 
			
		||||
                $subreq, 0, 1);
 | 
			
		||||
            if ($::RUNCMD_RC != 0) {
 | 
			
		||||
                $callback->({ error => "failed to run command: rnetboot $node", errorcode => 1 });
 | 
			
		||||
                return 1;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            $callback->({ error => "$node: The mgt configuration is not supported by getadapter.",
 | 
			
		||||
                    errorcode => 1 });
 | 
			
		||||
            $callback->({ error => "failed to run command: rinstall $node runcmd=getadapter", errorcode => 1 });
 | 
			
		||||
            return 1;
 | 
			
		||||
        }
 | 
			
		||||
        $callback->({ data => "$node: Booting into genesis, this could take several minutes..." });
 | 
			
		||||
@@ -495,8 +445,8 @@ sub update_adapter_result {
 | 
			
		||||
    }
 | 
			
		||||
    $callback->({ data => "$output" });
 | 
			
		||||
    if (!$has_nic) {
 | 
			
		||||
        $callback->({ data => "$node: Couldn't find interface name information detected by udevadm,"
 | 
			
		||||
                  . " the nics table will not be updated." });
 | 
			
		||||
        $callback->({ data => "$node: nics talbe will not be updated as not any ".
 | 
			
		||||
                    "useful information could be found with udevadm command." });
 | 
			
		||||
        return 0;
 | 
			
		||||
    }
 | 
			
		||||
    my $nics_table = xCAT::Table->new('nics');
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user