mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-13 01:40:26 +00:00
Format the ouput of getadapter result
This patch format the result of getadapter command and update the man page to notice that `getadapter` will boot into genesis. Fix-issue: #3046
This commit is contained in:
@ -31,7 +31,7 @@ DESCRIPTION
|
||||
|
||||
Traditionally, network interfaces in Linux are enumerated as eth[0123...], but these names do not necessarily correspond to actual labels on the chassis. \ **getadapter**\ help customer to get predictable network device name and some other network adapter information before provision or network configuration.
|
||||
|
||||
\ **getadapter**\ use genesis to collect network adapters information, so that mean it need to restart the target node.
|
||||
\ **Since getadpter uses genesis to collect network adapters information, the target node will be restarted.**\
|
||||
|
||||
\ **getadapter**\ For each node within the <noderange>, follows below scheme:
|
||||
|
||||
@ -41,16 +41,42 @@ If user hopes to scan the adapter information for the node but these information
|
||||
|
||||
\ **getadapter**\ tries to collect more information for the target network device, but doesn't guarantee collect same much information for every network device.
|
||||
|
||||
Below are the possible information can be collect up to now:
|
||||
|
||||
******************************
|
||||
\ **Collected information:**\
|
||||
******************************
|
||||
|
||||
|
||||
|
||||
\ **name**\ : the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7
|
||||
|
||||
|
||||
|
||||
\ **pci**\ : the pci location
|
||||
|
||||
|
||||
|
||||
\ **mac**\ : the MAC address
|
||||
|
||||
|
||||
|
||||
\ **candidatename**\ : All the names which satisfy predictable network device naming scheme. \ *(if xcat enhance confignic command later, user can use these names to configure their network adapter, even customize their name)*\
|
||||
|
||||
|
||||
|
||||
\ **vender**\ : the vender of network device
|
||||
|
||||
|
||||
|
||||
\ **model**\ : the model of network device
|
||||
|
||||
|
||||
|
||||
\ **linkstate**\ : the link state of network device
|
||||
|
||||
|
||||
|
||||
|
||||
*******
|
||||
OPTIONS
|
||||
*******
|
||||
|
@ -12,7 +12,7 @@ B<getadapter> [B<-h>|B<--help>|B<-v>|B<--version>|B<-V>]
|
||||
|
||||
Traditionally, network interfaces in Linux are enumerated as eth[0123...], but these names do not necessarily correspond to actual labels on the chassis. B<getadapter> help customer to get predictable network device name and some other network adapter information before provision or network configuration.
|
||||
|
||||
B<getadapter> use genesis to collect network adapters information, so that mean it need to restart the target node.
|
||||
B<Since getadpter uses genesis to collect network adapters information, the target node will be restarted.>
|
||||
|
||||
B<getadapter> For each node within the <noderange>, follows below scheme:
|
||||
|
||||
@ -22,14 +22,25 @@ If user hopes to scan the adapter information for the node but these information
|
||||
|
||||
B<getadapter> tries to collect more information for the target network device, but doesn't guarantee collect same much information for every network device.
|
||||
|
||||
Below are the possible information can be collect up to now:
|
||||
B<name>: the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7
|
||||
B<pci>: the pci location
|
||||
B<mac>: the MAC address
|
||||
B<candidatename>: All the names which satisfy predictable network device naming scheme. I<(if xcat enhance confignic command later, user can use these names to configure their network adapter, even customize their name)>
|
||||
B<vender>: the vender of network device
|
||||
B<model>: the model of network device
|
||||
B<linkstate>: the link state of network device
|
||||
=head1 B<Collected information:>
|
||||
|
||||
=over 2
|
||||
|
||||
=item B<name>: the consistent name which can be used by confignic directly in operating system which follow the same naming scheme with rhels7
|
||||
|
||||
=item B<pci>: the pci location
|
||||
|
||||
=item B<mac>: the MAC address
|
||||
|
||||
=item B<candidatename>: All the names which satisfy predictable network device naming scheme. I<(if xcat enhance confignic command later, user can use these names to configure their network adapter, even customize their name)>
|
||||
|
||||
=item B<vender>: the vender of network device
|
||||
|
||||
=item B<model>: the model of network device
|
||||
|
||||
=item B<linkstate>: the link state of network device
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
|
@ -122,8 +122,8 @@ sub route_request {
|
||||
my $command = $request->{command}->[0];
|
||||
my $ret = xCAT::State->REQUEST_ERROR;
|
||||
|
||||
if (scalar(@{ $request->{node} }) == 0) {
|
||||
return $ret;
|
||||
if (!$request->{node}) {
|
||||
return xCAT::State->REQUEST_WAIT;
|
||||
}
|
||||
|
||||
my $build_request_message_func = sub {
|
||||
@ -404,7 +404,7 @@ sub update_adapter_result {
|
||||
$interface_exists = 0;
|
||||
|
||||
if (exists($msg->{nic}->[$i]->{interface})) {
|
||||
$output .= $msg->{nic}->[$i]->{interface};
|
||||
$output .= $msg->{nic}->[$i]->{interface}."!";
|
||||
if ($has_nic) {
|
||||
$data .= "," . $msg->{nic}->[$i]->{interface} . "!";
|
||||
}
|
||||
@ -414,38 +414,46 @@ sub update_adapter_result {
|
||||
$interface_exists = 1;
|
||||
$has_nic = 1;
|
||||
}
|
||||
my @nic_attrs = ();
|
||||
my @output_attrs = ();
|
||||
if (exists($msg->{nic}->[$i]->{mac})) {
|
||||
$output .= "!mac=" . $msg->{nic}->[$i]->{mac};
|
||||
push(@output_attrs, "mac=" . $msg->{nic}->[$i]->{mac});
|
||||
if ($interface_exists) {
|
||||
$data .= " mac=" . $msg->{nic}->[$i]->{mac};
|
||||
push(@nic_attrs, "mac=" . $msg->{nic}->[$i]->{mac});
|
||||
}
|
||||
}
|
||||
if (exists($msg->{nic}->[$i]->{pcilocation})) {
|
||||
$output .= "|pci=" . $msg->{nic}->[$i]->{pcilocation};
|
||||
push(@output_attrs, "pci=" . $msg->{nic}->[$i]->{pcilocation});
|
||||
if ($interface_exists) {
|
||||
$data .= "pci=" . $msg->{nic}->[$i]->{pcilocation};
|
||||
push(@nic_attrs, "pci=" . $msg->{nic}->[$i]->{pcilocation});
|
||||
}
|
||||
}
|
||||
if (exists($msg->{nic}->[$i]->{predictablename})) {
|
||||
$output .= "|candidatename=" . $msg->{nic}->[$i]->{predictablename};
|
||||
push(@output_attrs, "candidatename=" . $msg->{nic}->[$i]->{predictablename});
|
||||
}
|
||||
if (exists($msg->{nic}->[$i]->{vendor})) {
|
||||
$output .= "|vendor=" . $msg->{nic}->[$i]->{vendor};
|
||||
$msg->{nic}->[$i]->{vendor} =~ s/^\s+|\s+$//g;
|
||||
push(@output_attrs, "vendor=" . $msg->{nic}->[$i]->{vendor});
|
||||
}
|
||||
if (exists($msg->{nic}->[$i]->{model})) {
|
||||
$output .= "|model=" . $msg->{nic}->[$i]->{model};
|
||||
$msg->{nic}->[$i]->{model} =~ s/^\s+|\s+$//g;
|
||||
push(@output_attrs, "model=" . $msg->{nic}->[$i]->{model});
|
||||
}
|
||||
if (exists($msg->{nic}->[$i]->{linkstate})) {
|
||||
$output .= "|linkstate=" . $msg->{nic}->[$i]->{linkstate};
|
||||
push(@output_attrs, "linkstate=" . (split(' ', $msg->{nic}->[$i]->{linkstate}))[0]);
|
||||
if ($interface_exists) {
|
||||
$data .= " linkstate=" . $msg->{nic}->[$i]->{linkstate};
|
||||
push(@nic_attrs, "linkstate=". (split(' ', $msg->{nic}->[$i]->{linkstate}))[0]);
|
||||
}
|
||||
}
|
||||
if (@nic_attrs) {
|
||||
$data .= join(" ", @nic_attrs);
|
||||
}
|
||||
$output .= join("|", @output_attrs);
|
||||
$output .= "\n";
|
||||
}
|
||||
$callback->({ data => "$output" });
|
||||
if (!$has_nic) {
|
||||
$callback->({ data => "$node: nics talbe will not be updated as not any ".
|
||||
$callback->({ data => "$node: nics table will not be updated as not any ".
|
||||
"useful information could be found with udevadm command." });
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user