2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-09-06 02:08:25 +00:00

Add support for migrating switch table

confluent now supports switch discovery
This commit is contained in:
Jarrod Johnson
2017-03-07 14:24:08 -05:00
parent 00d1d94d72
commit 240e8a2d2e

View File

@@ -230,16 +230,19 @@ sub makeconfluentcfg {
# Get db info for the nodes related to console
my $hmtab = xCAT::Table->new('nodehm');
my $nodepostab = xCAT::Table->new('nodepos');
my $switchtab = xCAT::Table->new('switch');
my $mptab = xCAT::Table->new('mp');
my @cfgents1; # = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']);
my @cfgents2;
my @cfgents3;
my @cfgents4;
my $explicitnodes = 0;
if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) {
$explicitnodes = 1;
@cfgents1 = $hmtab->getNodesAttribs($nodes, [ 'node', 'cons', 'mgt', 'conserver', 'termserver', 'termport', 'consoleondemand' ]);
@cfgents2 = $nodepostab->getNodesAttribs($nodes, [ 'node', 'rack', 'u', 'chassis', 'slot', 'room' ]);
@cfgents3 = $mptab->getNodesAttribs($nodes, [ 'node', 'mpa', 'id' ]);
@cfgents4 = $switchtab->getNodesAttribs($nodes, [ 'node', 'switch', 'port' ]);
# Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified
my @tmpcfgents1;
@@ -273,6 +276,7 @@ sub makeconfluentcfg {
@cfgents1 = $hmtab->getAllNodeAttribs([ 'cons', 'serialport', 'mgt', 'conserver', 'termserver', 'termport', 'consoleondemand' ]);
@cfgents2 = $nodepostab->getAllNodeAttribs([ 'rack', 'u', 'chassis', 'slot', 'room' ]);
@cfgents3 = $nodepostab->getAllNodeAttribs([ 'mpa', 'id' ]);
@cfgents4 = $nodepostab->getAllNodeAttribs([ 'node', 'switch', 'port' ]);
}
@@ -297,6 +301,11 @@ sub makeconfluentcfg {
$cfgenthash{ $nent->{node} }->{$_} = $nent->{$_};
}
}
foreach my $nent (@cfgents4) {
foreach (keys %$nent) {
$cfgenthash{ $nent->{node} }->{$_} = $nent->{$_};
}
}
my @cfgents = ();
foreach (values %cfgenthash) {
push @cfgents, $_;
@@ -485,6 +494,12 @@ sub donodeent {
if (defined $cfgent->{rack}) {
$parameters{'location.rack'} = $cfgent->{rack};
}
if (defined $cfgent->{switch}) {
$parameters{'net.switch'} = $cfgent->{switch};
}
if (defined $cfgent->{port}) {
$parameters{'net.switchport'} = $cfgent->{port};
}
if (defined $cfgent->{room}) {
$parameters{'location.room'} = $cfgent->{room};
}