From 9f8a0031075ea415663ac50b80a773b3dab14434 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 26 Sep 2013 03:04:36 -0400 Subject: [PATCH 1/7] check in the code to support the driver injection for stateless: 1. genimage will copy the generated initrd to /tftpboot;2. support nodeset --noupdateinitrd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 3 ++- xCAT-server/lib/xcat/plugins/genimage.pm | 27 ++++++++++++++++++++++++ xCAT-server/lib/xcat/plugins/sles.pm | 3 ++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 97096710d..446634564 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -172,6 +172,7 @@ sub mknetboot my $nodes = @{$req->{node}}; my @args = @{$req->{arg}} if(exists($req->{arg})); my @nodes = @{$req->{node}}; + my $noupdateinitrd = $req->{'noupdateinitrd'}; my $ostab = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -522,7 +523,7 @@ sub mknetboot } } - if ($docopy) { + if ($docopy && !$noupdateinitrd) { mkpath("$tftppath"); if (-f "$rootimgdir/hypervisor") { copy("$rootimgdir/hypervisor", "$tftppath"); diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 6284a16eb..9108dec90 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -10,6 +10,7 @@ use xCAT::SvrUtils; use xCAT::Table; #use Data::Dumper; use File::Path; +use File::Copy; use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -169,6 +170,7 @@ sub process_request { $otherpkglist = $ref_linuximage_tab->{'otherpkglist'}; $postinstall_filename = $ref_linuximage_tab->{'postinstall'}; $destdir = $ref_linuximage_tab->{'rootimgdir'}; + $rootimg_dir = $ref_linuximage_tab->{'rootimgdir'}; $driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'}; # TODO: how can we do if the user specifies one wrong value to the following attributes? @@ -363,6 +365,31 @@ sub process_request { # print FILE "\n"; #} #close FILE; + + # update the generated initrd to /tftpboot/xcat so that don't need to rerun nodeset to update them + if (($::RUNCMD_RC == 0) && $imagename) { + my $tftpdir = "/tftpboot"; + my @siteents = xCAT::TableUtils->get_site_attribute("tftpdir"); + if ($#siteents >= 0) + { + $tftpdir = $siteents[0]; + } + my $tftppath = "$tftpdir/xcat/osimage/$imagename"; + + my $installdir = "/install"; + @siteents = xCAT::TableUtils->get_site_attribute("installdir"); + if ($#siteents >= 0) + { + $installdir = $siteents[0]; + } + + unless (-d $tftppath) { + mkpath $tftppath; + } + copy("$rootimg_dir/initrd-stateless.gz", "$tftppath"); + copy("$rootimg_dir/initrd-statelite.gz", "$tftppath"); + copy("$rootimg_dir/kernel", "$tftppath"); + } #parse the output and save the image data to osimage and linuximage table save_image_data($callback, $doreq, $tempfile); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index f9a660289..d887ce0a1 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -56,6 +56,7 @@ sub mknetboot my $globaltftpdir = "/tftpboot"; my $nodes = @{$req->{node}}; my @nodes = @{$req->{node}}; + my $noupdateinitrd = $req->{'noupdateinitrd'}; my $ostab = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -405,7 +406,7 @@ sub mknetboot } } - if ($docopy) { + if ($docopy && !$noupdateinitrd) { mkpath("$tftppath"); copy("$rootimgdir/kernel", "$tftppath"); if ($statelite) { From 58e403c28ca4a13652daca74d2dd247d0145f794 Mon Sep 17 00:00:00 2001 From: xq2005 Date: Thu, 26 Sep 2013 19:29:30 -0700 Subject: [PATCH 2/7] bug:3804 --- xCAT/postscripts/confignics | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index b25163c94..4fc91aae6 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -203,7 +203,7 @@ do echo "confignics on $NODE: processing custom scripts: ${array_temp[3]} for interface $key" ${array_temp[3]} else - if [ -n "${array_temp[2]}" ];then + if [ -z "${array_temp[2]}" ];then logger -t xcat -p local4.info "confignics: ip address,nic type and network are required. $key: $str_value ." echo "confignics on $NODE: ip address,nic type and network are required. $key: $str_value ." continue From 09fe6d5c8f51384ab3b1e29b93a523ee69944ce3 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Fri, 27 Sep 2013 01:57:59 -0400 Subject: [PATCH 3/7] defect 3803: appending the default drvier list even new driver is specified in netdrivers attr; change the output message of genimage --- xCAT-server/share/xcat/netboot/rh/genimage | 47 +++++++++++++------- xCAT-server/share/xcat/netboot/sles/genimage | 25 +++++------ 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index aca1fc013..d99271dd1 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -174,15 +174,13 @@ if ($netdriver) { } } -# Use the default list if not specified -unless (@ndrivers) { - if ($arch eq 'x86' or $arch eq 'x86_64') { - @ndrivers = qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en virtio_net be2net/; - } elsif ($arch eq 'ppc64') { - @ndrivers = qw/e1000 e1000e igb ibmveth ehea/; - } elsif ($arch eq 's390x') { - @ndrivers = qw/qdio ccwgroup/; - } +# Add the default driver list +if ($arch eq 'x86' or $arch eq 'x86_64') { + push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en virtio_net be2net/; +} elsif ($arch eq 'ppc64') { + push @ndrivers, qw/e1000 e1000e igb ibmveth ehea/; +} elsif ($arch eq 's390x') { + push @ndrivers, qw/qdio ccwgroup/; } foreach (@ndrivers) { @@ -491,10 +489,6 @@ foreach my $dd (@dd_drivers) { print "Added driver $dd from driver update disk or driver rpm\n"; } -foreach my $driver (@ndrivers) { - print "Added driver $driver from root image\n"; -} - if (@new_order) { @ndrivers = (@new_order, @ndrivers); } @@ -514,14 +508,24 @@ while (scalar @checkdeps) { foreach $dep (@deps) { $dep =~ s/.*\///; unless (grep { $_ eq $dep } @ndrivers) { #only add if not added - unshift (@checkdeps,$dep); #recursively check dependencies - unshift (@ndrivers,$dep); print "Added $dep as an autodetected depedency\n"; } + unshift (@checkdeps,$dep); #recursively check dependencies + unshift (@ndrivers,$dep); } } } close($moddeps); + +#remove the duplicated drivers +my @fulldrivers; +foreach my $dn (@ndrivers) { + unless (grep {$_ eq $dn} @fulldrivers) { + push @fulldrivers, $dn; + } +} +@ndrivers = @fulldrivers; + unlink "/tmp/genimage.$$.yum.conf"; if (-d "$rootimg_dir/usr/share/dracut") { $dracutmode = 1; @@ -770,7 +774,17 @@ sub mkinitrd_dracut { # Add drivers to support local disk push @ndrivers, "ext3"; push @ndrivers, "ext4"; + #remove the duplicated drivers + my @fulldrivers; + foreach my $dn (@ndrivers) { + unless (grep {$_ eq $dn} @fulldrivers) { + push @fulldrivers, $dn; + } + } + @ndrivers = @fulldrivers; + my $add_drivers = join(' ', @ndrivers); + print "Try to load drivers: $add_drivers to initrd.\n"; my $DRACUTCONF; if ($mode eq "statelite") { @@ -1529,6 +1543,7 @@ sub isnetdriver { my $filetoadd = $File::Find::name; $filetoadd =~ s!$rootimg_dir/!!; push @filestoadd,[$filetoadd,"lib/$_"]; + print "Added driver $_ to initrd\n"; } } } @@ -1889,7 +1904,7 @@ sub load_dd () system ("cp -rf $real_path $rootimg_dir$1"); push @rpm_drivers, $driver; } else { - print "Error: cannot find the driver $driver from the driver rpms\n"; + print "Warning: cannot find the driver $driver from the driver rpms\n"; } } } elsif ($Injectalldriver) { diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 98f0b77be..35af5ee8d 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -173,15 +173,13 @@ if ($netdriver) { } } -# Use the default list if not specified -unless (@ndrivers) { - if ($arch eq 'x86' or $arch eq 'x86_64') { - @ndrivers = qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/; - } elsif ($arch eq 'ppc64') { - @ndrivers = qw/tg3 e1000 e1000e igb ibmveth ehea be2net/; - } elsif ($arch eq "s390x") { - @ndrivers = qw/qdio ccwgroup qeth qeth_l2 qeth_l3/; - } +# Add the default driver list +if ($arch eq 'x86' or $arch eq 'x86_64') { + push @ndrivers, qw/tg3 bnx2 bnx2x e1000 e1000e igb mlx_en be2net/; +} elsif ($arch eq 'ppc64') { + push @ndrivers, qw/tg3 e1000 e1000e igb ibmveth ehea be2net/; +} elsif ($arch eq "s390x") { + push @ndrivers, qw/qdio ccwgroup qeth qeth_l2 qeth_l3/; } foreach (@ndrivers) { @@ -785,10 +783,6 @@ foreach my $dd (@dd_drivers) { print "Added driver $dd from driver update disk or driver rpm\n"; } -foreach my $driver (@ndrivers) { - print "Added driver $driver from root image\n"; -} - if (@new_order) { @ndrivers = (@new_order, @ndrivers); } @@ -1563,7 +1557,7 @@ EOMS print "The initial ramdisk for statelite has been generated successfully!\n"; } else { system("cd /tmp/xcatinitrd.$$;find .|cpio -H newc -o|gzip -9 -c - > $destdir/initrd-stateless.gz"); - print "The initial ramdisk for statelite has been generated successfully!\n"; + print "The initial ramdisk for stateless has been generated successfully!\n"; } system("rm -rf /tmp/xcatinitrd.$$"); @@ -1583,6 +1577,7 @@ sub isnetdriver { my $filetoadd = $File::Find::name; $filetoadd =~ s!$rootimg_dir!!; push @filestoadd,[$filetoadd,"lib/$_"]; + print "Added driver $_ to initrd\n"; } } } @@ -2001,7 +1996,7 @@ sub load_dd() system ("cp -rf $real_path $rootimg_dir$1"); push @rpm_drivers, $driver; } else { - print "Error: cannot find the driver $driver from the driver rpms\n"; + print "Warning: cannot find the driver $driver from the driver rpms\n"; } } } elsif ($Injectalldriver) { From d856b6caf43800d22bf24cfdd3f97d7c9ec881eb Mon Sep 17 00:00:00 2001 From: xq2005 Date: Fri, 27 Sep 2013 02:56:44 -0700 Subject: [PATCH 4/7] ubuntu 13.04 stateful support --- xCAT-server/lib/xcat/plugins/debian.pm | 11 ++++++++--- xCAT-server/share/xcat/install/scripts/pre.ubuntu | 1 + xCAT-server/share/xcat/install/ubuntu/compute.tmpl | 4 ++-- xCAT-server/share/xcat/install/ubuntu/kvm.tmpl | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 76ef5e2fa..66ac98d99 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -770,7 +770,7 @@ sub mkinstall # . $node; #} else #{ - my $kcmdline = "quiet auto url=http://" + my $kcmdline = "nofb utf8 auto url=http://" . $instserver . "/install/autoinst/" . $node; @@ -831,7 +831,7 @@ sub mkinstall #} # need to add these in, otherwise aptitude will ask questions - $kcmdline .= " locale=en_US console-setup/layoutcode=us"; + $kcmdline .= " locale=en_US"; #$kcmdline .= " netcfg/wireless_wep= netcfg/get_hostname= netcfg/get_domain="; # default answers as much as possible, we don't want any interactiveness :) @@ -849,11 +849,16 @@ sub mkinstall #$kcmdline .= " DEBCONF_DEBUG=5"; # I don't need the timeout for ubuntu, but for debian there is a problem with getting dhcp in a timely manner - $kcmdline .= " netcfg/dhcp_timeout=120"; # safer way to set hostname, avoid problems with nameservers $kcmdline .= " hostname=".$node; + #from 12.10, the live install changed, so add the live-installer + if ( -r "$pkgdir/install/filesystem.squashfs") + { + $kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs"; + } + $bptab->setNodeAttribs( $node, { diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index b6a86c2d1..f6c9efd44 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -41,6 +41,7 @@ if [ -z "$instdisk" ]; then fi fi if [ ! -z "$instdisk" ]; then debconf-set partman-auto/disk "$instdisk"; fi +debconf-get open-iscsi/targets > /tmp/q sleep 0.1 done & diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 76136115f..28a5ddefa 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -5,14 +5,14 @@ d-i localechooser/supported-locales multiselect en_US.UTF-8 # Keyboard Selection d-i console-setup/ask_detect boolean false -d-i console-setup/layoutcode string en +d-i keyboard-configuration/layoutcode string en ### Network Configuration d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string - +d-i netcfg/dhcp_timeout string 120 ### Mirror settings # If you select ftp, the mirror/country string does not need to be set. diff --git a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl index 76136115f..28a5ddefa 100644 --- a/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/kvm.tmpl @@ -5,14 +5,14 @@ d-i localechooser/supported-locales multiselect en_US.UTF-8 # Keyboard Selection d-i console-setup/ask_detect boolean false -d-i console-setup/layoutcode string en +d-i keyboard-configuration/layoutcode string en ### Network Configuration d-i netcfg/get_hostname string unassigned-hostname d-i netcfg/get_domain string unassigned-domain d-i netcfg/wireless_wep string - +d-i netcfg/dhcp_timeout string 120 ### Mirror settings # If you select ftp, the mirror/country string does not need to be set. From 3e6abbcc600facb6f68e85f1b2bbb0e187ea335e Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 27 Sep 2013 09:55:48 -0400 Subject: [PATCH 5/7] temp fix for defect 3797, at least get it working on SLES --- xCAT/postscripts/xcatflowrequest | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/xCAT/postscripts/xcatflowrequest b/xCAT/postscripts/xcatflowrequest index caa4b41cf..d44c7d6bd 100644 --- a/xCAT/postscripts/xcatflowrequest +++ b/xCAT/postscripts/xcatflowrequest @@ -5,22 +5,21 @@ # It is called by xcatdsklspost before calling getpostscripts.awk # it is called by remoteshell before calling getcredentials.awk # -exec {REMOTEFD}<>/dev/udp/$1/$2 -echo "resourcerequest: xcatd" >&$REMOTEFD +exec 50<>/dev/udp/$1/$2 +echo "resourcerequest: xcatd" >&50 parpid=$$ touch /tmp/goahead.$parpid touch /tmp/killme.$parpid exec 2> /dev/null while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do ( - echo "resourcerequest: xcatd" >&$REMOTEFD - exec {LOCALFD}<>/proc/self/stat - read mystat<&$LOCALFD + echo "resourcerequest: xcatd" >&50 + exec 51<>/proc/self/stat + read mystat<&51 mypid=$(echo $mystat|cut -d " " -f 4) (sleep $(((RANDOM%60)+120)).$((RANDOM%50)); if [ -f /tmp/killme.$parpid ]; then kill -TERM $mypid; fi) & echo $! > /tmp/sleeperpid.$parpid - exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&$REMOTEFD - exec {LOCALFD}>&- + exec awk '{print $0 > "/tmp/goahead.'$parpid'";exit}' <&50 ) done sleeper=$(cat /tmp/sleeperpid.$parpid) @@ -28,5 +27,4 @@ sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}') rm /tmp/goahead.$parpid rm /tmp/sleeperpid.$parpid rm /tmp/killme.$parpid -exec {REMOTEFD}>&- kill -TERM $sleeper From 36c1eb5fd73051242dd325980d1c44f62a5df47e Mon Sep 17 00:00:00 2001 From: John Simpson Date: Mon, 30 Sep 2013 16:51:00 -0400 Subject: [PATCH 6/7] Add support for missing NeXtScale sensors --- xCAT-server/lib/xcat/plugins/ipmi.pm | 51 ++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm b/xCAT-server/lib/xcat/plugins/ipmi.pm index 34452cf25..7a7389344 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm @@ -5489,6 +5489,57 @@ sub sensor_was_read { if (@exparts) { $extext = join(",",@exparts); } + } elsif ($sdr->sensor_type == 0x28) { + if ($exdata1 & 1) { + push @exparts,"Degraded or unavailable"; + } + if ($exdata1 & 1<<1) { + push @exparts,"Degraded or unavailable"; + } + if ($exdata1 & 1<<2) { + push @exparts,"Offline"; + } + if ($exdata1 & 1<<3) { + push @exparts,"Unavailable"; + } + if ($exdata1 & 1<<4) { + push @exparts,"Failure"; + } + if ($exdata1 & 1<<5) { + push @exparts,"FRU Failure"; + } + } elsif ($sdr->sensor_type == 0x2b) { + if ($exdata1 & 1) { + push @exparts,"Change detected"; + } + if ($exdata1 & 1<<1) { + push @exparts,"Firmware change detected"; + } + if ($exdata1 & 1<<2) { + push @exparts,"Hardware incompatibility detected"; + } + if ($exdata1 & 1<<3) { + push @exparts,"Firmware incompatibility detected"; + } + if ($exdata1 & 1<<4) { + push @exparts,"Unsupported hardware version"; + } + if ($exdata1 & 1<<5) { + push @exparts,"Unsupported firmware verion"; + } + if ($exdata1 & 1<<6) { + push @exparts,"Hardware change successful"; + } + if ($exdata1 & 1<<7) { + push @exparts,"Firmware change successful"; + } + } elsif ($sdr->sensor_type == 0x1b) { + if ($exdata1 & 1) { + push @exparts,"Cable connected"; + } + if ($exdata1 & 1<<1) { + push @exparts,"Incorrect cable connection"; + } } else { $extext = "xCAT needs to add support for ".$sdr->sensor_type; } From 57f924c50d4e96b826ddbe9e2a7b935180a05947 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 1 Oct 2013 08:25:09 -0400 Subject: [PATCH 7/7] defect 3811 --- xCAT-server/lib/xcat/plugins/credentials.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index 9d3d48615..6b667b494 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -138,7 +138,7 @@ sub process_request } elsif (/ssh_dsa_hostkey/) { if (-r "/etc/xcat/hostkeys/$client/ssh_host_dsa_key") { - $tfilename="/etc/xcat/hostkeys/$client/ssh_host_rsa_key"; + $tfilename="/etc/xcat/hostkeys/$client/ssh_host_dsa_key"; } elsif (-r "/etc/xcat/hostkeys/ssh_host_dsa_key") { $tfilename="/etc/xcat/hostkeys/ssh_host_dsa_key"; } else {