From 78dd04ac4a871d06fbfdbbc5f995d9e58325696f Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 22 Aug 2012 07:36:09 +0000 Subject: [PATCH] fix bug 3556007: modifications related to Utils.pm git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13574 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-client/bin/pping | 3 ++- xCAT-client/bin/xdsh | 5 +++-- xCAT-rmc/scripts/logeventtoteal | 3 ++- xCAT-server/bin/replaycons | 5 ++++- xCAT-server/lib/xcat/plugins/ipmi.pm.legacy | 4 +++- xCAT-server/lib/xcat/plugins/rhevm.pm | 13 ++++++++----- xCAT-server/share/xcat/netboot/ubuntu/genimage | 3 ++- xCAT-server/share/xcat/netboot/ubuntu/genimage.old | 3 ++- xCAT-server/share/xcat/tools/rmblade | 3 ++- xCAT-server/share/xcat/tools/rmnodecfg | 3 ++- 10 files changed, 30 insertions(+), 15 deletions(-) diff --git a/xCAT-client/bin/pping b/xCAT-client/bin/pping index e99b5fd2f..03ba8b7ef 100755 --- a/xCAT-client/bin/pping +++ b/xCAT-client/bin/pping @@ -12,6 +12,7 @@ use strict; use lib "$::XCATROOT/lib/perl"; use xCAT::Utils; +use xCAT::TableUtils; use POSIX qw(:signal_h :errno_h :sys_wait_h); use IO::Socket::SSL; use XML::Simple; @@ -133,7 +134,7 @@ foreach my $interf (@interfaces) { sub fping_pping { my $nodes = shift; - my $master = xCAT::Utils->get_site_Master(); + my $master = xCAT::TableUtils->get_site_Master(); my $masterip = xCAT::NetworkUtils->getipaddr($master); if ($masterip =~ /:/) #IPv6, needs fping6 support { diff --git a/xCAT-client/bin/xdsh b/xCAT-client/bin/xdsh index bb67d85f4..f832f34cf 100644 --- a/xCAT-client/bin/xdsh +++ b/xCAT-client/bin/xdsh @@ -18,6 +18,7 @@ use Getopt::Long; require xCAT::MsgUtils; require xCAT::DSHCLI; use xCAT::Utils; +use xCAT::TableUtils; use xCAT::RemoteShellExp; require xCAT::Client; my $bname = basename($0); @@ -270,7 +271,7 @@ sub parse_args_xdsh # get the directories on the servicenode to put the files in my $defaultsyndir = "/var/xcat/syncfiles"; - my @syndir = xCAT::Utils->get_site_attribute("SNsyncfiledir"); + my @syndir = xCAT::TableUtils->get_site_attribute("SNsyncfiledir"); my $synfiledir; if ($syndir[0]) { @@ -282,7 +283,7 @@ sub parse_args_xdsh } # for append function my $defaultnodesyndir = "/var/xcat/node/syncfiles"; - my @syndir2 = xCAT::Utils->get_site_attribute("nodesyncfiledir"); + my @syndir2 = xCAT::TableUtils->get_site_attribute("nodesyncfiledir"); my $synfiledir2; if ($syndir2[0]) { diff --git a/xCAT-rmc/scripts/logeventtoteal b/xCAT-rmc/scripts/logeventtoteal index 4a411ccd8..d95755b96 100755 --- a/xCAT-rmc/scripts/logeventtoteal +++ b/xCAT-rmc/scripts/logeventtoteal @@ -13,6 +13,7 @@ use strict; use Getopt::Std; use POSIX qw(strftime); use xCAT::Utils; +use xCAT::TableUtils; use xCAT::MsgUtils; use IO::File; use TEAL::Semaphore; @@ -100,7 +101,7 @@ if (!$batch) { #handle single event } } -my ($rc, $msg)=xCAT::Utils->logEventsToTealDatabase(\@a); +my ($rc, $msg)=xCAT::TableUtils->logEventsToTealDatabase(\@a); if ($rc) { xCAT::MsgUtils->message('S', "logeventtoteal:$msg. The condition is $condname. The response is $respname.\n"); } else { diff --git a/xCAT-server/bin/replaycons b/xCAT-server/bin/replaycons index 65f2ed5a2..26d0213a2 100755 --- a/xCAT-server/bin/replaycons +++ b/xCAT-server/bin/replaycons @@ -9,6 +9,9 @@ use lib "$::XCATROOT/lib/perl"; use strict; use xCAT::Table; +use xCAT::Utils; +use xCAT::TableUtils; +use xCAT::NetworkUtils; use xCAT::MsgUtils; use Getopt::Long; @@ -69,7 +72,7 @@ if ($hmtab) { my $file = "/var/log/consoles/$node"; #if has conserver, goto conserver the execute replaycons command -my @hostinfo=xCAT::Utils->determinehostname(); +my @hostinfo=xCAT::NetworkUtils->determinehostname(); my %iphash=(); foreach(@hostinfo) {$iphash{$_}=1;} if (($conserver) && ($iphash{$conserver} != 1)) { diff --git a/xCAT-server/lib/xcat/plugins/ipmi.pm.legacy b/xCAT-server/lib/xcat/plugins/ipmi.pm.legacy index f0a5cf9bb..1313d8ee0 100644 --- a/xCAT-server/lib/xcat/plugins/ipmi.pm.legacy +++ b/xCAT-server/lib/xcat/plugins/ipmi.pm.legacy @@ -18,6 +18,8 @@ use xCAT::SPD qw/decode_spd/; use POSIX qw(ceil floor); use Storable qw(store_fd retrieve_fd thaw freeze); use xCAT::Utils; +use xCAT::TableUtils; +use xCAT::ServiceNodeUtils; use xCAT::SvrUtils; use xCAT::Usage; use Thread qw(yield); @@ -6050,7 +6052,7 @@ sub preprocess_request { # find service nodes for requested nodes # build an individual request for each service node my $service = "xcat"; - my $sn = xCAT::Utils->get_ServiceNode($noderange, $service, "MN"); + my $sn = xCAT::ServiceNodeUtils->get_ServiceNode($noderange, $service, "MN"); # build each request for each service node diff --git a/xCAT-server/lib/xcat/plugins/rhevm.pm b/xCAT-server/lib/xcat/plugins/rhevm.pm index a0a747694..fbb700703 100644 --- a/xCAT-server/lib/xcat/plugins/rhevm.pm +++ b/xCAT-server/lib/xcat/plugins/rhevm.pm @@ -49,6 +49,9 @@ use HTTP::Request; use XML::LibXML; use xCAT::Table; +use xCAT::Utils; +use xCAT::TableUtils; +use xCAT::ServiceNodeUtils; use xCAT::MsgUtils; sub handled_commands{ @@ -225,7 +228,7 @@ sub preprocess_request { # The dispatch depends on the rhevm. Since the operation is in serial, so no need to use the service node. my @requests; my @rhevms=keys(%rhevm_hash); - my $sn = xCAT::Utils->get_ServiceNode(\@rhevms, 'xcat', "MN"); + my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@rhevms, 'xcat', "MN"); foreach my $snkey (keys %$sn){ my $reqcopy = {%$request}; $reqcopy->{'_xcatdest'} = $snkey; @@ -401,7 +404,7 @@ sub copycd { } my $installroot = "/install"; - my @entries = xCAT::Utils->get_site_attribute("installdir"); + my @entries = xCAT::TableUtils->get_site_attribute("installdir"); my $t_entry = $entries[0]; if ( defined($t_entry) ) { $installroot = $t_entry; @@ -485,7 +488,7 @@ sub mkinstall { my %doneimgs; my $installdir = "/install"; - my @ents = xCAT::Utils->get_site_attribute("installdir"); + my @ents = xCAT::TableUtils->get_site_attribute("installdir"); my $site_ent = $ents[0]; if( defined($site_ent) ) { @@ -493,7 +496,7 @@ sub mkinstall { } my $tftpdir = "/tftpboot"; - @ents = xCAT::Utils->get_site_attribute("tftpdir"); + @ents = xCAT::TableUtils->get_site_attribute("tftpdir"); $site_ent = $ents[0]; if( defined($site_ent) ) { @@ -732,7 +735,7 @@ sub addhost { my $callback = shift; my $rhevm_hash = shift; - my @domain = xCAT::Utils->get_site_attribute("domain"); + my @domain = xCAT::TableUtils->get_site_attribute("domain"); if (!$domain[0]) { my $rsp; push @{$rsp->{data}}, "The site.domain must be set to enable the rhev support."; diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 97aa75d51..c55749728 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -12,6 +12,7 @@ use File::Find; use Getopt::Long; use Cwd qw(realpath); use xCAT::Utils; +use xCAT::TableUtils; use File::Temp qw/mkdtemp/; use FindBin; @@ -402,7 +403,7 @@ unless ($onlyinitrd) { # ignore any return code # Add the local repo from MN - my $master = xCAT::Utils->get_site_Master(); + my $master = xCAT::TableUtils->get_site_Master(); open($aptconfig,">","$rootimg_dir/etc/apt/sources.list"); print $aptconfig "deb http://$master$installroot/$osver/$arch/ $dist main\n"; close($aptconfig); diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage.old b/xCAT-server/share/xcat/netboot/ubuntu/genimage.old index 174195264..3928ac1bb 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage.old +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage.old @@ -12,6 +12,7 @@ use File::Find; use Getopt::Long; use Cwd qw(realpath); use xCAT::Utils; +use xCAT::TableUtils; #use strict; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -324,7 +325,7 @@ unless ($onlyinitrd) { # ignore any return code # Add the local repo from MN - my $master = xCAT::Utils->get_site_Master(); + my $master = xCAT::TableUtils->get_site_Master(); open($aptconfig,">","$rootimg_dir/etc/apt/sources.list"); print $aptconfig "deb http://$master$installroot/$osver/$arch/ $dist main\n"; close($aptconfig); diff --git a/xCAT-server/share/xcat/tools/rmblade b/xCAT-server/share/xcat/tools/rmblade index c49cf9e0f..ad329b8ef 100755 --- a/xCAT-server/share/xcat/tools/rmblade +++ b/xCAT-server/share/xcat/tools/rmblade @@ -14,6 +14,7 @@ BEGIN use lib "$::XCATROOT/lib/perl"; use xCAT::Utils; +use xCAT::TableUtils; use strict; use Socket; # for name resolution @@ -21,7 +22,7 @@ my $ip=''; my $mm=''; my $slot=''; my $log = "/var/log/xcatsnmp"; -my $tftpdir = xCAT::Utils->getTftpDir(); +my $tftpdir = xCAT::TableUtils->getTftpDir(); open(FILE,">>$log") or die "Can't open log!!!"; diff --git a/xCAT-server/share/xcat/tools/rmnodecfg b/xCAT-server/share/xcat/tools/rmnodecfg index 990374392..e90b48b76 100755 --- a/xCAT-server/share/xcat/tools/rmnodecfg +++ b/xCAT-server/share/xcat/tools/rmnodecfg @@ -11,6 +11,7 @@ BEGIN use lib "$::XCATROOT/lib/perl"; use xCAT::Utils; +use xCAT::TableUtils; use strict; use Socket; @@ -20,7 +21,7 @@ if(! $blades) { exit; } -my $tftpdir = xCAT::Utils->getTftpDir(); +my $tftpdir = xCAT::TableUtils->getTftpDir(); foreach my $blade (`/opt/xcat/bin/nodels $blades`){ chomp($blade);