From 47791a98939957b6d1909d57d3074ecc5215a59b Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Mon, 28 Jan 2008 19:34:58 +0000 Subject: [PATCH] -Provide a useful error message on some circumstances of MM communications failure -Fix makedhcp omshell syntax error -Have fedora plugin fixup the yum repodata to be usable by both anaconda and yum post-install git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@340 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/blade.pm | 3 + xCAT-server-2.0/lib/xcat/plugins/dhcp.pm | 2 +- xCAT-server-2.0/lib/xcat/plugins/fedora.pm | 64 +++++++++++++++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/blade.pm b/xCAT-server-2.0/lib/xcat/plugins/blade.pm index 64f0e7838..6a8548ac3 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/blade.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/blade.pm @@ -1011,6 +1011,9 @@ sub dompa { Timeout=>1200000, #Beacon, for one, takes a bit over a second to return PrivPass => $mpahash->{$mpa}->{password}); if ($session->{ErrorStr}) { return 1,$session->{ErrorStr}; } + unless ($session) { + return 1,"General error establishing SNMP communication"; + } my $tmp = $session->get([$mmprimoid.".1"]); if ($session->{ErrorStr}) { print $session->{ErrorStr}; } $activemm = ($tmp ? 1 : 2); diff --git a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm index 601def01a..c744e355a 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/dhcp.pm @@ -86,7 +86,7 @@ sub addnode { my $ent; $ent = $nrtab->getNodeAttribs($node,['tftpserver']); if ($ent and $ent->{tftpserver}) { - $statements = 'next-server = \"'.inet_ntoa(inet_aton($ent->{tftpserver})).'";'.$statements; + $statements = 'next-server = \"'.inet_ntoa(inet_aton($ent->{tftpserver})).'\";'.$statements; } else { $ent = $nrtab->getNodeAttribs($node,['servicenode']); if ($ent and $ent->{servicenode}) { diff --git a/xCAT-server-2.0/lib/xcat/plugins/fedora.pm b/xCAT-server-2.0/lib/xcat/plugins/fedora.pm index 27e3b741c..074cbb8d1 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/fedora.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/fedora.pm @@ -2,6 +2,7 @@ package xCAT_plugin::fedora; use Storable qw(dclone); use Sys::Syslog; +use DBI; use xCAT::Table; use xCAT::Template; use xCAT::Postage; @@ -292,6 +293,7 @@ sub mkinstall { kcmdline=>$kcmdline }); } else { + print "$arch is arch and /install/$os/$arch/images/pxeboot/vmlinuz and /install/$os/$arch/images/pxeboot/initrd.img\n"; $callback->({error=>["Install image not found in /install/$os/$arch"],errorcode=>[1]}); } } @@ -368,8 +370,68 @@ sub copycd { my $omask=umask 0022; mkpath("$installroot/$distname/$arch"); umask $omask; - my $rc = system("cd $path; find . | cpio -dump $installroot/$distname/$arch"); + #my $rc = system("cd $path; find . | cpio -dump $installroot/$distname/$arch"); + my $rc = system("cd $path;rsync -a . $installroot/$distname/$arch/"); chmod 0755,"$installroot/$distname/$arch"; + my $repomdfile; + my $primaryxml; + my @xmlines; + my $oldsha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.xml.gz`; + my $olddbsha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.sqlite.bz2`; + $oldsha =~ s/\s.*//; + chomp($oldsha); + $olddbsha =~ s/\s.*//; + chomp($olddbsha); + unlink("$installroot/$distname/$arch/repodata/primary.sqlite"); + unlink("$installroot/$distname/$arch/repodata/primary.xml"); + system("/usr/bin/bunzip2 $installroot/$distname/$arch/repodata/primary.sqlite.bz2"); + system("/bin/gunzip $installroot/$distname/$arch/repodata/primary.xml.gz"); + my $oldopensha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.xml`; + $oldopensha =~ s/\s+.*//; + chomp($oldopensha); + my $olddbopensha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.sqlite`; + $olddbopensha =~ s/\s+.*//; + chomp($olddbopensha); + my $pdbh = DBI->connect("dbi:SQLite:$installroot/$distname/$arch/repodata/primary.sqlite","","",{AutoCommit=>1}); + $pdbh->do('UPDATE "packages" SET "location_base" = NULL'); + $pdbh->disconnect; + open($primaryxml,"+<$installroot/$distname/$arch/repodata/primary.xml"); + while (<$primaryxml>) { + s!xml:base="media://[^"]*"!!g; + push @xmlines,$_; + } + seek($primaryxml,0,0); + print $primaryxml (@xmlines); + truncate($primaryxml,tell($primaryxml)); + @xmlines=(); + close($primaryxml); + my $newopensha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.xml`; + my $newdbopensha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.sqlite`; + system("/bin/gzip $installroot/$distname/$arch/repodata/primary.xml"); + system("/usr/bin/bzip2 $installroot/$distname/$arch/repodata/primary.sqlite"); + my $newsha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.xml.gz`; + my $newdbsha=`/usr/bin/sha1sum $installroot/$distname/$arch/repodata/primary.sqlite.bz2`; + $newopensha =~ s/\s.*//; + $newdbopensha =~ s/\s.*//; + $newsha =~ s/\s.*//; + $newdbsha =~ s/\s.*//; + chomp($newopensha); + chomp($newdbopensha); + chomp($newsha); + chomp($newdbsha); + open($primaryxml,"+<$installroot/$distname/$arch/repodata/repomd.xml"); + while (<$primaryxml>) { + s!xml:base="media://[^"]*"!!g; + s!$oldsha!$newsha!g; + s!$oldopensha!$newopensha!g; + s!$olddbsha!$newdbsha!g; + s!$olddbopensha!$newdbopensha!g; + push @xmlines,$_; + } + seek($primaryxml,0,0); + print $primaryxml (@xmlines); + truncate($primaryxml,tell($primaryxml)); + close($primaryxml); if ($rc != 0) { $callback->({error=>"Media copy operation failed, status $rc"}); } else {