From d047c4cdf5536143d3cc0e16a8d1238fd8740ed8 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Mon, 10 Nov 2014 06:34:14 -0500 Subject: [PATCH 01/13] defect 4370: minor change in message for makedns --- xCAT-server/lib/xcat/plugins/ddns.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/ddns.pm b/xCAT-server/lib/xcat/plugins/ddns.pm index 8daa58bc7..67a323c26 100755 --- a/xCAT-server/lib/xcat/plugins/ddns.pm +++ b/xCAT-server/lib/xcat/plugins/ddns.pm @@ -222,7 +222,7 @@ sub process_request { } } if ($matchedver && $matchedrel) { - xCAT::MsgUtils->message("E", {error => ["The necessary rpm perl-Net-DNS-0.73-1.28 needs be updated to a higher version for makedns to function. You can get a workable version perl-Net-DNS-0.80-1.x86_64.rpm from xCAT Dependency Repository. e.g. For sles12: zypper install perl-Net-DNS-0.80-1.x86_64"], errorcode => [1]}, $callback); + xCAT::MsgUtils->message("E", {error => ["The necessary rpm perl-Net-DNS-0.73-1.28 needs be updated to a higher version for makedns to function. You can get a workable version perl-Net-DNS-0.80-1.x86_64.rpm from xCAT Dependency Repository. e.g. For sles12: zypper install perl-Net-DNS-0.80-1."], errorcode => [1]}, $callback); return; } From 878d9443dda9f3f34ad979f30cd812d927996459 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Mon, 10 Nov 2014 03:09:23 -0500 Subject: [PATCH 02/13] enable SMT for powerKVM VMs --- xCAT-server/lib/xcat/plugins/kvm.pm | 76 ++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 8 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index c40baa899..02db71711 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -401,9 +401,9 @@ sub reconfigvm { $_->setData(getUnits($confdata->{vm}->{$node}->[0]->{memory},"M",1024)); } } - if (defined $confdata->{vm}->{$node}->[0]->{cpus}) { + if (defined $confdata->{vm}->{$node}->[0]->{vcpus}) { $needfixin=1; - $domdesc->findnodes("/domain/vcpu/text()")->[0]->setData($confdata->{vm}->{$node}->[0]->{cpus}); + $domdesc->findnodes("/domain/vcpu/text()")->[0]->setData($confdata->{vm}->{$node}->[0]->{vcpus}); } if (defined $confdata->{vm}->{$node}->[0]->{bootorder}) { my @expectedorder = split(/[:,]/,$confdata->{vm}->{$node}->[0]->{bootorder}); @@ -664,6 +664,12 @@ sub build_xmldesc { my $cdloc=$args{cd}; my %xtree=(); my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel}; + my $hypcputype = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cputype}; + my $hypcputhreads = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpu_thread}; + unless ($hypcputhreads) { + $hypcputhreads = "1"; + } + $xtree{type}='kvm'; $xtree{name}->{content}=$node; $xtree{uuid}->{content}=getNodeUUID($node); @@ -683,15 +689,38 @@ sub build_xmldesc { } else { $xtree{memory}->{content}=524288; } - if ($args{cpus}) { - $xtree{vcpu}->{content}=$args{cpus}; - if ($confdata->{vm}->{$node}->[0]->{cpus}) { + if ($hypcpumodel eq "ppc64") { + my %cpuhash = (); + $cpuhash{model} = $hypcputype; + if ($args{cpus}) { + $xtree{vcpu}->{content}=$args{cpus} * $hypcputhreads; + $cpuhash{topology}->{sockets} = 1; + $cpuhash{topology}->{cores} = $args{cpus}; + $cpuhash{topology}->{threads} = $hypcputhreads; $updatetable->{vm}->{$node}->{cpus}=$args{cpus}; + } elsif (defined $confdata->{vm}->{$node}->[0]->{cpus}) { + $xtree{vcpu}->{content}=$confdata->{vm}->{$node}->[0]->{cpus} * $hypcputhreads; + $cpuhash{topology}->{sockets} = 1; + $cpuhash{topology}->{cores} = $confdata->{vm}->{$node}->[0]->{cpus}; + $cpuhash{topology}->{threads} = $hypcputhreads; + } else { + $xtree{vcpu}->{content}=1 * $hypcputhreads; + $cpuhash{topology}->{sockets} = 1; + $cpuhash{topology}->{cores} = 1; + $cpuhash{topology}->{threads} = $hypcputhreads; } - } elsif (defined $confdata->{vm}->{$node}->[0]->{cpus}) { - $xtree{vcpu}->{content}=$confdata->{vm}->{$node}->[0]->{cpus}; + $xtree{cpu} = \%cpuhash; } else { - $xtree{vcpu}->{content}=1; + if ($args{cpus}) { + $xtree{vcpu}->{content}=$args{cpus}; + if ($confdata->{vm}->{$node}->[0]->{cpus}) { + $updatetable->{vm}->{$node}->{cpus}=$args{cpus}; + } + } elsif (defined $confdata->{vm}->{$node}->[0]->{cpus}) { + $xtree{vcpu}->{content}=$confdata->{vm}->{$node}->[0]->{cpus}; + } else { + $xtree{vcpu}->{content}=1; + } } if (defined ($confdata->{vm}->{$node}->[0]->{clockoffset})) { #If user requested a specific behavior, give it @@ -1846,6 +1875,16 @@ sub chvm { } else { #offline xml edits my $parsed=$parser->parse_string($vmxml); #TODO: should only do this once, oh well if ($cpucount) { + my $hypcpumodel = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cpumodel}; + if ($hypcpumodel eq "ppc64") { + my $hypcputype = $confdata->{$confdata->{vm}->{$node}->[0]->{host}}->{cputype}; + my $cputhreads = $parsed->findnodes("/domain/cpu/topology")->[0]->getAttribute('threads'); + unless ($cputhreads) { + $cputhreads = "1"; + } + $parsed->findnodes("/domain/cpu/topology")->[0]->setAttribute('cores'=>$cpucount); + $cpucount *= $cputhreads; + } $parsed->findnodes("/domain/vcpu/text()")->[0]->setData($cpucount); } if ($memory) { @@ -3011,6 +3050,20 @@ sub dohyp { my $nodeinfo = $hypconn->get_node_info(); if (exists($nodeinfo->{model})) { $confdata->{$hyp}->{cpumodel} = $nodeinfo->{model}; + if ($nodeinfo->{model} eq "ppc64") { + my $syshash = XMLin($hypconn->get_sysinfo()); + my $processor_content = $syshash->{processor}->[0]->{entry}->{type}->{content}; + if ($processor_content =~ /POWER8/i) { + $confdata->{$hyp}->{cputype} = "power8"; + $confdata->{$hyp}->{cpu_thread} = "8"; + } elsif ($processor_content =~ /POWER7/i) { + $confdata->{$hyp}->{cputype} = "power7"; + $confdata->{$hyp}->{cpu_thread} = "4"; + } elsif ($processor_content =~ /POWER6/i) { + $confdata->{$hyp}->{cputype} = "power6"; + $confdata->{$hyp}->{cpu_thread} = "2"; + } + } } } @@ -3018,6 +3071,13 @@ sub dohyp { if ($confdata->{$hyp}->{cpumodel} and $confdata->{$hyp}->{cpumodel} =~ /ppc64/i) { $confdata->{vm}->{$node}->[0]->{storagemodel} = "scsi"; } + if ($confdata->{$hyp}->{cpu_thread}) { + $confdata->{vm}->{$node}->[0]->{cpu_thread} = $confdata->{$hyp}->{cpu_thread}; + } + if ($confdata->{$hyp}->{cputype}) { + $confdata->{vm}->{$node}->[0]->{cputype} = $confdata->{$hyp}->{cputype}; + } + my ($rc,@output) = guestcmd($hyp,$node,$command,@$args); foreach(@output) { From a049714a3e229d03df7f1e7514b2a95338c59af9 Mon Sep 17 00:00:00 2001 From: baiyuan Date: Mon, 10 Nov 2014 03:45:48 -0500 Subject: [PATCH 03/13] fix defect 4371 [fvt]2.9:restart xcatd error for kit.pm compilationerror --- xCAT-server/lib/xcat/plugins/kit.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/kit.pm b/xCAT-server/lib/xcat/plugins/kit.pm index 2f5070695..1c50f3b5b 100644 --- a/xCAT-server/lib/xcat/plugins/kit.pm +++ b/xCAT-server/lib/xcat/plugins/kit.pm @@ -3862,7 +3862,7 @@ sub lskitcomp_processargs { # Option -C for kit component attributes if ( defined($::opt_C) ) { $::kitcompattrs = split_comma_delim_str($::opt_C); - push ($::kitcompattrs,"kitcompname"); + push (@{$::kitcompattrs},"kitcompname"); ensure_kitname_attr_in_list($::kitcompattrs); if (check_attr_names_exist('kitcomponent', $::kitcompattrs) != 0) { return 3; From f0987c908f408a63d4927711979b571071b1d21a Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 12 Nov 2013 16:42:03 +0800 Subject: [PATCH 04/13] fix for bug 4374: support running postscripts under directories in /intall/postscripts/ --- xCAT-server/share/xcat/install/scripts/post.ubuntu | 4 +++- xCAT-server/share/xcat/install/scripts/post.xcat | 4 +++- xCAT/postscripts/xcatdsklspost | 5 +++-- xCAT/postscripts/xcatinstallpost | 4 +++- 4 files changed, 12 insertions(+), 5 deletions(-) mode change 100644 => 100755 xCAT-server/share/xcat/install/scripts/post.ubuntu diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu old mode 100644 new mode 100755 index d9eb677f2..8a9d65132 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -63,7 +63,9 @@ do export XCATSERVER mv $i/postscripts /xcatpost rm -rf $i - chmod +x /xcatpost/* + # To support the postscripts in the subdirectories under /install/postscripts + #chmod +x /xcatpost/* + chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'` /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript MYCONT=`grep MASTER /xcatpost/mypostscript` MAX_RETRIES=10 diff --git a/xCAT-server/share/xcat/install/scripts/post.xcat b/xCAT-server/share/xcat/install/scripts/post.xcat index 44fdf2912..8db67f756 100755 --- a/xCAT-server/share/xcat/install/scripts/post.xcat +++ b/xCAT-server/share/xcat/install/scripts/post.xcat @@ -43,7 +43,9 @@ do # If mypostscript doesn't exist, we will get it through getpostscript.awk if [ ! -x /xcatpost/mypostscript ]; then - chmod +x /xcatpost/* + # To support the postscripts in the subdirectories under /install/postscripts + # chmod +x /xcatpost/* + chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'` /xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/<//g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /xcatpost/mypostscript diff --git a/xCAT/postscripts/xcatdsklspost b/xCAT/postscripts/xcatdsklspost index e279b9b89..51b5ec830 100755 --- a/xCAT/postscripts/xcatdsklspost +++ b/xCAT/postscripts/xcatdsklspost @@ -478,8 +478,9 @@ if grep 'rw /rw tmpfs ' /proc/mounts >/dev/null 2>&1; then ln -sf /etc/rc6.d/K10xcatmounts /etc/rc0.d/K10xcatmounts fi - -chmod +x /$xcatpost/*; +# To support the postscripts in the subdirectories under /install/postscripts +#chmod +x /$xcatpost/*; +chmod -R +x `find $xcatpost/ -maxdepth 1 -print | grep -E -v "^($xcatpost/|$xcatpost/_xcat|$xcatpost/_ssh|$xcatpost/ca|$xcatpost/hostkeys)$"` cd /$xcatpost; PATH=/$xcatpost:$PATH diff --git a/xCAT/postscripts/xcatinstallpost b/xCAT/postscripts/xcatinstallpost index 03fd10b82..784721c32 100755 --- a/xCAT/postscripts/xcatinstallpost +++ b/xCAT/postscripts/xcatinstallpost @@ -33,7 +33,9 @@ done cd /xcatpost; PATH=/xcatpost:$PATH export PATH -chmod +x /xcatpost/*; +# To support the postscripts in the subdirectories under /install/postscripts +#chmod +x /xcatpost/*; +chmod -R +x `find /xcatpost/ -maxdepth 1 -print | grep -E -v '^(/xcatpost/|/xcatpost/_xcat|/xcatpost/_ssh|/xcatpost/ca|/xcatpost/hostkeys)$'` POST_IN_DIR="/xcatpost" From 9f91e914d97119e8fb26e945717fe428c112ef91 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Tue, 11 Nov 2014 05:11:48 -0500 Subject: [PATCH 05/13] enhance for fix debug 4324: xcat provisioning of does not go consistantly to the same disk drive. --- .../share/xcat/install/ubuntu/compute.tmpl | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index adcfab038..f867ecb45 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -38,9 +38,24 @@ d-i partman-md/device_remove_md boolean true #create the /tmp/partitioning based on the uefi or legacy bios d-i partman/early_command string \ set -x; \ - DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ - if [[ $DEV == "" ]]; then DEV="sda"; fi; \ - echo "/dev/$DEV" > /tmp/boot_disk; \ + rm /tmp/devs-with-grub 2>/dev/null || true; \ + for d in $(list-devices partition); do \ + mkdir -p /tmp/mymount; \ + rc=0; \ + mount $d /tmp/mymount || rc=$?; \ + if [[ $rc -eq 0 ]]; then \ + [[ -e /tmp/mymount/grub/grub.cfg ]] && echo $d >>/tmp/devs-with-grub; \ + umount /tmp/mymount; \ + fi \ + done; \ + if [[ -e /tmp/devs-with-grub ]]; then \ + head -n1 /tmp/devs-with-grub | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ + rm /tmp/devs-with-grub 2>/dev/null || true; \ + else \ + DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ + if [[ $DEV == "" ]]; then DEV="sda"; fi; \ + echo "/dev/$DEV" > /tmp/boot_disk; \ + fi; \ debconf-set partman-auto/disk "$(cat /tmp/boot_disk)" d-i partman-auto/expert_recipe_file string /tmp/partitioning From 7f58d3fd6c9f1e84d59304b75671533bf287a269 Mon Sep 17 00:00:00 2001 From: huweihua Date: Tue, 11 Nov 2014 06:57:23 -0500 Subject: [PATCH 06/13] fix bug: disappeared in prtitboot environment --- xCAT-server/lib/xcat/plugins/petitboot.pm | 67 +++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/petitboot.pm b/xCAT-server/lib/xcat/plugins/petitboot.pm index 09b87062e..2dbfcb380 100644 --- a/xCAT-server/lib/xcat/plugins/petitboot.pm +++ b/xCAT-server/lib/xcat/plugins/petitboot.pm @@ -508,4 +508,71 @@ sub process_request { } } +sub getstate { + my $node = shift; + my $tftpdir = shift; + unless ($tftpdir) { $tftpdir = _slow_get_tftpdir($node); } + if (check_dhcp($node)) { + if (-r $tftpdir . "/petitboot/".$node) { + my $fhand; + open ($fhand,$tftpdir . "/petitboot/".$node); + my $headline = <$fhand>; + close $fhand; + $headline =~ s/^#//; + chomp($headline); + return $headline; + } else { + return "boot"; + } + } else { + return "discover"; + } +} + +#---------------------------------------------------------------------------- +=head3 getNodesetStates + returns the nodeset state for the given nodes. The possible nodeset + states are: netboot, install, boot and discover. + Arguments: + nodes --- a pointer to an array of nodes + states -- a pointer to a hash table. This hash will be filled by this + function.The key is the nodeset status and the value is a pointer + to an array of nodes. + Returns: + (return code, error message) +=cut +#----------------------------------------------------------------------------- +sub getNodesetStates { + my $noderef=shift; + if ($noderef =~ /xCAT_plugin::petitboot/) { + $noderef=shift; + } + my @nodes=@$noderef; + my $hashref=shift; + my $noderestab = xCAT::Table->new('noderes'); #in order to detect per-node tftp directories + my %nrhash = %{$noderestab->getNodesAttribs(\@nodes,[qw(tftpdir)])}; + + if (@nodes>0) { + foreach my $node (@nodes) { + my $tftpdir; + if ($nrhash{$node}->[0] and $nrhash{$node}->[0]->{tftpdir}) { + $tftpdir = $nrhash{$node}->[0]->{tftpdir}; + } else { + $tftpdir = $globaltftpdir; + } + my $tmp=getstate($node, $tftpdir); + my @a=split(' ', $tmp); + my $stat = $a[0]; + if (exists($hashref->{$stat})) { + my $pa=$hashref->{$stat}; + push(@$pa, $node); + } + else { + $hashref->{$stat}=[$node]; + } + } + } + return (0, ""); +} + 1; From ba343557ecfb68d6a8e9ce6c0b3f9a0a848962aa Mon Sep 17 00:00:00 2001 From: huweihua Date: Tue, 11 Nov 2014 07:02:51 -0500 Subject: [PATCH 07/13] fix bug: disappeared in petitboot environment --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index e2bef10eb..77ac57c72 100755 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -54,6 +54,7 @@ sub getNodesetStates my @yabootnodes = (); my @xnbanodes= (); my @grub2nodes = (); + my @petitbootnodes = (); my $tabdata = $tab->getNodesAttribs(\@nodes, ['node', 'netboot']); foreach my $node (@nodes) { @@ -80,6 +81,10 @@ sub getNodesetStates { push(@grub2nodes, $node); } + elsif ($nb eq "petitboot") + { + push(@petitbootnodes, $node); + } } my @retarray; @@ -148,6 +153,17 @@ sub getNodesetStates xCAT::MsgUtils->message('E', $retarray[1]); } } + if (@petitbootnodes > 0) + { + require xCAT_plugin::petitboot; + @retarray = xCAT_plugin::petitboot::getNodesetStates(\@petitbootnodes, $hashref); + if ($retarray[0]) + { + $retcode = $retarray[0]; + $errormsg .= $retarray[1]; + xCAT::MsgUtils->message('E', $retarray[1]); + } + } } return (0, ""); } From 21d12983c948a95e760d5fd05d28fbe8b7bfb84f Mon Sep 17 00:00:00 2001 From: daniceexi Date: Tue, 11 Nov 2014 12:18:58 -0500 Subject: [PATCH 08/13] Since xcatd fast restart cannot be supported in systemd enabled OS, we implemented fast restart in restartxcatd command --- xCAT-client/pods/man1/restartxcatd.1.pod | 29 +++++++- xCAT-server/sbin/restartxcatd | 91 ++++++++++++++++-------- 2 files changed, 87 insertions(+), 33 deletions(-) diff --git a/xCAT-client/pods/man1/restartxcatd.1.pod b/xCAT-client/pods/man1/restartxcatd.1.pod index 4fe32944f..b0937eacc 100644 --- a/xCAT-client/pods/man1/restartxcatd.1.pod +++ b/xCAT-client/pods/man1/restartxcatd.1.pod @@ -1,6 +1,6 @@ =head1 NAME -B - Restart the xCAT daemon (xcatd) on AIX. +B - Restart the xCAT daemon (xcatd). =head1 SYNOPSIS @@ -9,9 +9,32 @@ B [[B<-h>|B<--help>] | [B<-v>|B<--version>] | [B<-r>|B<--reload>]] =head1 DESCRIPTION -The B command restarts the xCAT daemon (xcatd) on AIX. -It uses the startsrc and stopsrc commands to do the restart work. If the xcatd subsystem was not created, B will create it automatically. +The B command restarts the xCAT daemon (xcatd). +B + +=over 2 + +It will perform the xcatd I. The xcatd I is a specific restart which has two advantages compares to the I and then I. + 1. The interval of xcatd out of service is very short. + 2. The in processing request which initiated by old xcatd will not be stopped by force. The old xcatd will hand over the sockets to new xcatd, but old xcat will still be waiting for the in processing request to finish before the exit. + +It does the same thing as 'service xcatd restart' on NON-systemd enabled Operating System like rh6.x and sles11.x. But for the systemd enabled Operating System like rh7 and sles12, the 'service xcatd restart' just do the I and I instead of xcatd I. + +It's recommended to use B command to restart xcatd on systemd enable system like rh7 and sles12 instead of 'service xcatd restart' or 'systemctl restart xcatd'. + +=back + +B + +=over 2 + +It runs 'stopsrc -s xcatd' to stop xcatd first if xcatd is active, then runs 'startsrc -s xcatd' to start xcatd. + +If the xcatd subsystem was not created, B will create it automatically. + +=back + =head1 OPTIONS diff --git a/xCAT-server/sbin/restartxcatd b/xCAT-server/sbin/restartxcatd index a07076944..02d6d41d0 100755 --- a/xCAT-server/sbin/restartxcatd +++ b/xCAT-server/sbin/restartxcatd @@ -2,7 +2,33 @@ # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html #(C)IBM Corp -# +#----------------------------------------------------------------------------- +=head1 restartxcatd + + restartxcatd - this routine is used to restart the xcatd process group. + + Linux: It will perform the xcatd fast restart. The 'xcatd fast restart' + has two advantages compares to the 'service stop and then start'. + 1. The interval of xcatd out of service is very short. + 2. The in processing request which initiated by old xcatd will + not be stopped by force. The old xcatd will hand over the sockets + to new xcatd, but old xcat will still be waiting for the in processing + request to finish before the exit. + + It does the same thing as 'service xcatd restart' on NON-systemd OS like + rh6.x and sles11.x. But for the systemd enabled OS like rh7 and sles12, + the 'service xcatd restart' just do the 'stop and start' instead of + 'xcatd fast restart'. + + SO, it's recommended to use 'restartxcatd' command to restart xcatd on + systemd enable system like rh7 and sles12 instead of 'service xcatd restart' or + 'systemctl restart xcatd'. + + AIX: It runs 'stopsrc -s xcatd' to stop xcatd first if xcatd is active, + then runs 'startsrc -s xcatd' to start xcatd. + +=cut +#----------------------------------------------------------------------------- BEGIN { @@ -17,35 +43,6 @@ use File::Basename; use xCAT::MsgUtils; use xCAT::Utils; -#----------------------------------------------------------------------------- - -=head1 startstopxcatd - - - - restartxcatd - this routine is used to restart the xcatd processes by - startsrc and stopsrc commands. - It runs on AIX. - -=cut - -#----------------------------------------------------------------------------- -# Main - -$::RE_CHECK_NUM = 10; # the times to check the result of command, the checking interval is 1 second - -my $rc; -my @output; -my $inoperative = 0; -my $check_num; - -if (!(xCAT::Utils->isAIX())) -{ # only runs on AIX - xCAT::MsgUtils->message("E", "Error: This command should only be run on AIX."); - exit 1; - -} - my $cmd = basename($0); # for auditing my $current_userid = getpwuid($>); @@ -63,6 +60,40 @@ $rsp->{command} -> [0] = $cmd; $rsp->{status} -> [0] = "allowed"; xCAT::MsgUtils->message("SA",$rsp); # syslog and auditlog + +# for Linux specific +if (xCAT::Utils->isLinux()) +{ + print "Restarting xCATd "; + if (-r "/etc/profile.d/xcat.sh") { + $cmd = "source /etc/profile.d/xcat.sh;"; + } + + $cmd .= "xcatd -p /var/run/xcatd.pid"; + xCAT::Utils->runcmd("$cmd", -1); + if ($::RUNCMD_RC == 0) { + print "[ OK ]\n"; + system ("logger -p local4.info -t xCAT Restart xcatd: [ OK ]."); + exit 0; + } else { + print "[ FAILED ]\n"; + system ("logger -p local4.info -t xCAT Restart xcatd: [ FAILED ]."); + exit 1; + } +} elsif (!(xCAT::Utils->isAIX())) { + xCAT::MsgUtils->message("E", "Error: This command should only be run on Linux or AIX."); + exit 1; +} + +# Following code is for AIX only + +$::RE_CHECK_NUM = 10; # the times to check the result of command, the checking interval is 1 second + +my $rc; +my @output; +my $inoperative = 0; +my $check_num; + # Check whether the xcatd subsystem has been created $cmd = "/usr/bin/lssrc -s xcatd | grep \"xcatd Subsystem is not on file\""; @output = `$cmd`; From a09f2d6faae2fa9c228fdf78b6d78e8aaaf81942 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 11 Nov 2014 15:37:29 -0500 Subject: [PATCH 09/13] add work around for umount partition question during ubuntu install --- xCAT-server/share/xcat/install/ubuntu/compute.tmpl | 3 +++ xCAT-server/share/xcat/install/ubuntu/kvm.tmpl | 3 +++ 2 files changed, 6 insertions(+) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index f867ecb45..1544787ab 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -124,6 +124,9 @@ d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoi chmod u+x #HOSTNAME#.pre; \ ./#HOSTNAME#.pre +# To workaround the "Unmount partitions that are in use?" question +d-i preseed/early_command string umount /media || true + d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \ chmod u+x #HOSTNAME#.post; \ cp ./#HOSTNAME#.post /target/root/post.script; \ diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl index d4e6b6096..1f7fa6e21 100644 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl @@ -105,6 +105,9 @@ d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoi chmod u+x #HOSTNAME#.pre; \ ./#HOSTNAME#.pre +# To workaround the "Unmount partitions that are in use?" question +d-i preseed/early_command string umount /media || true + d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \ chmod u+x #HOSTNAME#.post; \ cp ./#HOSTNAME#.post /target/root/post.script; \ From 3eaaa3b6f352302f7fbcc9b19f720160f7095731 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Tue, 11 Nov 2014 15:54:04 -0500 Subject: [PATCH 10/13] Bug 4373: enhance warning msg in otherpks to be more clear with yum. --- xCAT/postscripts/otherpkgs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/otherpkgs b/xCAT/postscripts/otherpkgs index 18c46dc5f..f6687614f 100755 --- a/xCAT/postscripts/otherpkgs +++ b/xCAT/postscripts/otherpkgs @@ -909,8 +909,8 @@ EOF` #Handle the rest with rpm if [ "$plain_pkgs" != "" -a -n "$OTHERPKGDIR" ]; then - echo "Warning: the packages $plain_pkgs could not be found in the repository, falling back to rpm command, did you forget to run createrepo?" - logger -p local4.info -t xcat "Warning: the packages $plain_pkgs could not be found in the repository, falling back to rpm command, did you forget to run createrepo?" + echo "Warning: the packages $plain_pkgs could not be found in the yum repository, falling back to rpm command. If you want your packages to be installed with yum, verify yum is installed and createrepo has been run." + logger -p local4.info -t xcat "Warning: the packages $plain_pkgs could not be found in the yum repository, falling back to rpm command. If you want your packages to be installed with yum, verify yum is installed and createrepo has been run." if [ $mounted -eq 0 ]; then dir_no_ftproot=${OTHERPKGDIR#*$INSTALLDIR/} mkdir -p /xcatpost/$dir_no_ftproot From 84712be32cdb3c5e0a1edf4e9839d849c2cc0e7c Mon Sep 17 00:00:00 2001 From: immarvin Date: Tue, 11 Nov 2014 19:04:52 -0800 Subject: [PATCH 11/13] support apache2.4 in ubuntu --- xCATsn/debian/control | 2 +- xCATsn/debian/install | 2 ++ xCATsn/debian/postinst | 30 +++++++++++++++++++++++------- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/xCATsn/debian/control b/xCATsn/debian/control index 95a82ca69..7832609d5 100644 --- a/xCATsn/debian/control +++ b/xCATsn/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.7.2 Package: xcatsn Architecture: all -Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.9), syslinux-xcat, xnba-undi, xcat-genesis-amd64, elilo-xcat +Depends: ${perl:Depends}, xcat-server, perl-xcat, xcat-client, libdbd-sqlite3-perl, libxml-parser-perl, tftpd-hpa, tftp-hpa, conserver-xcat, libnet-telnet-perl, dhcp3-server, apache2, expect, nfs-kernel-server, nmap, bind9, ipmitool-xcat (>=1.8.9), syslinux-xcat, xnba-undi, xcat-genesis-scripts, elilo-xcat Recommends: yaboot-xcat Description: Metapackage for a common, default xCAT service node setup xCATsn is a service node management package intended for at-scale management, including hardware management and software management. diff --git a/xCATsn/debian/install b/xCATsn/debian/install index 80345cbb2..2df0d8505 100644 --- a/xCATsn/debian/install +++ b/xCATsn/debian/install @@ -2,3 +2,5 @@ LICENSE.html opt/xcat/share/doc/packages/xCAT xCATSN etc xcat.conf etc/apache2/conf.d xcat.conf.apach24 etc/apache2/conf.d/ +xcat.conf etc/apache2/conf-available/ +xcat.conf.apach24 etc/apache2/conf-available/ diff --git a/xCATsn/debian/postinst b/xCATsn/debian/postinst index d90483185..0c63fba66 100644 --- a/xCATsn/debian/postinst +++ b/xCATsn/debian/postinst @@ -28,13 +28,29 @@ case "$1" in rm /etc/xCATMN fi - ver=$(cat /etc/issue |awk '{print $2}') - num=${ver%.*} - file="xcat.conf.apach24" - if [ $num -gt 12 ];then - mv /etc/apache2/conf.d/xcat.conf.apach24 /etc/apache2/conf-enabled/ - fi - + #ver=$(cat /etc/issue |awk '{print $2}') + #num=${ver%.*} + #file="xcat.conf.apach24" + #if [ $num -gt 12 ];then + # mv /etc/apache2/conf.d/xcat.conf.apach24 /etc/apache2/conf-enabled/ + #fi + if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] + then + rm -rf /etc/httpd/conf.d/xcat.conf + ln -s /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-enabled/xcat.conf + ln -s /etc/apache2/conf-available/xcat.conf.apach24 /etc/apache2/conf-enabled/xcat.conf + fi + + if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] + then + rm -rf /etc/apache2/conf-enabled/xcat.conf + ln -s /etc/apache2/conf-available/xcat.conf.apach24 /etc/apache2/conf-enabled/xcat.conf + fi apachedaemon='apache2' From 9e86ac498cf3860af360ef8c03bd6aaca188004e Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Tue, 11 Nov 2014 21:33:47 -0500 Subject: [PATCH 12/13] enhance for fix debug 4324: xcat provisioning of does not go consistantly to the same disk drive. --- xCAT-server/share/xcat/install/ubuntu/compute.tmpl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 1544787ab..16acab413 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -38,19 +38,19 @@ d-i partman-md/device_remove_md boolean true #create the /tmp/partitioning based on the uefi or legacy bios d-i partman/early_command string \ set -x; \ - rm /tmp/devs-with-grub 2>/dev/null || true; \ + rm /tmp/devs-with-boot 2>/dev/null || true; \ for d in $(list-devices partition); do \ mkdir -p /tmp/mymount; \ rc=0; \ mount $d /tmp/mymount || rc=$?; \ if [[ $rc -eq 0 ]]; then \ - [[ -e /tmp/mymount/grub/grub.cfg ]] && echo $d >>/tmp/devs-with-grub; \ + [[ -d /tmp/mymount/boot ]] && echo $d >>/tmp/devs-with-boot; \ umount /tmp/mymount; \ fi \ done; \ - if [[ -e /tmp/devs-with-grub ]]; then \ - head -n1 /tmp/devs-with-grub | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ - rm /tmp/devs-with-grub 2>/dev/null || true; \ + if [[ -e /tmp/devs-with-boot ]]; then \ + head -n1 /tmp/devs-with-boot | egrep -o '\S+[^0-9]' > /tmp/boot_disk; \ + rm /tmp/devs-with-boot 2>/dev/null || true; \ else \ DEV=`ls /dev/disk/by-path/* -l | egrep -o '/dev.*sd[^0-9]$' | sort -t : -k 1 -k 2 -k 3 -k 4 -k 5 -k 6 -k 7 -k 8 -g | head -n1 | egrep -o 'sd.*$'`; \ if [[ $DEV == "" ]]; then DEV="sda"; fi; \ From 01f4cc89178b5b7dce2bc022c381fee6750553a0 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 12 Nov 2014 05:16:27 -0500 Subject: [PATCH 13/13] defect 4367: support rinv command to get disk information for block device like /dev/sda16 --- xCAT-server/lib/xcat/plugins/kvm.pm | 55 +++++++++++++++++------------ 1 file changed, 33 insertions(+), 22 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 02db71711..f5d245371 100644 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1445,7 +1445,7 @@ sub rinv { xCAT::SvrUtils::sendmsg("Maximum Memory: $maxmem MB", $callback,$node); } - invstorage($domain); + invstorage($domain, $dom); invnics($domain); } sub get_storage_pool_by_volume { @@ -1473,7 +1473,8 @@ sub get_storage_pool_by_path { } sub invstorage { - my $domain = shift; + my $domain = shift; # the dom obj of XML + my $dom = shift; # the real domain obj my @disks = $domain->findnodes('/domain/devices/disk'); my $disk; foreach $disk (@disks) { @@ -1494,29 +1495,39 @@ sub invstorage { next; } my $file = $candidatenodes[0]->getAttribute('file'); - #we'll attempt to map file path to pool name and volume name - #fallback to just reporting filename if not feasible - #libvirt lacks a way to lookup a storage pool by path, so we'll only do so if using the 'default' xCAT scheme with uuid in the path - $file =~ m!/([^/]*)/($node\..*)\z!; - my $volname=$2; - my $vollocation=$file; - eval { - my $pool = get_storage_pool_by_path($file); - my $poolname = $pool->get_name(); - $vollocation = "[$poolname] $volname"; - }; - #at least I get to skip the whole pool mess here - my $vol = $hypconn->get_storage_volume_by_path($file); + my $dev = $candidatenodes[0]->getAttribute('dev'); + my $vollocation; my $size; - if ($vol) { - my %info = %{$vol->get_info()}; - if ($info{allocation} and $info{capacity}) { - $size = $info{allocation}; - $size = $size/1048576; #convert to MB - $size = sprintf("%.3f",$size); - $size .= "/".($info{capacity}/1048576); + my %info; + if ($file) { # for the volumn is a file in storage poll + #we'll attempt to map file path to pool name and volume name + #fallback to just reporting filename if not feasible + #libvirt lacks a way to lookup a storage pool by path, so we'll only do so if using the 'default' xCAT scheme with uuid in the path + $file =~ m!/([^/]*)/($node\..*)\z!; + my $volname=$2; + $vollocation=$file; + eval { + my $pool = get_storage_pool_by_path($file); + my $poolname = $pool->get_name(); + $vollocation = "[$poolname] $volname"; + }; + #at least I get to skip the whole pool mess here + my $vol = $hypconn->get_storage_volume_by_path($file); + if ($vol) { + %info = %{$vol->get_info()}; } + } elsif ($dev) { # for the volumn is a block device + $vollocation = $dev; + %info = %{$dom->get_block_info($dev)}; } + + if ($info{allocation} and $info{capacity}) { + $size = $info{allocation}; + $size = $size/1048576; #convert to MB + $size = sprintf("%.3f",$size); + $size .= "/".($info{capacity}/1048576); + } + $callback->({ node=>{ name=>$node,