Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8
This commit is contained in:
commit
bca4a317f4
@ -500,6 +500,7 @@ sub setCFMPkglistFile {
|
||||
Arguments:
|
||||
$imagename - the specified linuximage name
|
||||
@curospkgs - the currently selected OS packages list
|
||||
$mode - using Fuzzy Matching or Exact Matching to check packages
|
||||
Returns:
|
||||
0 - update successfully
|
||||
1 - update failed
|
||||
@ -509,13 +510,22 @@ sub setCFMPkglistFile {
|
||||
none
|
||||
Example:
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs);
|
||||
my $ret = CAT::CFMUtils->updateCFMPkglistFile($imagename, @cur_selected_pkgs, 1);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateCFMPkglistFile {
|
||||
my ($class, $img, $ospkgs) = @_;
|
||||
|
||||
my ($class, $img, $ospkgs, $mode) = @_;
|
||||
|
||||
if(defined($mode)){
|
||||
# Exact Matching
|
||||
$mode = 1;
|
||||
}else {
|
||||
# Fuzzy Matching
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
my @cur_selected = @$ospkgs;
|
||||
my $cfmpkglist = "/install/osimages/$img/pkglist.cfm";
|
||||
|
||||
@ -549,6 +559,14 @@ sub updateCFMPkglistFile {
|
||||
my @selected = @$selected_ref;
|
||||
@basepkgs = xCAT::CFMUtils->arrayops("U", \@basepkgs, \@selected);
|
||||
}
|
||||
|
||||
# Fuzzy Matching
|
||||
if (not $mode){
|
||||
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->updateSelectedPkgs(\@pre_selected, \@pre_removed, \@cur_selected);
|
||||
@pre_selected = @$ref1;
|
||||
@pre_removed = @$ref2;
|
||||
@cur_selected = @$ref3;
|
||||
}
|
||||
|
||||
# get diff between previous and current selected OS packages lists
|
||||
my @diff = xCAT::CFMUtils->getPkgsDiff(\@pre_selected, \@cur_selected);
|
||||
@ -661,6 +679,48 @@ sub getPreOSpkgsList {
|
||||
return (\@selected, \@removed);
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPreBaseOSpkgsList
|
||||
Get previously selected and removed base OS packages lists from pkglist file. Packages named with "example.xxx" should be the base name "example"
|
||||
|
||||
Arguments:
|
||||
$ospkglist - the path for ospkglist file
|
||||
Returns:
|
||||
refs for selected and removed OS packages arrays
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $pre_selected_ref = xCAT::CFMUtils->getPreOSpkgsList($ospkglist);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub getPreBaseOSpkgsList {
|
||||
my ($class, $pkglist) = @_;
|
||||
|
||||
my ($pre_selected_ref, $pre_removed_ref) = xCAT::CFMUtils->getPreOSpkgsList($pkglist);
|
||||
|
||||
my %pre_selected_hash = ();
|
||||
foreach (@$pre_selected_ref) {
|
||||
my @names = split(/\./, $_);
|
||||
my $basename = $names[0];
|
||||
|
||||
if ($_ =~ /^$basename\.([^\.]+)$/) {
|
||||
$pre_selected_hash{$basename} = 1;
|
||||
}else {
|
||||
$pre_selected_hash{$_} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@pre_selected = keys %pre_selected_hash;
|
||||
|
||||
return \@pre_selected;
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 getPkgsDiff
|
||||
@ -819,3 +879,66 @@ sub arrayops {
|
||||
|
||||
#return (\@union, \@intersection, \@difference);
|
||||
}
|
||||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
=head3 updateSelectedPkgs
|
||||
Update previous selected, previous removed and current selected packages based on fuzzy matching rules. Packages named with "example.i686" should be same with package "example"
|
||||
|
||||
Arguments:
|
||||
\@pre_selected - reference to previous selected packages
|
||||
\@pre_removed - reference to previous removed packages
|
||||
\@cur_selected - reference to current selected packages
|
||||
Returns:
|
||||
new previous selected, previous removed, current selected packages
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my ($ref1, $ref2, $ref3) = xCAT::CFMUtils->arrayops(\@pre_selected, \@pre_removed, \@cur_selected);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
sub updateSelectedPkgs() {
|
||||
my ($class, $pre_selected_ref, $pre_removed_ref, $cur_selected_ref) = @_;
|
||||
|
||||
my %pre_selected_hash = map{$_ => 1} @$pre_selected_ref;
|
||||
my %pre_removed_hash = map{$_ => 1} @$pre_removed_ref;
|
||||
my %cur_selected_hash = map{$_ => 1} @$cur_selected_ref;
|
||||
|
||||
my %new_pre_selected_hash = %pre_selected_hash;
|
||||
my %new_pre_removed_hash = %pre_removed_hash;
|
||||
my %new_cur_selected_hash = %cur_selected_hash;
|
||||
|
||||
foreach (keys %cur_selected_hash) {
|
||||
my $father = $_;
|
||||
my $flag = 0;
|
||||
foreach (keys %pre_selected_hash) {
|
||||
my $child = $_;
|
||||
if ($child =~ /^$father\.([^\.]+)$/) {
|
||||
$new_cur_selected_hash{$child} = 1;
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
if ($flag and not exists $pre_selected_hash{$father}){
|
||||
delete $new_cur_selected_hash{$father} if exists $new_cur_selected_hash{$father};
|
||||
}
|
||||
|
||||
foreach (keys %pre_removed_hash) {
|
||||
my $child = $_;
|
||||
if ($child =~ /^$father\.([^\.]+)$/) {
|
||||
delete $new_pre_removed_hash{$child} if exists $new_pre_removed_hash{$child};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @new_cur_selected = keys %new_cur_selected_hash;
|
||||
my @new_pre_selected = keys %new_pre_selected_hash;
|
||||
my @new_pre_removed = keys %new_pre_removed_hash;
|
||||
|
||||
|
||||
return (\@new_pre_selected, \@new_pre_removed, \@new_cur_selected);
|
||||
}
|
||||
|
@ -1009,6 +1009,7 @@ sub update_namedconf {
|
||||
push @newnamed,"options {\n";
|
||||
unless ($slave && xCAT::Utils->isLinux()) {
|
||||
push @newnamed,"\tdirectory \"".$ctx->{zonesdir}."\";\n";
|
||||
push @newnamed, "\tallow-recursion { any; };\n";
|
||||
}
|
||||
push @newnamed,"\t\t//listen-on-v6 { any; };\n";
|
||||
if ($ctx->{forwarders}) {
|
||||
|
@ -771,10 +771,30 @@ Usage:
|
||||
}
|
||||
|
||||
# If network profile specified. Need re-generate IPs for all nodess again.
|
||||
# As new design, ignore BMC/FSP NIC while reinstall nodes
|
||||
if(exists $args_dict{'networkprofile'}){
|
||||
my $newNetProfileName = $args_dict{'networkprofile'};
|
||||
my $oldNetProfileName = $nodeoldprofiles{'networkprofile'};
|
||||
|
||||
my $newNicsRef = xCAT::ProfiledNodeUtils->get_nodes_nic_attrs([$newNetProfileName])->{$newNetProfileName};
|
||||
my $oldNicsRef = xCAT::ProfiledNodeUtils->get_nodes_nic_attrs([$oldNetProfileName])->{$oldNetProfileName};
|
||||
|
||||
my %updateNicsHash = ();
|
||||
foreach my $newNic (keys %$newNicsRef) {
|
||||
if ($newNicsRef->{$newNic}->{'type'} ne 'BMC' and $newNicsRef->{$newNic}->{'type'} ne 'FSP'){
|
||||
$updateNicsHash{$newNic} = 1;
|
||||
}
|
||||
}
|
||||
foreach my $oldNic (keys %$oldNicsRef) {
|
||||
if ($oldNicsRef->{$oldNic}->{'type'} ne 'BMC' and $oldNicsRef->{$oldNic}->{'type'} ne 'FSP'){
|
||||
$updateNicsHash{$oldNic} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my $updateNics = join(",", keys %updateNicsHash);
|
||||
setrsp_progress("Regenerate IP addresses for nodes...");
|
||||
$retref = "";
|
||||
$retref = xCAT::Utils->runxcmd({command=>["noderegenips"], node=>$nodes, sequential=>[1]}, $request_command, 0, 2);
|
||||
$retref = xCAT::Utils->runxcmd({command=>["noderegenips"], node=>$nodes, arg=>["nics=$updateNics"], sequential=>[1]}, $request_command, 0, 2);
|
||||
$retstrref = parse_runxcmd_ret($retref);
|
||||
if ($::RUNCMD_RC != 0){
|
||||
setrsp_progress("Warning: failed to generate IPs for nodes.");
|
||||
@ -843,6 +863,7 @@ Usage:
|
||||
$netProfileNicsRef = xCAT::ProfiledNodeUtils->get_nodes_nic_attrs([$netProfileName]);
|
||||
my $nicsref = $netProfileNicsRef->{$netProfileName};
|
||||
my @nicslist = keys %$nicsref;
|
||||
|
||||
#3. validate specified nics
|
||||
if(exists $args_dict{'nics'}){
|
||||
@updateNics = split(",", $args_dict{'nics'});
|
||||
@ -910,7 +931,9 @@ Usage:
|
||||
unless (grep {$_ eq $nicname} @updateNics){
|
||||
# if the nic not specified, just keep the old IP&NIC record in nics table.
|
||||
my $oldip = $nodesNicsRef->{$node}->{$nicname}->{"ip"};
|
||||
$nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.",";
|
||||
if ($oldip) {
|
||||
$nicipsAttr{$node}{nicips} .= $nicname."!".$oldip.",";
|
||||
}
|
||||
}else{
|
||||
my $ipsref = $freeIPsHash{$nicname};
|
||||
my $nextip = shift @$ipsref;
|
||||
@ -932,7 +955,7 @@ Usage:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#8. Update database.
|
||||
setrsp_progress("Updating database records...");
|
||||
my $nicstab = xCAT::Table->new('nics',-create=>1);
|
||||
|
@ -116,6 +116,7 @@ fi
|
||||
|
||||
|
||||
%install
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/xcat/conf.orig
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d
|
||||
mkdir -p $RPM_BUILD_ROOT/install/postscripts
|
||||
@ -152,10 +153,10 @@ chmod 755 $RPM_BUILD_ROOT/install/postscripts/*
|
||||
rm LICENSE.html
|
||||
mkdir -p postscripts/hostkeys
|
||||
cd -
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat.conf.apach22
|
||||
cp %{SOURCE7} $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat.conf.apach24
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf.apach22
|
||||
cp %{SOURCE7} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf.apach24
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat.conf
|
||||
cp %{SOURCE7} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach24
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach22
|
||||
cp %{SOURCE5} $RPM_BUILD_ROOT/etc/xCATMN
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
||||
@ -168,23 +169,15 @@ cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
||||
if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/httpd/conf.d/xcat.conf
|
||||
cp /etc/httpd/conf.d/xcat.conf.apach24 /etc/httpd/conf.d/xcat.conf
|
||||
elif [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/apache2/conf.d/xcat.conf
|
||||
cp /etc/apache2/conf.d/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf
|
||||
else
|
||||
rm -rf /etc/httpd/conf.d/xcat.conf
|
||||
cp /etc/httpd/conf.d/xcat.conf.apach22 /etc/httpd/conf.d/xcat.conf
|
||||
|
||||
rm -rf /etc/apache2/conf.d/xcat.conf
|
||||
cp /etc/apache2/conf.d/xcat.conf.apach22 /etc/apache2/conf.d/xcat.conf
|
||||
cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/httpd/conf.d/xcat.conf
|
||||
fi
|
||||
|
||||
if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/apache2/conf.d/xcat.conf
|
||||
cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf
|
||||
fi
|
||||
|
||||
rm -rf /etc/apache2/conf.d/xcat.conf.apach22
|
||||
rm -rf /etc/apache2/conf.d/xcat.conf.apach24
|
||||
rm -rf /etc/httpd/conf.d/xcat.conf.apach22
|
||||
rm -rf /etc/httpd/conf.d/xcat.conf.apach24
|
||||
|
||||
%endif
|
||||
|
||||
@ -220,11 +213,10 @@ exit 0
|
||||
%files
|
||||
%{prefix}
|
||||
# one for sles, one for rhel. yes, it's ugly...
|
||||
/etc/apache2/conf.d/xcat.conf.apach22
|
||||
/etc/apache2/conf.d/xcat.conf.apach24
|
||||
/etc/httpd/conf.d/xcat.conf.apach22
|
||||
/etc/httpd/conf.d/xcat.conf.apach24
|
||||
|
||||
/etc/xcat/conf.orig/xcat.conf.apach24
|
||||
/etc/xcat/conf.orig/xcat.conf.apach22
|
||||
/etc/httpd/conf.d/xcat.conf
|
||||
/etc/apache2/conf.d/xcat.conf
|
||||
/etc/xCATMN
|
||||
/install/postscripts
|
||||
/install/prescripts
|
||||
|
@ -15,6 +15,7 @@ Source1: xcat.conf
|
||||
Source2: license.tar.gz
|
||||
Source3: xCATSN
|
||||
Source5: templates.tar.gz
|
||||
Source6: xcat.conf.apach24
|
||||
Provides: xCATsn = %{version}
|
||||
Requires: xCAT-server xCAT-client perl-DBD-SQLite
|
||||
|
||||
@ -80,6 +81,7 @@ tar -xf license.tar
|
||||
|
||||
%install
|
||||
%ifos linux
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/xcat/conf.orig
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d/
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/
|
||||
@ -87,6 +89,8 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat.conf
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf
|
||||
cp %{SOURCE3} $RPM_BUILD_ROOT/etc/xCATSN
|
||||
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach22
|
||||
cp %{SOURCE6} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach24
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
||||
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
||||
@ -122,6 +126,23 @@ fi
|
||||
%endif
|
||||
|
||||
%post
|
||||
%ifos linux
|
||||
#Apply the correct httpd/apache configuration file according to the httpd/apache version
|
||||
if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/httpd/conf.d/xcat.conf
|
||||
cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/httpd/conf.d/xcat.conf
|
||||
fi
|
||||
|
||||
if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
|
||||
then
|
||||
rm -rf /etc/apache2/conf.d/xcat.conf
|
||||
cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf
|
||||
fi
|
||||
|
||||
|
||||
%endif
|
||||
|
||||
# create dir for the current pid and move the original ones from /tmp/xcat to /var/run/xcat
|
||||
mkdir -p /var/run/xcat
|
||||
if [ -r "/tmp/xcat/installservice.pid" ]; then
|
||||
@ -161,7 +182,6 @@ if [ -e "/etc/redhat-release" ]; then
|
||||
else # SuSE
|
||||
apachedaemon='apache2'
|
||||
fi
|
||||
|
||||
# start xcatd on linux
|
||||
chkconfig $apachedaemon on
|
||||
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
|
||||
@ -199,6 +219,8 @@ fi
|
||||
%{prefix}
|
||||
# one for sles, one for rhel. yes, it's ugly...
|
||||
%ifos linux
|
||||
/etc/xcat/conf.orig/xcat.conf.apach24
|
||||
/etc/xcat/conf.orig/xcat.conf.apach22
|
||||
/etc/httpd/conf.d/xcat.conf
|
||||
/etc/apache2/conf.d/xcat.conf
|
||||
%endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user