add a new script configbr-ex to configure the IP of the external bridge for network node
This commit is contained in:
parent
5de59481e1
commit
a5424b703b
@ -58,12 +58,14 @@ sub getcloudinfo
|
||||
xCAT::MsgUtils->message("E", "Unable to open $tab table");
|
||||
return undef;
|
||||
}
|
||||
my @rs = $ptab->getAllAttribs('name','repository');
|
||||
my @rs = $ptab->getAllAttribs('name','repository', 'pubinterface');
|
||||
|
||||
foreach my $r ( @rs ) {
|
||||
my $cloud = $r->{'name'};
|
||||
my $repos = $r->{'repository'};
|
||||
my $pubinterface = $r->{'pubinterface'};
|
||||
$info{ $cloud }{repository} = $repos;
|
||||
$info{ $cloud }{pubinterface} = $pubinterface;
|
||||
}
|
||||
|
||||
$tab = "cloud";
|
||||
@ -122,11 +124,18 @@ sub getcloudinfo
|
||||
sub getcloudres
|
||||
{
|
||||
my $cloudinfo_hash = shift;
|
||||
my $node = shift;
|
||||
my $clients = shift;
|
||||
my $cloudres;
|
||||
my $cloudlist;
|
||||
my $repos;
|
||||
my $repos;use Data::Dumper; print Dumper($cloudinfo_hash);
|
||||
if( @$clients == 0 ) {
|
||||
#This should not be a chef-server, and it's a chef-client
|
||||
if( defined($cloudinfo_hash) && defined($cloudinfo_hash->{$node}) ) {
|
||||
my $cloud=$cloudinfo_hash->{$node}->{cloud};
|
||||
my $pubinterface=$cloudinfo_hash->{$cloud}->{pubinterface};
|
||||
$cloudres="PUBINTERFACE='$pubinterface'\nexport PUBINTERFACE\n";
|
||||
}
|
||||
return $cloudres;
|
||||
}
|
||||
foreach my $client (@$clients) {
|
||||
|
41
xCAT-OpenStack/postscripts/configbr-ex
Executable file
41
xCAT-OpenStack/postscripts/configbr-ex
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/sh -vx
|
||||
|
||||
|
||||
bridge_name="br-ex"
|
||||
|
||||
pubinterface=$PUBINTERFACE
|
||||
#pubinterface="eth0"
|
||||
if [ -z "pubinterface" ]
|
||||
then
|
||||
errmsg="no pubinterface setting for the $NODE's cloudname in clouds table"
|
||||
logger -t xcat -p local4.err $errmsg
|
||||
echo $errmsg
|
||||
exit -1
|
||||
fi
|
||||
ifconfig $pubinterface 0
|
||||
|
||||
pubinterface=`echo $pubinterface | sed 's/^ \+//' | sed 's/ \+$//'`
|
||||
str_value=$(hashget hash_defined_nics $pubinterface)
|
||||
old_ifs=$IFS
|
||||
IFS=$','
|
||||
array_temp=($str_value)
|
||||
FS=$old_ifs
|
||||
|
||||
if [ -n "${array_temp[1]}" ];then
|
||||
str_nic_type=`echo ${array_temp[1]} | tr "[A-Z]" "[a-z]"`
|
||||
else
|
||||
if [ `echo $pubinterface | grep -E '(eth|en)[0-9]+'` ];then
|
||||
str_nic_type="ethernet"
|
||||
else
|
||||
errmsg="currently, it only supports eth|en, instead of $pubinterface."
|
||||
logger -t xcat -p local4.err $errmsg
|
||||
echo $errmsg
|
||||
exit -1;
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
configeth $bridge_name ${array_temp[0]} ${array_temp[2]}
|
||||
|
||||
|
||||
|
@ -485,7 +485,7 @@ sub makescript {
|
||||
my $cloudres;
|
||||
$cfgres = getcfgres($cfginfo_hash, $node, \@clients);
|
||||
if ( $cloud_exists == 1 ) {
|
||||
$cloudres = getcloudres($cloud_module_name, $cloud_exists, $cloudinfo_hash, \@clients);
|
||||
$cloudres = getcloudres($cloud_module_name, $cloud_exists, $cloudinfo_hash, $node, \@clients);
|
||||
}
|
||||
|
||||
#ok, now do everything else..
|
||||
@ -1815,6 +1815,7 @@ sub getcloudres
|
||||
my $module_name = shift;
|
||||
my $cloud_exists = shift;
|
||||
my $cloudinfo_hash = shift;
|
||||
my $node = shift;
|
||||
my $clients = shift;
|
||||
my $result;
|
||||
|
||||
@ -1822,7 +1823,7 @@ sub getcloudres
|
||||
if ( $cloud_exists ) {
|
||||
no strict "refs";
|
||||
if (defined(${$module_name."::"}{getcloudres})) {
|
||||
$result=${$module_name."::"}{getcloudres}($cloudinfo_hash, $clients);
|
||||
$result=${$module_name."::"}{getcloudres}($cloudinfo_hash, $node, $clients);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
Loading…
Reference in New Issue
Block a user