Now kitcomponent and osimage could specify multiple serverroles, addkitcomp and chkkitcomp will match their every serverrole

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14978 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2013-01-24 10:00:25 +00:00
parent 8205915a66
commit 526e1fb67d

View File

@ -1640,11 +1640,28 @@ sub addkitcomp
return 1;
}
if ( $os{$osimage}{serverrole} and ($os{$osimage}{serverrole} ne $kitcomps{$kitcomp}{serverroles}) ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage doesn't fit to kit component $kitcomp with attribute serverrole";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
if ( $os{$osimage}{serverrole} ) {
my $match = 0;
my @os_serverroles = split /,/, $os{$osimage}{serverrole};
my @kitcomp_serverroles = split /,/, $kitcomps{$kitcomp}{serverroles};
foreach my $os_serverrole (@os_serverroles) {
foreach my $kitcomp_serverrole (@kitcomp_serverroles) {
if ( $os_serverrole eq $kitcomp_serverrole ) {
$match = 1;
last;
}
}
if ( $match ) {
last;
}
}
if ( !$match ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage doesn't fit to kit component $kitcomp with attribute serverrole";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
}
}
if ( $kitcomptable and $kitcomptable->{'kitcompdeps'} ) {
@ -2681,11 +2698,28 @@ sub chkkitcomp
return 1;
}
if ( $os{$osimage}{serverrole} and ($os{$osimage}{serverrole} ne $kitcomps{$kitcomp}{serverroles}) ) {
my %rsp;
push@{ $rsp{data} }, "kit component $kitcomp doesn't fit to osimage $osimage with attribute serverrole";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
if ( $os{$osimage}{serverrole} ) {
my $match = 0;
my @os_serverroles = split /,/, $os{$osimage}{serverrole};
my @kitcomp_serverroles = split /,/, $kitcomps{$kitcomp}{serverroles};
foreach my $os_serverrole (@os_serverroles) {
foreach my $kitcomp_serverrole (@kitcomp_serverroles) {
if ( $os_serverrole eq $kitcomp_serverrole ) {
$match = 1;
last;
}
}
if ( $match ) {
last;
}
}
if ( !$match ) {
my %rsp;
push@{ $rsp{data} }, "osimage $osimage doesn't fit to kit component $kitcomp with attribute serverrole";
xCAT::MsgUtils->message( "E", \%rsp, $callback );
return 1;
}
}
# Check if this kit component's dependencies are in the kitcomponent list.