2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-08-03 07:57:00 +00:00

for item: clean up Utils.pm, the code in xCAT-server/lib/xcat/plugin/

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13467 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
zhaoertao
2012-08-09 04:07:40 +00:00
parent 3a4f26c3cc
commit 40e144b4cc
55 changed files with 375 additions and 302 deletions
+20 -19
View File
@@ -6,6 +6,7 @@ use strict;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
@@ -78,7 +79,7 @@ sub init_plugin
if ((xCAT::Utils->isServiceNode()) && ( -s "/etc/xcat/cfgloc"))
{
my @nodeinfo = xCAT::Utils->determinehostname;
my @nodeinfo = xCAT::NetworkUtils->determinehostname;
my $nodename = pop @nodeinfo; # get hostname
my @nodeipaddr = @nodeinfo; # get ip addresses
my $service;
@@ -106,7 +107,7 @@ sub init_plugin
# read the service node table
# for a list of all functions to setup for this service node
#
my @servicelist = xCAT::Utils->isServiceReq($nodename, \@nodeipaddr);
my @servicelist = xCAT::ServiceNodeUtils->isServiceReq($nodename, \@nodeipaddr);
my $service;
if ($::RUNCMD_RC == 0)
{
@@ -272,7 +273,7 @@ sub init_plugin
{
print "\n"
; # make OK prints look better. Only need to do this for the 1st service.
my @tmp = xCAT::Utils->get_site_attribute("vsftp");
my @tmp = xCAT::TableUtils->get_site_attribute("vsftp");
if ($tmp[0] && ($tmp[0] !~ /0|NO|No|no|N|n/ )) {
$rc = &setup_FTP(); # setup FTP
}
@@ -318,7 +319,7 @@ sub setupInstallloc
{
my ($nodename) = @_;
my $rc = 0;
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
my $installloc;
my $newinstallloc;
@@ -328,7 +329,7 @@ sub setupInstallloc
my $arch;
my $nomount = 0;
my $retdata = xCAT::Utils->readSNInfo($nodename);
my $retdata = xCAT::ServiceNodeUtils->readSNInfo($nodename);
if (ref $retdata and $retdata->{'arch'})
{ # no error
$master = $retdata->{'master'}; # management node
@@ -337,7 +338,7 @@ sub setupInstallloc
# read install directory and install location from database,
# if they exists
my @installlocation = xCAT::Utils->get_site_attribute("installloc");
my @installlocation = xCAT::TableUtils->get_site_attribute("installloc");
my $hostname;
my $path;
if ($installlocation[0])
@@ -416,7 +417,7 @@ sub setupInstallloc
# need to mount the directory
my $cmd;
my @nfsv4 = xCAT::Utils->get_site_attribute("useNFSv4onAIX");
my @nfsv4 = xCAT::TableUtils->get_site_attribute("useNFSv4onAIX");
if ($nfsv4[0] && ($nfsv4[0] =~ /1|Yes|yes|YES|Y|y/))
{
$cmd = "mount -o vers=4,rw,nolock $master:$installloc $installdir";
@@ -575,7 +576,7 @@ sub setup_CONS
my $os;
my $arch;
my $cmd;
my $retdata = xCAT::Utils->readSNInfo($nodename);
my $retdata = xCAT::ServiceNodeUtils->readSNInfo($nodename);
if ($retdata->{'arch'})
{ # no error
$master = $retdata->{'master'};
@@ -648,7 +649,7 @@ sub setup_DHCP
# $snonly=$href->{value};
# }
#}
my @hs = xCAT::Utils->get_site_attribute("disjointdhcps");
my @hs = xCAT::TableUtils->get_site_attribute("disjointdhcps");
my $tmp = $hs[0];
if(defined($tmp)) {
$snonly = $tmp;
@@ -695,8 +696,8 @@ sub setup_DHCP
# determine my name
# get servicenodes and their nodes
# find the list of nodes serviced
my @hostinfo=xCAT::Utils->determinehostname();
my $sn_hash =xCAT::Utils->getSNandNodes();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my $sn_hash =xCAT::ServiceNodeUtils->getSNandNodes();
my @nodes;
my %iphash=();
my $snkey;
@@ -749,7 +750,7 @@ sub setup_FTP
# change ftp user id home directory to installdir
# link installdir
# restart the daemon
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
if (!(-e $installdir)) # make it
{
mkpath($installdir);
@@ -924,7 +925,7 @@ sub setup_NTPsn
my $ntpcfg = "/etc/ntp.conf";
# read DB for nodeinfo
my $retdata = xCAT::Utils->readSNInfo($nodename);
my $retdata = xCAT::ServiceNodeUtils->readSNInfo($nodename);
$master = $retdata->{'master'};
$os = $retdata->{'os'};
$arch = $retdata->{'arch'};
@@ -970,7 +971,7 @@ sub setup_NTPmn
my $ntpcfg = "/etc/ntp.conf";
# get timeservers from site table
my @ntpservers = xCAT::Utils->get_site_attribute("ntpservers");
my @ntpservers = xCAT::TableUtils->get_site_attribute("ntpservers");
if ($ntpservers[0])
{
@@ -1164,7 +1165,7 @@ sub setup_TFTP
}
# read DB for nodeinfo
my $retdata = xCAT::Utils->readSNInfo($nodename);
my $retdata = xCAT::ServiceNodeUtils->readSNInfo($nodename);
$master = $retdata->{'master'};
$os = $retdata->{'os'};
$arch = $retdata->{'arch'};
@@ -1187,7 +1188,7 @@ sub setup_TFTP
# read sharedtftp attribute from site table, if exist
#my $stab = xCAT::Table->new('site');
#my $sharedtftp = $stab->getAttribs({key => 'sharedtftp'}, 'value');
my @ss = xCAT::Utils->get_site_attribute("sharedtftp");
my @ss = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $sharedtftp = $ss[0];
if ( defined($sharedtftp) )
{
@@ -1212,7 +1213,7 @@ sub setup_TFTP
#$stab->close;
# read tftpdir directory from database
$tftpdir = xCAT::Utils->getTftpDir();
$tftpdir = xCAT::TableUtils->getTftpDir();
if (!(-e $tftpdir))
{
mkdir($tftpdir);
@@ -1229,7 +1230,7 @@ sub setup_TFTP
# need to mount the directory
my $cmd;
my @nfsv4 = xCAT::Utils->get_site_attribute("useNFSv4onAIX");
my @nfsv4 = xCAT::TableUtils->get_site_attribute("useNFSv4onAIX");
if ($nfsv4[0] && ($nfsv4[0] =~ /1|Yes|yes|YES|Y|y/))
{
$cmd = " mount -o vers=4,rw,nolock $tftphost:$tftpdir $tftpdir";
@@ -1380,7 +1381,7 @@ sub enable_TFTPhpa
}
# read tftpdir directory from database
my $tftpdir = xCAT::Utils->getTftpDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
if (!(-e $tftpdir)) {
mkdir($tftpdir);
}
+4 -2
View File
@@ -14,7 +14,9 @@ use Data::Dumper;
use Getopt::Long;
use xCAT::MsgUtils;
use strict;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
# options can be bundled up like -vV
Getopt::Long::Configure("bundling");
$Getopt::Long::ignorecase = 0;
@@ -109,7 +111,7 @@ sub preprocess_request {
# build an individual request for each service node
my $service = "xcat";
my @hcps=[$current_ppc_ent->{'hcp'}];
my $sn = xCAT::Utils->get_ServiceNode(\@hcps, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@hcps, $service, "MN");
#print Dumper($sn);
if( keys(%$sn) == 0 ) {
my $reqcopy = {%$req};
@@ -10,6 +10,7 @@ use Getopt::Long;
use xCAT::ADUtils;
use Net::DNS;
use xCAT::SvrUtils;
use xCAT::TableUtils;
use strict;
sub handled_commands {
@@ -34,7 +35,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
my $domain;
#$domain = $sitetab->getAttribs({key=>'domain'},['value']);
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $tmp = $domains[0];
if (defined($tmp)) {
$domain = $tmp;
@@ -44,7 +45,7 @@ sub process_request {
#TODO: if multi-domain support implemented, use the domains table to reference between realm and domain
#my $server = $sitetab->getAttribs({key=>'directoryserver'},['value']);
#my $realm = $sitetab->getAttribs({key=>'realm'},['value']);
my @directoryservers = xCAT::Utils->get_site_attribute("directoryserver");
my @directoryservers = xCAT::TableUtils->get_site_attribute("directoryserver");
my @realms = xCAT::Utils->get_site_attribute("realm");
my $tmp1 = $realms[0];
my $server;
+49 -47
View File
@@ -21,7 +21,9 @@ use xCAT::NodeRange;
use xCAT::Schema;
use xCAT::Utils;
use xCAT::SvrUtils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::ServiceNodeUtils;
use xCAT::InstUtils;
use xCAT::DBobjUtils;
use XML::Simple;
@@ -162,7 +164,7 @@ sub preprocess_request
#my $sitetab = xCAT::Table->new('site');
#my $nfsv4entry = $sitetab->getAttribs({'key' => 'useNFSv4onAIX'}, 'value');
my @tmp = xCAT::Utils->get_site_attribute("useNFSv4onAIX");
my @tmp = xCAT::TableUtils->get_site_attribute("useNFSv4onAIX");
my $nfsv4entry = $tmp[0];
if( defined ($nfsv4entry) )
{
@@ -288,7 +290,7 @@ sub preprocess_request
if (scalar(@{$mynodes})) {
# set up the requests to go to the service nodes
my $snodes;
$snodes = xCAT::Utils->getSNformattedhash($mynodes, $service, "MN", $type);
$snodes = xCAT::ServiceNodeUtils->getSNformattedhash($mynodes, $service, "MN", $type);
foreach my $snkey (keys %$snodes)
{
@@ -366,7 +368,7 @@ sub preprocess_request
my $sn;
if ($nodes)
{
$sn = xCAT::Utils->getSNformattedhash($nodes, $service, "MN");
$sn = xCAT::ServiceNodeUtils->getSNformattedhash($nodes, $service, "MN");
}
# set up the requests to go to the service nodes
@@ -410,7 +412,7 @@ sub preprocess_request
# set up the requests to go to the service nodes
# all get the same request
my $snodes;
$snodes = xCAT::Utils->getSNformattedhash($mynodes, $service, "MN", $type);
$snodes = xCAT::ServiceNodeUtils->getSNformattedhash($mynodes, $service, "MN", $type);
foreach my $snkey (keys %$snodes)
{
my $reqcopy = {%$req};
@@ -511,7 +513,7 @@ sub process_request
#my $nfsv4entry = $sitetab->getAttribs({'key' => 'useNFSv4onAIX'}, 'value');
#if($nfsv4entry and defined ($nfsv4entry->{'value'}))
#{
my @nfsv4entries = xCAT::Utils->get_site_attribute("useNFSv4onAIX");
my @nfsv4entries = xCAT::TableUtils->get_site_attribute("useNFSv4onAIX");
my $tmp = $nfsv4entries[0];
if ( defined($tmp) && $tmp =~ /1|Yes|yes|YES|Y|y/)
{
@@ -1468,7 +1470,7 @@ sub spot_updates
if ($::UPDATE)
{
# get list of SNs
@allservers = xCAT::Utils->getAllSN();
@allservers = xCAT::ServiceNodeUtils->getAllSN();
# we don't want to include the nimprime in the list of SNs
# need to compare IPs of nimprime and SN
@@ -1702,8 +1704,8 @@ sub spot_updates
# don't remove spots if SNs are using shared file system
# mkdsklsnode will take care of copying out the updated spot
# check the sharedinstall attr
#my $sharedinstall=xCAT::Utils->get_site_attribute('sharedinstall');
my @sharedinstalls=xCAT::Utils->get_site_attribute('sharedinstall');
#my $sharedinstall=xCAT::TableUtils->get_site_attribute('sharedinstall');
my @sharedinstalls=xCAT::TableUtils->get_site_attribute('sharedinstall');
my $sharedinstall = $sharedinstalls[0];
chomp $sharedinstall;
@@ -2260,7 +2262,7 @@ sub mknimimage
my $lpp_source_name;
my $root_name;
my $dump_name;
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
if (defined(@{$::args}))
{
@@ -2486,7 +2488,7 @@ sub mknimimage
#my ($tmp) = $sitetab->getAttribs({'key' => 'domain'}, 'value');
#my $domain = $tmp->{value};
#$sitetab->close;
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $domain = $domains[0];
if (!$domain)
{
@@ -2780,7 +2782,7 @@ sub mknimimage
#my ($tmp) = $sitetab->getAttribs({'key' => 'domain'}, 'value');
#my $domain = $tmp->{value};
#$sitetab->close;
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $domain = $domains[0];
if (!$domain)
{
@@ -3723,7 +3725,7 @@ sub mk_lpp_source
my @lppresources;
my $lppsrcname;
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
#
# Get a list of the defined lpp_source resources
@@ -4118,7 +4120,7 @@ sub mk_spot
my $spot_name;
my $currentimage;
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
if ($::attrres{spot})
{
@@ -4373,7 +4375,7 @@ sub mk_bosinst_data
my $bosinst_data_name = $::image_name . "_bosinst_data";
my @validattrs = ("verbose", "nfs_vers", "nfs_sec", "dest_dir", "group", "source");
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
if ($attrres{bosinst_data})
{
@@ -4532,10 +4534,10 @@ sub mk_resolv_conf_file
#my $sitetab = xCAT::Table->new('site');
#my ($tmp) = $sitetab->getAttribs({'key' => 'domain'}, 'value');
#my $domain = $tmp->{value};
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $domain = $domains[0];
#my ($tmp2) = $sitetab->getAttribs({'key' => 'nameservers'}, 'value');
my @nameserver = xCAT::Utils->get_site_attribute("nameservers");
my @nameserver = xCAT::TableUtils->get_site_attribute("nameservers");
my $tmp2 = $nameserver[0];
# convert <xcatmaster> to nameserver IP
@@ -4694,13 +4696,13 @@ sub chk_resolv_conf
#my $sitetab = xCAT::Table->new('site');
#my ($tmp) = $sitetab->getAttribs({'key' => 'domain'}, 'value');
#my $site_domain = $tmp->{value};
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $site_domain = $domains[0];
#my ($tmp2) = $sitetab->getAttribs({'key' => 'nameservers'}, 'value');
#my $site_nameservers = $tmp2->{value};
#$sitetab->close;
my @nameserver = xCAT::Utils->get_site_attribute("nameservers");
my @nameserver = xCAT::TableUtils->get_site_attribute("nameservers");
my $site_nameservers = $nameserver[0];
# Get a list of the all NIM resources
@@ -4937,7 +4939,7 @@ sub chk_resolv_conf
my $loc;
my @validattrs = ("nfs_vers", "nfs_sec");
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
if ($::opt_l)
{
if ($::opt_l =~ /\/$/)
@@ -5138,7 +5140,7 @@ sub mk_resolv_conf
my @validattrs = ("verbose", "nfs_vers", "nfs_sec", "dest_dir", "group", "source");
my $resolv_conf_name = $::image_name . "_resolv_conf";
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
if ($attrres{resolv_conf})
{
@@ -5165,10 +5167,10 @@ sub mk_resolv_conf
#my $sitetab = xCAT::Table->new('site');
#my ($tmp) = $sitetab->getAttribs({'key' => 'domain'}, 'value');
#my $domain = $tmp->{value};
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $domain = $domains[0];
#my ($tmp2) = $sitetab->getAttribs({'key' => 'nameservers'}, 'value');
my @nameserver = xCAT::Utils->get_site_attribute("nameservers");
my @nameserver = xCAT::TableUtils->get_site_attribute("nameservers");
my $tmp2 = $nameserver[0];
# convert <xcatmaster> to nameserver IP
my $nameservers;
@@ -5299,7 +5301,7 @@ sub mk_mksysb
my @validattrs = ("verbose", "nfs_vers", "nfs_sec", "dest_dir", "group", "source", "size_preview", "exclude_files", "mksysb_flags", "mk_image");
my $mksysb_name = $::image_name . "_mksysb";
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
if ($attrres{mksysb})
{
@@ -5630,12 +5632,12 @@ sub prermnimimage
# by default, get MN and all servers
my @allsn = ();
my @nlist = xCAT::Utils->list_all_nodes;
my @nlist = xCAT::TableUtils->list_all_nodes;
my $sn;
my $service = "xcat";
if (\@nlist)
{
$sn = xCAT::Utils->getSNformattedhash(\@nlist, $service, "MN");
$sn = xCAT::ServiceNodeUtils->getSNformattedhash(\@nlist, $service, "MN");
}
foreach my $snkey (keys %$sn)
{
@@ -6522,7 +6524,7 @@ sub mkdumpres
my @validattrs = ("dumpsize", "max_dumps", "notify", "snapcollect", "verbose", "nfs_vers", "group");
my $cmd = "/usr/sbin/nim -Fo define -t $type -a server=master ";
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my %cmdattrs;
@@ -6625,7 +6627,7 @@ sub mknimres
@validattrs = ("nfs_vers", "verbose", "group");
my $cmd = "/usr/sbin/nim -Fo define -t $type -a server=master ";
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my %cmdattrs;
if ($::NFSv4)
@@ -6858,7 +6860,7 @@ sub updatespot
}
# copy the script
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my $cpcmd =
"mkdir -m 644 -p $spot_loc/lpp/bos/inst_root/opt/xcat; cp $install_dir/postscripts/xcataixpost $spot_loc/lpp/bos/inst_root/opt/xcat/xcataixpost; chmod +x $spot_loc/lpp/bos/inst_root/opt/xcat/xcataixpost";
@@ -7336,7 +7338,7 @@ sub prenimnodecust
#
# Get the service nodes for this list of nodes
#
my $sn = xCAT::Utils->getSNformattedhash(\@nodelist, "xcat", "MN");
my $sn = xCAT::ServiceNodeUtils->getSNformattedhash(\@nodelist, "xcat", "MN");
if ($::ERROR_RC)
{
my $rsp;
@@ -7820,7 +7822,7 @@ sub prenimnodeset
#my ($tmp) = $sitetab->getAttribs({'key' => 'sharedinstall'}, 'value');
#my $sharedinstall = $tmp->{value};
#$sitetab->close;
my @sharedinstalls = xCAT::Utils->get_site_attribute("sharedinstall");
my @sharedinstalls = xCAT::TableUtils->get_site_attribute("sharedinstall");
my $sharedinstall = $sharedinstalls[0];
if (!$sharedinstall) {
$sharedinstall="no";
@@ -8063,7 +8065,7 @@ sub prenimnodeset
{ # if we have at least one standalone node
my $createscript = 0;
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
# see if it already exists
@@ -8368,7 +8370,7 @@ sub prenimnodeset
# make sure the permission are correct for using and transferring
# to the nodes and service nodes.
# Also removes /install/postscripts/etc/xcat/cfgloc if found
my $result = xCAT::Utils->checkCredFiles($callback);
my $result = xCAT::TableUtils->checkCredFiles($callback);
#####################################################
#
@@ -9028,14 +9030,14 @@ sub doSNcopy2
my @nodelist = @$nodes;
my @nimrestypes = @$restypes;
my %nodeosi = %{$nosi};
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my %resinfo;
#
# Get a list of nodes for each service node
#
my $sn = xCAT::Utils->getSNformattedhash(\@nodelist, "xcat", "MN", $type);
my $sn = xCAT::ServiceNodeUtils->getSNformattedhash(\@nodelist, "xcat", "MN", $type);
if ($::ERROR_RC)
{
my $rsp;
@@ -9219,7 +9221,7 @@ sub doSFScopy
my @nodelist = @$nodes;
my @nimrestypes = @$restypes;
my %nodeosi = %{$nosi}; # osimage name for each node
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my $error;
@@ -9239,7 +9241,7 @@ sub doSFScopy
my @SNlist;
# Get a list of nodes for each service node
my $sn = xCAT::Utils->getSNformattedhash(\@nodelist, "xcat", "MN", $type);
my $sn = xCAT::ServiceNodeUtils->getSNformattedhash(\@nodelist, "xcat", "MN", $type);
if ($::ERROR_RC)
{
my $rsp;
@@ -9335,12 +9337,12 @@ sub doSFScopy
# by default, get MN and all servers
my @allsn = ();
my @nlist = xCAT::Utils->list_all_nodes;
my @nlist = xCAT::TableUtils->list_all_nodes;
my $snode;
my $service = "xcat";
if (\@nlist)
{
$snode = xCAT::Utils->getSNformattedhash(\@nlist, $service, "MN");
$snode = xCAT::ServiceNodeUtils->getSNformattedhash(\@nlist, $service, "MN");
}
foreach my $sn (keys %$snode) {
foreach my $img (@imagenames) {
@@ -9642,7 +9644,7 @@ sub mkdsklsnode
#my ($tmp) = $sitetab->getAttribs({'key' => 'sharedinstall'}, 'value');
#my $sharedinstall = $tmp->{value};
#$sitetab->close;
my @sharedinstalls = xCAT::Utils->get_site_attribute("sharedinstall");
my @sharedinstalls = xCAT::TableUtils->get_site_attribute("sharedinstall");
my $sharedinstall = $sharedinstalls[0];
if (!$sharedinstall) {
$sharedinstall="no";
@@ -10246,7 +10248,7 @@ sub mkdsklsnode
#my ($tmp) = $sitetab->getAttribs({'key' => 'sharedinstall'}, 'value');
#my $sharedinstall = $tmp->{value};
#$sitetab->close;
my @sharedinstalls = xCAT::Utils->get_site_attribute("sharedinstall");
my @sharedinstalls = xCAT::TableUtils->get_site_attribute("sharedinstall");
my $sharedinstall = $sharedinstalls[0];
if (!$sharedinstall) {
$sharedinstall="no";
@@ -10317,7 +10319,7 @@ sub mkdsklsnode
next;
}
my $tftpdir = xCAT::Utils->getTftpDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
my $niminfoloc = "$tftpdir/${nodeip}.info";
my $cmd = "cat $niminfoloc | grep 'BASECUST_REMOVAL'";
@@ -10671,7 +10673,7 @@ sub mkdsklsnode
xCAT::MsgUtils->message("E", $rsp, $callback);
next;
}
my $tftpdir = xCAT::Utils->getTftpDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
my $niminfofile = "$tftpdir/${nodeip}.info";
#Update /tftpboot/<node>.info file
my $fscontent;
@@ -10965,7 +10967,7 @@ sub mkdsklsnode
xCAT::MsgUtils->message("E", $rsp, $callback);
}
my $xcatmasterip = xCAT::NetworkUtils->getipaddr((keys %xcatmasterhash)[0]);
my @allips = xCAT::Utils->gethost_ips();
my @allips = xCAT::NetworkUtils->gethost_ips();
my $snlocal;
my $snremote;
@@ -11015,7 +11017,7 @@ sub mkdsklsnode
{
my $ip = $1;
my $netmask = $2;
if(xCAT::Utils::isInSameSubnet($xcatmasterip, $ip, $netmask, 2))
if(xCAT::NetworkUtils::isInSameSubnet($xcatmasterip, $ip, $netmask, 2))
{
$localip = $ip;
last;
@@ -11053,7 +11055,7 @@ sub mkdsklsnode
{
my $ip = $1;
my $netmask = $2;
if(xCAT::Utils::isInSameSubnet($xcatmasterip, $ip, $netmask, 2))
if(xCAT::NetworkUtils::isInSameSubnet($xcatmasterip, $ip, $netmask, 2))
{
$remoteip = $ip;
last;
@@ -11071,7 +11073,7 @@ sub mkdsklsnode
$remoteip = xCAT::NetworkUtils->getipaddr($snremote);
}
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my $scmd = "lsnfsexp -c";
my @output = xCAT::Utils->runcmd("$scmd", -1);
if ($::RUNCMD_RC != 0)
@@ -11622,7 +11624,7 @@ sub make_SN_resource
#my ($tmp) = $sitetab->getAttribs({'key' => 'domain'}, 'value');
#my $domain = $tmp->{value};
#$sitetab->close;
my @domains = xCAT::Utils->get_site_attribute("domain");
my @domains = xCAT::TableUtils->get_site_attribute("domain");
my $domain = $domains[0];
if (!$domain)
{
+12 -11
View File
@@ -11,6 +11,7 @@ use Thread qw(yield);
use POSIX qw(WNOHANG nice);
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use xCAT::SvrUtils;
@@ -57,7 +58,7 @@ sub preprocess_request
#my $stab = xCAT::Table->new('site');
#my $sent;
#($sent) = $stab->getAttribs({key => 'sharedtftp'}, 'value');
my @ents = xCAT::Utils->get_site_attribute("sharedtftp");
my @ents = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $site_ent = $ents[0];
unless ( defined($site_ent)
and ($site_ent =~ /no/i or $site_ent =~ /0/))
@@ -178,21 +179,21 @@ sub mknetboot
#if ($sitetab)
#{
# (my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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) )
{
$installroot = $site_ent;
}
# ($ref) = $sitetab->getAttribs({key => 'xcatdport'}, 'value');
@ents = xCAT::Utils->get_site_attribute("xcatdport");
@ents = xCAT::TableUtils->get_site_attribute("xcatdport");
$site_ent = $ents[0];
if ( defined($site_ent) )
{
$xcatdport = $site_ent;
}
# ($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value');
@ents = xCAT::Utils->get_site_attribute("tftpdir");
@ents = xCAT::TableUtils->get_site_attribute("tftpdir");
$site_ent = $ents[0];
if ( defined($site_ent) )
{
@@ -582,7 +583,7 @@ sub mknetboot
$kcmdline .= $statemnt ." ";
my $xcatmasterip;
# if xcatmaster is hostname, convert it to ip address
if (xCAT::Utils->validate_ip($xcatmaster)) {
if (xCAT::NetworkUtils->validate_ip($xcatmaster)) {
# Using XCAT=<hostname> will cause problems rc.statelite.ppc.redhat
# when trying to run chroot command
$xcatmasterip = xCAT::NetworkUtils->getipaddr($xcatmaster);
@@ -795,7 +796,7 @@ sub mknetboot
);
}
#my $rc = xCAT::Utils->create_postscripts_tar();
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ( $rc != 0 ) {
# xCAT::MsgUtils->message( "S", "Error creating postscripts tar file." );
#}
@@ -820,14 +821,14 @@ sub mkinstall
#if ($sitetab)
#{
# (my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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) )
{
$installroot = $site_ent;
}
#( $ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value');
@ents = xCAT::Utils->get_site_attribute("tftpdir");
@ents = xCAT::TableUtils->get_site_attribute("tftpdir");
$site_ent = $ents[0];
if( defined($site_ent) )
{
@@ -1298,7 +1299,7 @@ sub mkinstall
);
}
}
#my $rc = xCAT::Utils->create_postscripts_tar();
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ($rc != 0)
#{
# xCAT::MsgUtils->message("S", "Error creating postscripts tar file.");
@@ -1319,7 +1320,7 @@ sub copycd
#if ($sitetab)
#{
# (my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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) )
{
@@ -1662,7 +1663,7 @@ sub insert_dd {
my $driverupdatesrc = shift;
my $drivers = shift;
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my $cmd;
+7 -5
View File
@@ -16,7 +16,9 @@ use lib "$::XCATROOT/lib/perl";
use xCAT::Table;
use Thread qw(yield);
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::ServiceNodeUtils;
use xCAT::Usage;
use IO::Socket;
use IO::Pty; #needed for ssh password login
@@ -3743,7 +3745,7 @@ sub preprocess_request {
# build an individual request for each service node
my $service = "xcat";
my @mms=keys(%mpa_hash);
my $sn = xCAT::Utils->get_ServiceNode(\@mms, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@mms, $service, "MN");
# build each request for each service node
foreach my $snkey (keys %$sn)
@@ -3968,7 +3970,7 @@ sub process_request {
my $mpatab = xCAT::Table->new('mpa');
my $mptab = xCAT::Table->new('mp');
my $tmp;
my @entries = xCAT::Utils->get_site_attribute("blademaxp");
my @entries = xCAT::TableUtils->get_site_attribute("blademaxp");
my $site_entry = $entries[0];
if(defined($site_entry)) {
$blademaxp = $site_entry;
@@ -4693,7 +4695,7 @@ sub network {
my $result;
if ($gate) {
$result = xCAT::Utils::toIP($gate);
$result = xCAT::NetworkUtils::toIP($gate);
if (@$result[0] == 0) {
$gateway = @$result[1];
}
@@ -4726,7 +4728,7 @@ sub network {
my $result;
if ($gate) {
$result = xCAT::Utils::toIP($gate);
$result = xCAT::NetworkUtils::toIP($gate);
if (@$result[0] == 0) {
$gateway = @$result[1];
}
@@ -5323,7 +5325,7 @@ sub dompa {
my @allerrornodes=();
my $check=0;
my $global_check=1;
my @entries = xCAT::Utils->get_site_attribute("nodestatus");
my @entries = xCAT::TableUtils->get_site_attribute("nodestatus");
my $site_entry = $entries[0];
if(defined($site_entry)) {
if ($site_entry =~ /0|n|N/) { $global_check=0; }
+3 -2
View File
@@ -4,6 +4,7 @@ use Data::Dumper;
use xCAT::Table;
use xCAT::MsgUtils;
use xCAT::Utils;
use xCAT::TableUtils;
use IO::Select;
use Socket;
@@ -46,7 +47,7 @@ sub net_parms {
$net =~ /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/ or next; #next if ipv6, TODO: IPv6 support
my $netnum = ($1<<24)+($2<<16)+($3<<8)+$4;
if ($gw eq '<xcatmaster>') {
$gw=xCAT::Utils->my_ip_facing($ip);
$gw=xCAT::NetworkUtils->my_ip_facing($ip);
}
if (($ipnum & $masknum)==$netnum) {
return ($ip,$mask,$gw);
@@ -110,7 +111,7 @@ sub process_request {
$password=$tmphash->{password};
}
#$tmphash=($sitetable->getAttribs({key=>'genpasswords'},'value'))[0];
my @entries = xCAT::Utils->get_site_attribute("genpasswords");
my @entries = xCAT::TableUtils->get_site_attribute("genpasswords");
my $site_entry = $entries[0];
if ($site_entry eq "1" or $site_entry =~ /y(es)?/i) {
$password = genpassword(10)."1cA!";
+4 -3
View File
@@ -11,6 +11,7 @@ use Thread qw(yield);
use POSIX qw(WNOHANG nice);
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::MsgUtils;
use xCAT::Template;
#use xCAT::Postage;
@@ -46,7 +47,7 @@ sub preprocess_request
#my $stab = xCAT::Table->new('site');
#my $sent;
#($sent) = $stab->getAttribs({key => 'sharedtftp'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("sharedtftp");
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $site_entry = $entries[0];
unless ( defined($site_entry)
and ( $site_entry =~ /no/i or $site_entry =~ /0/))
@@ -116,8 +117,8 @@ sub mknetboot
my @nodes = @{$req->{node}};
my $ostab = xCAT::Table->new('nodetype');
my $installroot = xCAT::Utils->getInstallDir();
my $tftpdir = xCAT::Utils->getTftpDir();
my $installroot = xCAT::TableUtils->getInstallDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
my %donetftp=();
my %oents = %{$ostab->getNodesAttribs(\@nodes,[qw(os arch profile)])};
+9 -8
View File
@@ -4,6 +4,7 @@ package xCAT_plugin::conserver;
use strict;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use Getopt::Long;
use Sys::Hostname;
@@ -55,7 +56,7 @@ sub preprocess_request {
@ARGV=@exargs;
my $isSN=xCAT::Utils->isServiceNode();
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) { $iphash{$_}=1;}
@@ -96,7 +97,7 @@ sub preprocess_request {
# get site master
my $master=xCAT::Utils->get_site_Master();
my $master=xCAT::TableUtils->get_site_Master();
if (!$master) { $master=hostname(); }
# get conserver for each node
@@ -226,10 +227,10 @@ sub docfheaders {
#push @$content,"#xCAT BEGIN ACCESS\n";
push @newheaders,"access * {\n";
push @newheaders," trusted 127.0.0.1;\n";
my $master=xCAT::Utils->get_site_Master();
my $master=xCAT::TableUtils->get_site_Master();
push @newheaders, " trusted $master;\n";
# trust all the ip addresses configured on this node
my @allips = xCAT::Utils->gethost_ips();
my @allips = xCAT::NetworkUtils->gethost_ips();
my @ips = ();
#remove $xcatmaster and duplicate entries
foreach my $ip (@allips) {
@@ -260,7 +261,7 @@ sub docfheaders {
#-- which seems to kill AMMs occasionally
#my $sitetab = xCAT::Table->new('site');
#my $vcon = $sitetab->getAttribs({key => "consoleondemand"}, 'value');
my @entries = xCAT::Utils->get_site_attribute("consoleondemand");
my @entries = xCAT::TableUtils->get_site_attribute("consoleondemand");
my $site_entry = $entries[0];
if ( defined($site_entry) and $site_entry eq "yes" ) {
push @newheaders," options ondemand;\n";
@@ -298,7 +299,7 @@ sub makeconservercf {
docfheaders(\@filecontent);
my $isSN=xCAT::Utils->isServiceNode();
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
@@ -504,12 +505,12 @@ sub donodeent {
if (grep(/^$cmeth$/,@cservers)) {
push @$content," include ".$cfgent->{termserver}.";\n";
push @$content," port ".$cfgent->{termport}.";\n";
if ((!$isSN) && ($cfgent->{conserver}) && xCAT::Utils->thishostisnot($cfgent->{conserver})) { # let the master handle it
if ((!$isSN) && ($cfgent->{conserver}) && xCAT::NetworkUtils->thishostisnot($cfgent->{conserver})) { # let the master handle it
push @$content," master ".$cfgent->{conserver}.";\n";
}
} else { #a script method...
push @$content," type exec;\n";
if ((!$isSN) && ($cfgent->{conserver}) && xCAT::Utils->thishostisnot($cfgent->{conserver})) { # let the master handle it
if ((!$isSN) && ($cfgent->{conserver}) && xCAT::NetworkUtils->thishostisnot($cfgent->{conserver})) { # let the master handle it
push @$content," master ".$cfgent->{conserver}.";\n";
} else { # handle it here
my $locerror = $isSN ? "PERL_BADLANG=0 " : ''; # on service nodes, often LC_ALL is not set and perl complains
+10 -9
View File
@@ -5,6 +5,7 @@ use Net::DNS;
use File::Path;
use xCAT::Table;
use Sys::Hostname;
use xCAT::TableUtils;
use xCAT::NetworkUtils qw/getipaddr/;
use Math::BigInt;
use MIME::Base64;
@@ -27,7 +28,7 @@ sub handled_commands
{
#my $sitetab = xCAT::Table->new('site');
#my $stab = $sitetab->getAttribs({key=>'dnshandler'},['value']);
my @entries = xCAT::Utils->get_site_attribute("dnshandler");
my @entries = xCAT::TableUtils->get_site_attribute("dnshandler");
my $site_entry = $entries[0];
unless ( defined($site_entry)) {
return {"makedns" => "ddns"};
@@ -242,7 +243,7 @@ sub process_request {
# check for site.domain
#my $sitetab = xCAT::Table->new('site');
#my $stab = $sitetab->getAttribs({key=>'domain'},['value']);
my @entries = xCAT::Utils->get_site_attribute("domain");
my @entries = xCAT::TableUtils->get_site_attribute("domain");
my $site_entry = $entries[0];
unless ( defined($site_entry)) {
xCAT::SvrUtils::sendmsg([1,"domain not defined in site table"], $callback);
@@ -411,7 +412,7 @@ sub process_request {
} #do not warn/error here yet, if we can't generate or extract, we'll know later
#$stab = $sitetab->getAttribs({key=>'forwarders'},['value']);
my @entries = xCAT::Utils->get_site_attribute("forwarders");
my @entries = xCAT::TableUtils->get_site_attribute("forwarders");
my $site_entry = $entries[0];
if ( defined($site_entry)) {
my @forwarders = split /[ ,]/,$site_entry;
@@ -435,11 +436,11 @@ sub process_request {
#here, we are examining local files to assure that our key is in named.conf, the zones we care about are there, and that if
#active directory is in use, allow the domain controllers to update specific zones
#$stab =$sitetab->getAttribs({key=>'directoryprovider'},['value']);
@entries = xCAT::Utils->get_site_attribute("directoryprovider");
@entries = xCAT::TableUtils->get_site_attribute("directoryprovider");
$site_entry = $entries[0];
if ( defined($site_entry) and $site_entry eq 'activedirectory') {
#$stab =$sitetab->getAttribs({key=>'directoryservers'},['value']);
@entries = xCAT::Utils->get_site_attribute("directoryservers");
@entries = xCAT::TableUtils->get_site_attribute("directoryservers");
$site_entry = $entries[0];
if ( defined($site_entry)) {
my @dservers = split /[ ,]/,$site_entry;
@@ -453,7 +454,7 @@ sub process_request {
}
}
#$stab =$sitetab->getAttribs({key=>'dnsupdaters'},['value']); #allow unsecure updates from these
@entries = xCAT::Utils->get_site_attribute("dnsupdaters");
@entries = xCAT::TableUtils->get_site_attribute("dnsupdaters");
$site_entry = $entries[0];
if ( defined($site_entry) ) {
my @nservers = split /[ ,]/,$site_entry;
@@ -550,7 +551,7 @@ sub get_zonesdir {
# xCAT::MsgUtils->message("E", $rsp, $callback, 1);
#}
my @entries = xCAT::Utils->get_site_attribute("bindzones");
my @entries = xCAT::TableUtils->get_site_attribute("bindzones");
my $site_entry = $entries[0];
#if ($sitetab) {
@@ -579,7 +580,7 @@ sub get_conf {
# xCAT::MsgUtils->message("E", $rsp, $callback, 1);
#}
my @entries = xCAT::Utils->get_site_attribute("bindconf");
my @entries = xCAT::TableUtils->get_site_attribute("bindconf");
my $site_entry = $entries[0];
#if ($sitetab) {
@@ -602,7 +603,7 @@ sub get_dbdir {
# xCAT::MsgUtils->message("E", $rsp, $callback, 1);
#}
my @entries = xCAT::Utils->get_site_attribute("binddir");
my @entries = xCAT::TableUtils->get_site_attribute("binddir");
my $site_entry = $entries[0];
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'binddir'}, 'value');
+3 -2
View File
@@ -10,6 +10,7 @@ use Sys::Syslog;
use File::Temp qw/tempdir/;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::MsgUtils;
use Data::Dumper;
@@ -827,7 +828,7 @@ sub mkinstall
);
}
}
#my $rc = xCAT::Utils->create_postscripts_tar();
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ($rc != 0)
#{
# xCAT::MsgUtils->message("S", "Error creating postscripts tar file.");
@@ -1423,7 +1424,7 @@ sub mknetboot
);
}
#my $rc = xCAT::Utils->create_postscripts_tar();
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ( $rc != 0 ) {
# xCAT::MsgUtils->message( "S", "Error creating postscripts tar file." );
#}
+7 -6
View File
@@ -3,6 +3,7 @@ package xCAT_plugin::destiny;
use xCAT::NodeRange;
use Data::Dumper;
use xCAT::Utils;
use xCAT::TableUtils;
use Sys::Syslog;
use xCAT::GlobalDef;
use xCAT::Table;
@@ -29,7 +30,7 @@ my $nonodestatus=0;
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref1) = $sitetab->getAttribs({key => 'nodestatus'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("nodestatus");
my @entries = xCAT::TableUtils->get_site_attribute("nodestatus");
my $site_entry = $entries[0];
if ( defined($site_entry) ) {
if ($site_entry =~ /0|n|N/) { $nonodestatus=1; }
@@ -49,7 +50,7 @@ sub process_request {
$callback = shift;
$subreq = shift;
if (xCAT::Utils->isMN()) {
my $result= xCAT::Utils->checkCredFiles($callback);
my $result= xCAT::TableUtils->checkCredFiles($callback);
}
if ($request->{command}->[0] eq 'getdestiny') {
getdestiny(0);
@@ -236,10 +237,10 @@ sub setdestiny {
my $nodehm = xCAT::Table->new('nodehm');
my $hments = $nodehm->getNodesAttribs(\@nodes,['serialport','serialspeed','serialflow']);
#(my $portent) = $sitetab->getAttribs({key=>'xcatdport'},'value');
my @entries = xCAT::Utils->get_site_attribute("xcatdport");
my @entries = xCAT::TableUtils->get_site_attribute("xcatdport");
my $port_entry = $entries[0];
#(my $mastent) = $sitetab->getAttribs({key=>'master'},'value');
my @entries = xCAT::Utils->get_site_attribute("master");
my @entries = xCAT::TableUtils->get_site_attribute("master");
my $master_entry = $entries[0];
my $enthash = $nodetype->getNodesAttribs(\@nodes,[qw(arch)]);
my $resents = $restab->getNodeAttribs(\@nodes,[qw(xcatmaster)]);
@@ -465,7 +466,7 @@ sub getdestiny {
my $bpents = $bptab->getNodesAttribs(\@nodes,[qw(kernel initrd kcmdline xcatmaster)]);
#my $sitetab= xCAT::Table->new('site');
#(my $sent) = $sitetab->getAttribs({key=>'master'},'value');
my @entries = xCAT::Utils->get_site_attribute("master");
my @entries = xCAT::TableUtils->get_site_attribute("master");
my $master_value = $entries[0];
my %node_status=();
@@ -521,7 +522,7 @@ sub getdestiny {
} elsif (defined( $master_value )) {
$response{imgserver}=$master_value;
} else {
$response{imgserver} = xCAT::Utils->my_ip_facing($node);
$response{imgserver} = xCAT::NetworkUtils->my_ip_facing($node);
}
#collect node status for certain states
+30 -28
View File
@@ -20,8 +20,10 @@ my $candoipv6 = eval {
};
use Sys::Syslog;
use IPC::Open2;
use xCAT::NetworkUtils qw/getipaddr/;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils qw/getipaddr/;
use xCAT::ServiceNodeUtils;
use xCAT::NodeRange;
use Fcntl ':flock';
@@ -46,7 +48,7 @@ my $vpdhash;
my $iscsients;
my $nodetypeents;
my $chainents;
my $tftpdir = xCAT::Utils->getTftpDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
use Math::BigInt;
my $dhcpconffile = $^O eq 'aix' ? '/etc/dhcpsd.cnf' : '/etc/dhcpd.conf';
my %dynamicranges; #track dynamic ranges defined to see if a host that resolves is actually a dynamic address
@@ -385,7 +387,7 @@ sub addnode
# } #if 'guess_next_server', inherit from the network provided value... see how this pans out
# if ($guess_next_server and $ip and $ip ne "DENIED")
# {
# $nxtsrv = xCAT::Utils->my_ip_facing($hname);
# $nxtsrv = xCAT::NetworkUtils->my_ip_facing($hname);
# if ($nxtsrv)
# {
# $tftpserver = $nxtsrv;
@@ -534,7 +536,7 @@ sub addrangedetection {
my $begin;
my $end;
my $myip;
$myip = xCAT::Utils->my_ip_facing($net->{net});
$myip = xCAT::NetworkUtils->my_ip_facing($net->{net});
# convert <xcatmaster> to nameserver IP
if ($net->{nameservers} eq '<xcatmaster>')
@@ -620,7 +622,7 @@ sub addnode_aix
{
if ( $dhcpconf[$i] =~ / ([\d\.]+)\/(\d+) ip configuration end/)
{
if (xCAT::Utils::isInSameSubnet( $ip, $1, $2, 1))
if (xCAT::NetworkUtils::isInSameSubnet( $ip, $1, $2, 1))
{
$isSubnetFound = 1;
$netmask = $2;
@@ -630,7 +632,7 @@ sub addnode_aix
}
# Format the netmask from AIX format (24) to Linux format (255.255.255.0)
my $netmask_linux = xCAT::Utils::formatNetmask( $netmask,1,0);
my $netmask_linux = xCAT::NetworkUtils::formatNetmask( $netmask,1,0);
# Create node section
my @node_section = ();
@@ -715,7 +717,7 @@ sub preprocess_request
#{
#my $href;
#($href) = $sitetab->getAttribs({key => 'disjointdhcps'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("disjointdhcps");
my @entries = xCAT::TableUtils->get_site_attribute("disjointdhcps");
my $t_entry = $entries[0];
if (defined($t_entry)) {
$snonly=$t_entry;
@@ -786,10 +788,10 @@ sub preprocess_request
if (($snonly == 1) && (! grep /-n/,@{$req->{arg}})) {
if (@nodes > 0) {
my $sn_hash =xCAT::Utils->getSNformattedhash(\@nodes,"xcat","MN");
my $sn_hash =xCAT::ServiceNodeUtils->getSNformattedhash(\@nodes,"xcat","MN");
if ($localonly) {
#check if this node is the service node for any input node
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
foreach(keys %$sn_hash) {
@@ -802,7 +804,7 @@ sub preprocess_request
}
}
} else {
my @sn = xCAT::Utils->getSNList('dhcpserver');
my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver');
if (@sn > 0) { $hasHierarchy=1;}
foreach(keys %$sn_hash) {
@@ -818,7 +820,7 @@ sub preprocess_request
$req->{'node'}=\@nodes;
@requests = ({%$req}); #Start with a straight copy to reflect local instance
unless ($localonly) {
my @sn = xCAT::Utils->getSNList('dhcpserver');
my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver');
if (@sn > 0) { $hasHierarchy=1; }
foreach my $s (@sn)
@@ -865,10 +867,10 @@ sub process_request
my $isok=1;
if (xCAT::Utils->isServiceNode()) {
$isok=0;
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
my @sn = xCAT::Utils->getSNList('dhcpserver');
my @sn = xCAT::ServiceNodeUtils->getSNList('dhcpserver');
foreach my $s (@sn)
{
if (exists($iphash{$s})) {
@@ -889,11 +891,11 @@ sub process_request
#{
#my $href;
#($href) = $sitetab->getAttribs({key => 'dhcpinterfaces'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("dhcpinterfaces");
my @entries = xCAT::TableUtils->get_site_attribute("dhcpinterfaces");
my $t_entry = $entries[0];
unless ( defined($t_entry) )
{ #LEGACY: singular keyname for old style site value
@entries = xCAT::Utils->get_site_attribute("dhcpinterface");
@entries = xCAT::TableUtils->get_site_attribute("dhcpinterface");
$t_entry = $entries[0];
#($href) = $sitetab->getAttribs({key => 'dhcpinterface'}, 'value');
}
@@ -913,14 +915,14 @@ sub process_request
(my $ngroup,$dhcpif) = split /\|/,$dhcpif;
foreach $host (noderange($ngroup)) {
$savehost=$host;
unless (xCAT::Utils->thishostisnot($host)) {
unless (xCAT::NetworkUtils->thishostisnot($host)) {
$foundself=1;
last;
}
}
if (!defined($savehost)) { # host not defined in db,
# probably management node
unless (xCAT::Utils->thishostisnot($ngroup)) {
unless (xCAT::NetworkUtils->thishostisnot($ngroup)) {
$foundself=1;
}
}
@@ -936,26 +938,26 @@ sub process_request
}
}
#($href) = $sitetab->getAttribs({key => 'nameservers'}, 'value');
@entries = xCAT::Utils->get_site_attribute("nameservers");
@entries = xCAT::TableUtils->get_site_attribute("nameservers");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$sitenameservers = $t_entry;
}
#($href) = $sitetab->getAttribs({key => 'ntpservers'}, 'value');
@entries = xCAT::Utils->get_site_attribute("ntpservers");
@entries = xCAT::TableUtils->get_site_attribute("ntpservers");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$sitentpservers = $t_entry;
}
#($href) = $sitetab->getAttribs({key => 'logservers'}, 'value');
@entries = xCAT::Utils->get_site_attribute("logservers");
@entries = xCAT::TableUtils->get_site_attribute("logservers");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$sitelogservers = $t_entry;
}
#($href) = $sitetab->getAttribs({key => 'domain'}, 'value');
#($href) = $sitetab->getAttribs({key => 'domain'}, 'value');
@entries = xCAT::Utils->get_site_attribute("domain");
@entries = xCAT::TableUtils->get_site_attribute("domain");
$t_entry = $entries[0];
unless ( defined($t_entry) )
{
@@ -1047,7 +1049,7 @@ sub process_request
}
if ($^O eq 'aix')
{
@nrn = xCAT::Utils::get_subnet_aix();
@nrn = xCAT::NetworkUtils::get_subnet_aix();
}
else
{
@@ -1319,7 +1321,7 @@ sub process_request
my $ip_hash;
foreach my $node ( @{$req->{node}} ) {
#need to change the way of finding IP for nodes
my $ifip = xCAT::Utils->isIpaddr($node);
my $ifip = xCAT::NetworkUtils->isIpaddr($node);
if ($ifip)
{
$ip_hash->{ $node} = $node;
@@ -1406,7 +1408,7 @@ sub process_request
}
else
{
if (xCAT::NetworkUtils->getipaddr($_) and not xCAT::Utils->nodeonmynet($_))
if (xCAT::NetworkUtils->getipaddr($_) and not xCAT::NetworkUtils->nodeonmynet($_))
{
next;
}
@@ -1579,7 +1581,7 @@ sub putmyselffirst {
my @dnsrvs = split /,/,$srvlist;
my @reordered;
foreach (@dnsrvs) {
if (xCAT::Utils->thishostisnot($_)) {
if (xCAT::NetworkUtils->thishostisnot($_)) {
push @reordered,$_;
} else {
unshift @reordered,$_;
@@ -1722,7 +1724,7 @@ sub addnet
my $tftp;
my $range;
my $myip;
$myip = xCAT::Utils->my_ip_facing($net);
$myip = xCAT::NetworkUtils->my_ip_facing($net);
if ($nettab)
{
my $mask_formated = $mask;
@@ -1805,7 +1807,7 @@ sub addnet
if ($ent and $ent->{dynamicrange})
{
unless ($ent->{dhcpserver}
and xCAT::Utils->thishostisnot($ent->{dhcpserver}))
and xCAT::NetworkUtils->thishostisnot($ent->{dhcpserver}))
{ #If specific, only one dhcp server gets a dynamic range
$range = $ent->{dynamicrange};
$range =~ s/[,-]/ /g;
@@ -2004,7 +2006,7 @@ sub gen_aix_net
$gateway = '';
}
}
if (xCAT::Utils::isInSameSubnet($gateway,$net,$mask,1))
if (xCAT::NetworkUtils::isInSameSubnet($gateway,$net,$mask,1))
{
push @netent, " option 3 $gateway\n";
}
+10 -8
View File
@@ -4,6 +4,8 @@ use strict;
use warnings;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::TZUtils;
use Time::HiRes qw (sleep);
use xCAT::Template;
@@ -232,7 +234,7 @@ sub preprocess_request {
my @allnodes;
push @allnodes,@hyps;
push @allnodes,@$noderange;
my $sn = xCAT::Utils->get_ServiceNode(\@allnodes, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@allnodes, $service, "MN");
#vmtabhash was from when we had vm.host do double duty for hypervisor data
#$vmtabhash = $vmtab->getNodesAttribs(\@hyps,['host']);
#We now use hypervisor fields to be unambiguous
@@ -347,13 +349,13 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#if($sitetab){
#(my $ref) = $sitetab->getAttribs({key => 'usehostnamesforvcenter'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("usehostnamesforvcenter");
my @entries = xCAT::TableUtils->get_site_attribute("usehostnamesforvcenter");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
$usehostnamesforvcenter = $t_entry;
}
#($ref) = $sitetab->getAttribs({key => 'vcenterautojoin'}, 'value');
@entries = xCAT::Utils->get_site_attribute("vcenterautojoin");
@entries = xCAT::TableUtils->get_site_attribute("vcenterautojoin");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$vcenterautojoin = $t_entry;
@@ -362,7 +364,7 @@ sub process_request {
}
}
#($ref) = $sitetab->getAttribs({key => 'vmwaredatastoreautomount'}, 'value');
@entries = xCAT::Utils->get_site_attribute("vmwaredatastoreautomount");
@entries = xCAT::TableUtils->get_site_attribute("vmwaredatastoreautomount");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$datastoreautomount = $t_entry;
@@ -371,7 +373,7 @@ sub process_request {
}
}
#($ref) = $sitetab->getAttribs({key => 'vmwarereconfigonpower'},'value');
@entries = xCAT::Utils->get_site_attribute("vmwarereconfigonpower");
@entries = xCAT::TableUtils->get_site_attribute("vmwarereconfigonpower");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$reconfigreset=$t_entry;
@@ -4077,7 +4079,7 @@ sub copycd {
#my $sitetab = xCAT::Table->new('site');
#if($sitetab){
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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;
@@ -4479,13 +4481,13 @@ sub mkcommonboot {
my $installroot = "/install";
#if ($sitetab){
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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;
}
#($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value');
@entries = xCAT::Utils->get_site_attribute("tftpdir");
@entries = xCAT::TableUtils->get_site_attribute("tftpdir");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$globaltftpdir = $t_entry;
+1 -1
View File
@@ -255,7 +255,7 @@ sub getfspcon {
my %request;
xCAT::FSPUtils::getHcpAttribs(\%request, \%tabs);
#my $fsp_ip = xCAT::Utils::getNodeIPaddress( $fsp_name );
#my $fsp_ip = xCAT::NetworkUtils::getNodeIPaddress( $fsp_name );
my $fsp_ip = xCAT::FSPUtils::getIPaddress(\%request, $type, $fsp_name );
if(!defined($fsp_ip)) {
#return "Failed to get the $fsp_name\'s ip";
+2 -1
View File
@@ -5,6 +5,7 @@ BEGIN
}
use lib "$::XCATROOT/lib/perl";
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::Table;
#use Data::Dumper;
@@ -41,7 +42,7 @@ sub process_request {
#now handle genimage
my $installroot = "/install";
$installroot = xCAT::Utils->getInstallDir();
$installroot = xCAT::TableUtils->getInstallDir();
my $prinic; #TODO be flexible on node primary nic
my $othernics; #TODO be flexible on node primary nic
my $netdriver;
+5 -4
View File
@@ -3,6 +3,7 @@ package xCAT_plugin::hosts;
use strict;
use warnings;
use xCAT::Table;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use Data::Dumper;
use File::Copy;
@@ -117,7 +118,7 @@ sub addotherinterfaces {
my @itf_pairs=split(/,/, $otherinterfaces);
foreach (@itf_pairs) {
my ($itf,$ip)=split(/:/, $_);
if ( $ip && xCAT::Utils->isIpaddr($ip) ) {
if ( $ip && xCAT::NetworkUtils->isIpaddr($ip) ) {
if ($itf =~ /^-/ ) {
$itf = $node.$itf };
addnode $itf,$ip,'',$domain;
@@ -168,7 +169,7 @@ sub process_request {
my $lockh;
#if ($sitetab) {
#my $dent = $sitetab->getAttribs({key=>'domain'},'value');
my @entries = xCAT::Utils->get_site_attribute("domain");
my @entries = xCAT::TableUtils->get_site_attribute("domain");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
$domain=$t_entry;
@@ -229,7 +230,7 @@ sub process_request {
if ($DELNODE) {
delnode $ref->{node},$ref->{ip},$ref->{hostnames},$domain;
} else {
if ( xCAT::Utils->isIpaddr($ref->{ip}) ) {
if ( xCAT::NetworkUtils->isIpaddr($ref->{ip}) ) {
addnode $ref->{node},$ref->{ip},$ref->{hostnames},$domain;
}
if (defined($ref->{otherinterfaces})){
@@ -244,7 +245,7 @@ sub process_request {
}
my @hostents = $hoststab->getAllNodeAttribs(['ip','node','hostnames','otherinterfaces']);
foreach (@hostents) {
if ( xCAT::Utils->isIpaddr($_->{ip}) ) {
if ( xCAT::NetworkUtils->isIpaddr($_->{ip}) ) {
addnode $_->{node},$_->{ip},$_->{hostnames},$domain;
}
if (defined($_->{otherinterfaces})){
+4 -2
View File
@@ -17,6 +17,8 @@ use lib "$::XCATROOT/lib/perl";
use strict;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::Usage;
use IO::Socket;
use Thread 'yield';
@@ -363,7 +365,7 @@ sub preprocess_request {
# build an individual request for each service node
my $service = "xcat";
my @mms=keys(%mpa_hash);
my $sn = xCAT::Utils->get_ServiceNode(\@mms, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@mms, $service, "MN");
# build each request for each service node
foreach my $snkey (keys %$sn)
@@ -644,7 +646,7 @@ sub process_request {
my $tmp;
#if ($sitetab) {
#($tmp)=$sitetab->getAttribs({'key'=>'blademaxp'},'value');
my @entries = xCAT::Utils->get_site_attribute("blademaxp");
my @entries = xCAT::TableUtils->get_site_attribute("blademaxp");
my $t_entry = $entries[0];
if (defined($t_entry)) { $blademaxp=$t_entry; }
#}
+2 -1
View File
@@ -16,6 +16,7 @@ use Data::Dumper; # for debug purpose
use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use xCAT::Table;
use File::Path qw(mkpath);
@@ -40,7 +41,7 @@ sub process_request {
$node = $request->{node}->[0];
}
$installroot = xCAT::Utils->getInstallDir();
$installroot = xCAT::TableUtils->getInstallDir();
@ARGV = @{$request->{arg}} if (defined $request->{arg});
my $argc = scalar @ARGV;
+5 -4
View File
@@ -18,6 +18,7 @@ use warnings;
#use xCAT::Schema;
#use xCAT::NodeRange qw/noderange abbreviate_noderange/;
#use xCAT::Utils;
use xCAT::TableUtils;
use Data::Dumper;
use XML::Simple;
use POSIX qw/strftime/;
@@ -384,7 +385,7 @@ sub get_files{
my $xcatroot = "/opt/xcat";
# get the install root
my $installroot = xCAT::Utils->getInstallDir();
my $installroot = xCAT::TableUtils->getInstallDir();
unless($installroot){
$installroot = '/install';
}
@@ -841,7 +842,7 @@ sub change_profile {
my $srcdir=shift;
$data->{profile}=$new_profile;
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
unless($installdir){
$installdir = '/install';
}
@@ -897,7 +898,7 @@ sub check_media {
}elsif($data->{media} eq 'required'){
my $os = $data->{osvers};
my $arch = $data->{osarch};
my $installroot = xCAT::Utils->getInstallDir();
my $installroot = xCAT::TableUtils->getInstallDir();
unless($installroot){
$installroot = '/install';
}
@@ -1179,7 +1180,7 @@ sub make_files {
my $os = $data->{osvers};
my $arch = $data->{osarch};
my $profile = $data->{profile};
my $installroot = xCAT::Utils->getInstallDir();
my $installroot = xCAT::TableUtils->getInstallDir();
unless($installroot){
$installroot = '/install';
}
+4 -2
View File
@@ -20,6 +20,8 @@ use xCAT::IPMI;
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);
@@ -5563,7 +5565,7 @@ sub preprocess_request {
if (defined $::XCATSITEVALS{ipmidispatch} and $::XCATSITEVALS{ipmidispatch} =~ /0|n/i) { #no SN indicated, instead do randomize
randomizelist($realnoderange);
} else { # sn is indicated
my $bigsnmap = xCAT::Utils->get_ServiceNode($realnoderange, "xcat", "MN");
my $bigsnmap = xCAT::ServiceNodeUtils->get_ServiceNode($realnoderange, "xcat", "MN");
foreach my $servicenode (keys %$bigsnmap) { #let's also shuffle within each service node responsibliity
randomizelist($bigsnmap->{$servicenode})
}
@@ -5597,7 +5599,7 @@ sub preprocess_request {
if (defined $::XCATSITEVALS{ipmidispatch} and $::XCATSITEVALS{ipmidispatch} =~ /0|n/i) {
$sn = { '!xcatlocal!' => $noderange };
} else {
$sn = xCAT::Utils->get_ServiceNode($noderange, "xcat", "MN");
$sn = xCAT::ServiceNodeUtils->get_ServiceNode($noderange, "xcat", "MN");
}
# build each request for each service node
+3 -2
View File
@@ -1,6 +1,7 @@
package xCAT_plugin::iscsi;
use strict;
use xCAT::Table;
use xCAT::TableUtils;
use Socket;
use File::Path;
use File::Basename;
@@ -71,12 +72,12 @@ sub process_request {
#}
my $domain;
#(my $ipent) = $sitetab->getAttribs({key=>'domain'},'value');
my @entries = xCAT::Utils->get_site_attribute("domain");
my @entries = xCAT::TableUtils->get_site_attribute("domain");
my $t_entry = $entries[0];
if ( defined($t_entry) ) { $domain = $t_entry; }
#($ipent) = $sitetab->getAttribs({key=>'iscsidir'},'value');
my $iscsiprefix;
my @entries = xCAT::Utils->get_site_attribute("iscsidir");
my @entries = xCAT::TableUtils->get_site_attribute("iscsidir");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
$iscsiprefix = $t_entry;
+3 -1
View File
@@ -22,6 +22,8 @@ use File::Basename qw/fileparse/;
use File::Path qw/mkpath/;
use IO::Socket;
use IO::Select;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use strict;
#use warnings;
my $use_xhrm=0; #xCAT Hypervisor Resource Manager, to satisfy networking and storage prerequisites, default to not using it for the moment
@@ -2326,7 +2328,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
+4 -4
View File
@@ -822,7 +822,7 @@ sub get_host_from_url {
#######################################
# Extract IP from URL
#######################################
my $nets = xCAT::Utils::my_nets();
my $nets = xCAT::NetworkUtils::my_nets();
my $inc = $globalopt{i};
my @ips = (exists $attr->{'ip-address'})? @{$attr->{'ip-address'}}: @{$attr->{'ipv4-address'}};
@@ -846,7 +846,7 @@ sub get_host_from_url {
next if ( $tip =~ /:/); #skip IPV6 addresses
for my $net ( keys %$nets) {
my ($n,$m) = split /\//,$net;
if ( #xCAT::Utils::isInSameSubnet($n, $tip, $m, 1) and
if ( #xCAT::NetworkUtils::isInSameSubnet($n, $tip, $m, 1) and
xCAT::Utils::isPingable($tip) and (length(inet_aton($tip)) == 4)) {
push @validip, $tip;
}
@@ -1637,7 +1637,7 @@ sub filtersamevlan {
my $request = shift;
my $oldhash = shift;
my $newhash;
my $nets = xCAT::Utils::my_nets();
my $nets = xCAT::NetworkUtils::my_nets();
my $validnets;
for my $net ( keys %$nets) {
for my $nic ( split /,/, $globalopt{i} ) {
@@ -1651,7 +1651,7 @@ sub filtersamevlan {
my $ip = $name->{ip};
for my $net ( keys %$validnets){
my ($n,$m) = split /\//,$net;
if ( xCAT::Utils::isInSameSubnet( $n, $ip, $m, 1) and xCAT::Utils::isPingable( $ip)) {
if ( xCAT::NetworkUtils::isInSameSubnet( $n, $ip, $m, 1) and xCAT::NetworkUtils::isPingable( $ip)) {
$newhash->{$name} = ${$oldhash->{$name}}{hostname};
}
}
@@ -15,7 +15,7 @@ use strict;
require xCAT::Table;
require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::MsgUtils;
use Getopt::Long;
use Socket;
@@ -253,7 +253,7 @@ sub add_known_host
if (defined $hostname)
{
my $sitedomain;
my @domain = xCAT::Utils->get_site_attribute("domain");
my @domain = xCAT::TableUtils->get_site_attribute("domain");
if ($domain[0])
{
$sitedomain = $domain[0];
+7 -6
View File
@@ -2,6 +2,7 @@ package xCAT_plugin::mknb;
use strict;
use File::Temp qw(tempdir);
use xCAT::Utils;
use xCAT::TableUtils;
use File::Path;
use File::Copy;
@@ -21,25 +22,25 @@ sub process_request {
my $xcatdport = 3001;
#if ($sitetab) {
#my $portent = $sitetab->getAttribs({key=>'defserialport'},'value');
my @entries = xCAT::Utils->get_site_attribute("defserialport");
my @entries = xCAT::TableUtils->get_site_attribute("defserialport");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
$serialport=$t_entry;
}
#$portent = $sitetab->getAttribs({key=>'defserialspeed'},'value');
@entries = xCAT::Utils->get_site_attribute("defserialspeed");
@entries = xCAT::TableUtils->get_site_attribute("defserialspeed");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$serialspeed=$t_entry;
}
#$portent = $sitetab->getAttribs({key=>'defserialflow'},'value');
@entries = xCAT::Utils->get_site_attribute("defserialflow");
@entries = xCAT::TableUtils->get_site_attribute("defserialflow");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$serialflow=$t_entry;
}
#$portent = $sitetab->getAttribs({key=>'xcatdport'},'value');
@entries = xCAT::Utils->get_site_attribute("xcatdport");
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$xcatdport=$t_entry;
@@ -47,7 +48,7 @@ sub process_request {
#$sitetab->close;
#}
my $tftpdir = xCAT::Utils->getTftpDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
my $arch = $request->{arg}->[0];
if (! $arch) {
$callback->({error=>"Need to specify architecture (x86, x86_64 or ppc64)"},{errorcode=>[1]});
@@ -140,7 +141,7 @@ sub process_request {
system("cd $tempdir; find . | cpio -o -H newc | gzip -9 > $tftpdir/xcat/nbfs.$arch.gz");
}
system ("rm -rf $tempdir");
my $hexnets = xCAT::Utils->my_hexnets();
my $hexnets = xCAT::NetworkUtils->my_hexnets();
my $normnets = xCAT::Utils->my_nets();
my $consolecmdline;
if (defined($serialport) and $serialspeed) {
+1 -1
View File
@@ -129,7 +129,7 @@ sub preprocess_request
my @mon_servers=keys(%$mon_hierachy);
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
#print "hostinfo=@hostinfo\n";
my $isSV=xCAT::Utils->isServiceNode();
my %iphash=();
+5 -3
View File
@@ -5,7 +5,9 @@ use Data::Dumper;
use Sys::Syslog;
use Socket;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::ServiceNodeUtils;
use Getopt::Long;
sub handled_commands
@@ -67,7 +69,7 @@ sub preprocess_request
return undef;
}
my @sn = xCAT::Utils->getSNList();
my @sn = xCAT::ServiceNodeUtils->getSNList();
foreach my $s (@sn)
{
my $reqcopy = {%$req};
@@ -172,7 +174,7 @@ sub donets
return 1;
}
my $master=xCAT::Utils->get_site_Master();
my $master=xCAT::TableUtils->get_site_Master();
my $masterip = xCAT::NetworkUtils->getipaddr($master);
if ($masterip =~ /:/) {
# do each ethernet interface for ipv6
@@ -278,7 +280,7 @@ sub donets
$netmask = $fields[2];
if ($fields[6])
{
if(xCAT::Utils::isInSameSubnet($fields[6], $ipaddr, $netmask, 0))
if(xCAT::NetworkUtils::isInSameSubnet($fields[6], $ipaddr, $netmask, 0))
{
$gateway = $fields[6];
}
+1 -1
View File
@@ -31,7 +31,7 @@ sub gethosttag {
my $netn = shift;
my $ifname = shift;
my $usednames = shift;
my %netmap = %{xCAT::Utils::my_if_netmap()};
my %netmap = %{xCAT::NetworkUtils::my_if_netmap()};
my $mgtifname = $netmap{$netn};
my $secondpass = 0;
my $name = "";
+7 -5
View File
@@ -22,7 +22,9 @@ use Getopt::Long;
use Data::Dumper;
use xCAT::GlobalDef;
use xCAT::NetworkUtils;
require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::ServiceNodeUtils;
my %nodesetstats;
my %chainhash;
@@ -188,7 +190,7 @@ sub preprocess_request
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'useNmapfromMN'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("useNmapfromMN");
my @entries = xCAT::TableUtils->get_site_attribute("useNmapfromMN");
my $t_entry = $entries[0];
if (defined($t_entry)) {
if ($t_entry =~ /1|yes|YES|Y|y/) { $usenmapfrommn=1; }
@@ -253,7 +255,7 @@ sub preprocess_request
#print Dumper(%apps);
# find service nodes for requested nodes
# build an individual request for each service node
my $sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode($nodes, $service, "MN");
#get the member for each group
my %groups=();
@@ -439,7 +441,7 @@ sub preprocess_request
#mn handles all nmap when useNmapfromMN=1 on the site table
if (($usenmapfrommn == 1) && (keys(%all_porthash) > 0)) {
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
my $handled=0;
@@ -490,7 +492,7 @@ sub preprocess_request
#now handle local commands
#print "lcmdhash=" . Dumper(%lcmdhash);
if (keys(%lcmdhash) > 0) {
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
my $handled=0;
+3 -1
View File
@@ -19,6 +19,8 @@ BEGIN
use lib "$::XCATROOT/lib/perl";
use warnings "all";
use xCAT::Table;
require xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
my $output_handler;
my $newiqns;
@@ -57,7 +59,7 @@ sub process_request {
my @nodes = @{$request->{node}};
#my $sitetab = xCAT::Table->new('site');
#(my $dent) = $sitetab->getAttribs({key=>'domain'},'value');
my @entries = xCAT::Utils->get_site_attribute("domain");
my @entries = xCAT::TableUtils->get_site_attribute("domain");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
$domain = $t_entry;
+5 -3
View File
@@ -13,7 +13,9 @@ use Cwd;
use File::Temp;
use File::Basename;
use File::Path;
use xCAT::Utils qw(genpassword);
#use xCAT::Utils qw(genpassword);
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
@@ -32,7 +34,7 @@ sub process_request {
my $request = shift;
my $callback = shift;
my $doreq = shift;
my $installroot = xCAT::Utils->getInstallDir();
my $installroot = xCAT::TableUtils->getInstallDir();
@ARGV = @{$request->{arg}};
my $argc = scalar @ARGV;
@@ -423,7 +425,7 @@ sub copybootscript {
my $arch = shift;
my $profile = shift;
my $callback = shift;
my @timezone = xCAT::Utils->get_site_attribute("timezone");
my @timezone = xCAT::TableUtils->get_site_attribute("timezone");
if ( -f "$installroot/postscripts/xcatdsklspost") {
+6 -4
View File
@@ -8,6 +8,8 @@ use lib "$::XCATROOT/lib/perl";
use strict;
require xCAT::Table;
require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::ServiceNodeUtils;
require xCAT::MsgUtils;
use Getopt::Long;
use Sys::Hostname;
@@ -62,12 +64,12 @@ sub preprocess_request
Getopt::Long::Configure("bundling");
Getopt::Long::Configure("pass_through");
GetOptions('l' => \$::LOCAL);
my $sn = xCAT::Utils->getSNformattedhash($nodes, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->getSNformattedhash($nodes, $service, "MN");
my @requests;
if ($::LOCAL) { #only handle the local nodes
#print "process local nodes: @$nodes\n";
#get its own children only
my @hostinfo=xCAT::Utils->determinehostname();
my @hostinfo=xCAT::NetworkUtils->determinehostname();
my %iphash=();
foreach(@hostinfo) {$iphash{$_}=1;}
@@ -155,7 +157,7 @@ sub runbeginpre
my $args = $request->{arg};
my $action=$args->[0];
my $localhostname=hostname();
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
my %script_hash=getprescripts($nodes, $action, "begin");
foreach my $scripts (keys %script_hash) {
@@ -219,7 +221,7 @@ sub runendpre
my $args= $request->{arg};
my $action=$args->[0];
my $localhostname=hostname();
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
my %script_hash=getprescripts($nodes, $action, "end");
foreach my $scripts (keys %script_hash) {
+9 -8
View File
@@ -8,12 +8,13 @@ use Socket;
use File::Copy;
use File::Path;
use Getopt::Long;
require xCAT::Utils;
require xCAT::TableUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
my $globaltftpdir = xCAT::Utils->getTftpDir();
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
my %usage = (
@@ -135,9 +136,9 @@ sub setstate {
}
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::Utils->my_ip_facing($node);
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my @myself = xCAT::Utils->determinehostname();
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
{
@@ -316,7 +317,7 @@ sub preprocess_request {
}
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');
my @entries = xCAT::Utils->get_site_attribute("sharedtftp");
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
$req->{'_disparatetftp'}=[1];
@@ -337,7 +338,7 @@ sub preprocess_request {
# $sitetab->close;
# if ($ent and $ent->{value}) {
# foreach (split /,/,$ent->{value}) {
# if (xCAT::Utils->thishostisnot($_)) {
# if (xCAT::NetworkUtils->thishostisnot($_)) {
# my $reqcopy = {%$req};
# $reqcopy->{'_xcatdest'} = $_;
# push @requests,$reqcopy;
@@ -404,7 +405,7 @@ sub process_request {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::Utils->nodeonmynet($_)) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: pxe netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
@@ -520,7 +521,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'dhcpsetup'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("dhcpsetup");
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
+3 -2
View File
@@ -11,6 +11,7 @@ use lib "$::XCATROOT/lib/perl";
use Getopt::Long;
use File::Path;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::DBobjUtils;
Getopt::Long::Configure("bundling");
@@ -26,8 +27,8 @@ sub process_request {
my $request = shift;
my $callback = shift;
my $doreq = shift;
my $installroot = xCAT::Utils->getInstallDir();
my $tftproot = xCAT::Utils->getTftpDir();
my $installroot = xCAT::TableUtils->getInstallDir();
my $tftproot = xCAT::TableUtils->getTftpDir();
my $usage = "\nUsage:\n rmimage [-h | --help]\n rmimage [-V | --verbose] -o <OS> -a <architecture> -p <profile>\n rmimage [-V | --verbose] imagename [--xcatde]";
+17 -15
View File
@@ -16,6 +16,8 @@ BEGIN
require xCAT::NodeRange;
require xCAT::NameRange;
require xCAT::Table;
require xCAT::Utils;
require xCAT::TableUtils;
require Data::Dumper;
require Getopt::Long;
require xCAT::MsgUtils;
@@ -114,7 +116,7 @@ sub preprocess_request {
return [$req];
}
$req->{_xcatdest} = xCAT::Utils->get_site_Master();
$req->{_xcatdest} = xCAT::TableUtils->get_site_Master();
return [$req];
}
@@ -279,7 +281,7 @@ sub processArgs {
# opt_t not yet supported
if ( defined($::opt_t) ) {
$::test = 1;
#$::test = 1;
$::TEST = 1;
# my $rsp;
# push @{ $rsp->{data} }, "The \'-t\' option is not yet implemented.";
@@ -1098,7 +1100,7 @@ my @rcblines;
# for the status may run before we've had a chance to actually update it
my $nltab = xCAT::Table->new('nodelist');
my @nodes = split( /\,/, $nodelist );
xCAT::Utils->setAppStatus(\@nodes,"RollingUpdate","update_job_submitted");
xCAT::TableUtils->setAppStatus(\@nodes,"RollingUpdate","update_job_submitted");
# Submit LL reservation
my $downnodes = "-D";
if ($::updateall){$downnodes = " ";}
@@ -1201,7 +1203,7 @@ my @rcblines;
}
my $nltab = xCAT::Table->new('nodelist');
my @nodes = split( /\,/, $nodelist );
xCAT::Utils->setAppStatus(\@nodes,"RollingUpdate","update_job_submitted");
xCAT::TableUtils->setAppStatus(\@nodes,"RollingUpdate","update_job_submitted");
my $childpid = runrollupdate( { command => ['runrollupdate'],
arg => [ 'internal','loadleveler', $ugdf ]
});
@@ -2026,7 +2028,7 @@ sub runrollupdate {
my $nltab = xCAT::Table->new('nodelist');
my @nodes = split( /\,/, $hostlist );
my $appstatus=xCAT::Utils->getAppStatus(\@nodes,"RollingUpdate");
my $appstatus=xCAT::TableUtils->getAppStatus(\@nodes,"RollingUpdate");
foreach my $node (@nodes) {
unless ( defined($appstatus->{$node})
&& ( $appstatus->{$node} eq "update_job_submitted" ) )
@@ -2052,7 +2054,7 @@ sub runrollupdate {
}
# Run prescripts for this update group
xCAT::Utils->setAppStatus(\@nodes,"RollingUpdate","running_prescripts");
xCAT::TableUtils->setAppStatus(\@nodes,"RollingUpdate","running_prescripts");
foreach my $psline ( @{ $::DATAATTRS{'prescript'} } ) {
$psline =~ s/\$NODELIST/$hostlist/g;
# Run the command
@@ -2082,7 +2084,7 @@ sub runrollupdate {
# Shutdown the nodes
if ( ! $skipshutdown ) {
xCAT::Utils->setAppStatus(\@nodes,"RollingUpdate","shutting_down");
xCAT::TableUtils->setAppStatus(\@nodes,"RollingUpdate","shutting_down");
my $shutdown_cmd;
if (xCAT::Utils->isAIX()) { $shutdown_cmd = "shutdown -F &"; }
else { $shutdown_cmd = "shutdown -h now &"; }
@@ -2141,7 +2143,7 @@ sub runrollupdate {
print RULOG localtime()." $::ug_name: Running command \'$pwroff_cmd\' \n";
close (RULOG);
}
xCAT::Utils->setAppStatus([$pnode],"RollingUpdate","shutdowntimeout_exceeded__forcing_rpower_off");
xCAT::TableUtils->setAppStatus([$pnode],"RollingUpdate","shutdowntimeout_exceeded__forcing_rpower_off");
xCAT::Utils->runxcmd( $pwroff_cmd, $::SUBREQ, -1 );
} else {
last;
@@ -2158,7 +2160,7 @@ sub runrollupdate {
} # end not TEST
# Run out-of-band commands for this update group
xCAT::Utils->setAppStatus(\@nodes,"RollingUpdate","running_outofbandcmds");
xCAT::TableUtils->setAppStatus(\@nodes,"RollingUpdate","running_outofbandcmds");
foreach my $obline ( @{ $::DATAATTRS{'outofbandcmd'} } ) {
$obline =~ s/\$NODELIST/$hostlist/g;
# Run the command
@@ -2237,9 +2239,9 @@ sub runrollupdate {
}
}
xCAT::Utils->setAppStatus(\@bootnodes,"RollingUpdate","rebooting");
xCAT::TableUtils->setAppStatus(\@bootnodes,"RollingUpdate","rebooting");
if ($bootindex < $numboots) {
xCAT::Utils->setAppStatus(\@remaining_nodes,"RollingUpdate","waiting_on_bringuporder");
xCAT::TableUtils->setAppStatus(\@remaining_nodes,"RollingUpdate","waiting_on_bringuporder");
}
if ( scalar(@rnetboot_nodes) > 0 ) {
my $rnb_nodelist = join( ',', @rnetboot_nodes );
@@ -2327,7 +2329,7 @@ sub runrollupdate {
}
if (@remove_res_LL) {
&remove_LL_reservations(\@remove_res_LL);
xCAT::Utils->setAppStatus(\@remove_res_xCAT,"RollingUpdate","update_complete");
xCAT::TableUtils->setAppStatus(\@remove_res_xCAT,"RollingUpdate","update_complete");
}
}
if ($not_done) {
@@ -2363,7 +2365,7 @@ sub runrollupdate {
print RULOG localtime()." ERROR: bringuptimeout exceeded for the following nodes: \n";
print RULOG join(",",@error_nodes);
print RULOG "\n";
xCAT::Utils->setAppStatus(\@error_nodes,"RollingUpdate","ERROR_bringuptimeout_exceeded");
xCAT::TableUtils->setAppStatus(\@error_nodes,"RollingUpdate","ERROR_bringuptimeout_exceeded");
if ( @remaining_nodes ) {
my @leftover_nodes;
foreach my $rn (@remaining_nodes) {
@@ -2375,7 +2377,7 @@ sub runrollupdate {
print RULOG localtime()." ERROR: bringuptimeout exceeded for some nodes in a preceding bringuporder. The following nodes will not be powered on: \n";
print RULOG join(",",@leftover_nodes);
print RULOG "\n";
xCAT::Utils->setAppStatus(\@leftover_nodes,"RollingUpdate","ERROR_bringuptimeout_exceeded_for_previous_node");
xCAT::TableUtils->setAppStatus(\@leftover_nodes,"RollingUpdate","ERROR_bringuptimeout_exceeded_for_previous_node");
}
}
close (RULOG);
@@ -2902,7 +2904,7 @@ sub llreconfig {
my ($sm,$rest) = split(/\./,$m);
my $xlated_sm = $sm;
if ( defined ($::XLATED{$sm}) ) { $xlated_sm = $::XLATED{$sm}; }
if (xCAT::Utils->thishostisnot($m)) {
if (xCAT::NetworkUtils->thishostisnot($m)) {
push(@llnodes, $xlated_sm) unless $have{$sm}++;
} else {
$runlocal=1;
+7 -5
View File
@@ -20,6 +20,8 @@ use lib "$::XCATROOT/lib/perl";
use strict;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use Getopt::Long;
@@ -182,7 +184,7 @@ sub preprocess_request
$callback->($rsp);
return 1;
}
my @servicenodes=xCAT::Utils->getSNList();
my @servicenodes=xCAT::ServiceNodeUtils->getSNList();
#print "noderange=@noderange, missednodes=@missednodes, servicenodes=@servicenodes\n";
@@ -206,7 +208,7 @@ sub preprocess_request
#now find out the service nodes for each node and
#send the request to the service node
my $sn_hash = xCAT::Utils->get_ServiceNode(\@noderange, "xcat", "MN");
my $sn_hash = xCAT::ServiceNodeUtils->get_ServiceNode(\@noderange, "xcat", "MN");
# build each request for each service node
foreach my $sn (keys %$sn_hash)
@@ -354,7 +356,7 @@ sub process_makeroutes {
}
}
else { #this is mn, get the routes from the site table
my @mnroutes = xCAT::Utils->get_site_attribute("mnroutenames");
my @mnroutes = xCAT::TableUtils->get_site_attribute("mnroutenames");
if ($mnroutes[0]) {
my @a=split(',', $mnroutes[0]);
my @badroutes=();
@@ -389,7 +391,7 @@ sub process_makeroutes {
#now let's handle the route creatation and deletion
my @sns=();
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
while (my ($routename, $route_hash) = each(%all_routes)) {
if ($route_hash->{process}) {
my ($gw_name, $gw_ip)=xCAT::NetworkUtils->gethostnameandip($route_hash->{gateway});
@@ -425,7 +427,7 @@ sub process_makeroutes {
#not all gateways are service nodes
my %sn_hash=();
my @allSN=xCAT::Utils->getAllSN();
my @allSN=xCAT::ServiceNodeUtils->getAllSN();
my %allSN_hash=();
foreach(@allSN) {$allSN_hash{$_}=1;}
foreach my $sn (@sns) {
+3 -2
View File
@@ -15,7 +15,8 @@ package xCAT_plugin::sinv;
use strict;
require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::ServiceNodeUtils;
require xCAT::MsgUtils;
require xCAT::SINV;
use Getopt::Long;
@@ -86,7 +87,7 @@ sub handled_commands
# if ($nodes) {
# # find service nodes for requested nodes
# # build an individual request for each service node
# $sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
# $sn = xCAT::ServiceNodeUtils->get_ServiceNode($nodes, $service, "MN");
#
# # build each request for each service node
#
+8 -7
View File
@@ -10,6 +10,7 @@ use Sys::Syslog;
use File::Temp qw/tempdir/;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::SvrUtils;
use xCAT::MsgUtils;
@@ -67,13 +68,13 @@ sub mknetboot
#if ($sitetab)
#{
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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;
}
#($ref) = $sitetab->getAttribs({key => 'xcatdport'}, 'value');
@entries = xCAT::Utils->get_site_attribute("xcatdport");
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
$t_entry = $entries[0];
if ( defined($t_entry) ) {
$xcatdport = $t_entry;
@@ -594,7 +595,7 @@ sub mkinstall
my $request = shift;
my $callback = shift;
my $doreq = shift;
my $globaltftpdir = xCAT::Utils->getTftpDir();
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my @nodes = @{$request->{node}};
my $node;
@@ -624,7 +625,7 @@ sub mkinstall
#if ($sitetab)
#{
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
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;
@@ -1017,7 +1018,7 @@ sub mkinstall
);
}
}
#my $rc = xCAT::Utils->create_postscripts_tar();
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ($rc != 0)
#{
# xCAT::MsgUtils->message("S", "Error creating postscripts tar file.");
@@ -1044,7 +1045,7 @@ sub copycd
#{
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
#print Dumper($ref);
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;
@@ -1381,7 +1382,7 @@ sub insert_dd () {
my $driverupdatesrc = shift;
my $drivers = shift;
my $install_dir = xCAT::Utils->getInstallDir();
my $install_dir = xCAT::TableUtils->getInstallDir();
my $cmd;
+5 -3
View File
@@ -20,6 +20,8 @@ use File::Basename;
use File::Path;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use xCAT::SvrUtils;
@@ -200,7 +202,7 @@ sub process_request
{
# get all the nodes that use SN1 as the primary service nodes
my $pn_hash = xCAT::Utils->getSNandNodes();
my $pn_hash = xCAT::ServiceNodeUtils->getSNandNodes();
foreach my $snlist (keys %$pn_hash)
{
if (($snlist =~ /^$::SN1$/) || ($snlist =~ /^$::SN1\,/))
@@ -464,7 +466,7 @@ sub process_request
if ($sn1n)
{
my @ret = xCAT::Utils::toIP($sn1n);
my @ret = xCAT::NetworkUtils::toIP($sn1n);
if ($ret[0]->[0] == 0)
{
$sn1n_ip = $ret[0]->[1];
@@ -558,7 +560,7 @@ sub process_request
} # end - foreach node
# check the sharedinstall attr
my $sharedinstall=xCAT::Utils->get_site_attribute('sharedinstall');
my $sharedinstall=xCAT::TableUtils->get_site_attribute('sharedinstall');
chomp $sharedinstall;
if (!$sharedinstall) {
$sharedinstall="no";
+2 -1
View File
@@ -13,6 +13,7 @@ use File::Find;
use Cwd;
use File::Temp;
use xCAT::Utils qw(genpassword);
use xCAT::TableUtils qw(get_site_attribute);
use xCAT::SvrUtils;
use Data::Dumper;
Getopt::Long::Configure("bundling");
@@ -36,7 +37,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#my $ent = $sitetab->getAttribs({key=>'installdir'},['value']);
my @entries = xCAT::Utils->get_site_attribute("installdir");
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
my $t_entry = $entries[0];
my $installroot = "/install";
+3 -1
View File
@@ -15,6 +15,8 @@ use Sys::Syslog;
use xCAT::Usage;
use Storable;
use xCAT::MellanoxIB;
require xCAT::TableUtils;
require xCAT::ServiceNodeUtils;
my $macmap;
sub handled_commands {
@@ -84,7 +86,7 @@ sub preprocess_request {
# find service nodes for requested switch
# 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
foreach my $snkey (keys %$sn)
+2 -1
View File
@@ -14,6 +14,7 @@ use Data::Dumper;
use xCAT::NodeRange qw/noderange abbreviate_noderange/;
use xCAT::Schema;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::MsgUtils;
use xCAT::DBobjUtils;
use Getopt::Long;
@@ -300,7 +301,7 @@ sub noderm
if (!$nodes) { $noderm_usage->(1); return; }
#my $sitetab = xCAT::Table->new('site');
#my $pdhcp = $sitetab->getAttribs({key=>'pruneservices'},['value']);
my @entries = xCAT::Utils->get_site_attribute("pruneservices");
my @entries = xCAT::TableUtils->get_site_attribute("pruneservices");
my $t_entry = $entries[0];
if ( defined($t_entry) and $t_entry !~ /n(\z|o)/i) {
$requestcommand->({command=>['makedhcp'],node=>$nodes,arg=>['-d']});
+6 -5
View File
@@ -30,6 +30,7 @@ use Thread qw(yield);
use POSIX qw(WNOHANG nice);
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::MsgUtils;
use xCAT::SvrUtils;
#use Data::Dumper;
@@ -64,7 +65,7 @@ sub preprocess_request
#my $stab = xCAT::Table->new('site');
#my $sent;
#($sent) = $stab->getAttribs({key => 'sharedtftp'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("sharedtftp");
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
unless ( defined($t_entry)
and ($t_entry =~ /no/i or $t_entry =~ /0/))
@@ -140,15 +141,15 @@ sub mknetboot
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $installroot = xCAT::Utils->getInstallDir();
my $tftpdir = xCAT::Utils->getTftpDir();
my $installroot = xCAT::TableUtils->getInstallDir();
my $tftpdir = xCAT::TableUtils->getTftpDir();
my $xcatiport;
#if ($sitetab)
#{
#(my $ref) = $sitetab->getAttribs({key => 'xcatiport'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("xcatiport");
my @entries = xCAT::TableUtils->get_site_attribute("xcatiport");
my $t_entry = $entries[0];
if ( defined($t_entry) )
{
@@ -408,7 +409,7 @@ ENDOFAWK
);
}
#my $rc = xCAT::Utils->create_postscripts_tar();
#my $rc = xCAT::TableUtils->create_postscripts_tar();
#if ( $rc != 0 ) {
# xCAT::MsgUtils->message( "S", "Error creating postscripts tar file." );
#}
+12 -10
View File
@@ -15,6 +15,8 @@ use Data::Dumper;
use xCAT::Utils;
use xCAT::SvrUtils;
use xCAT::Usage;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::InstUtils;
use Getopt::Long;
@@ -170,7 +172,7 @@ sub preprocess_updatenode
my $args = $request->{arg};
my @requests = ();
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
# subroutine to display the usage
sub updatenode_usage
@@ -452,7 +454,7 @@ sub preprocess_updatenode
}
my $sn = xCAT::Utils->get_ServiceNode(\@nodes, "xcat", "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodes, "xcat", "MN");
if ($::ERROR_RC)
{
my $rsp;
@@ -466,7 +468,7 @@ sub preprocess_updatenode
# for security update, we need to handle the service node first
my @good_sns = ();
my @MNip = xCAT::Utils->determinehostname;
my @MNip = xCAT::NetworkUtils->determinehostname;
my @sns = ();
foreach my $s (keys %$sn) {
my @tmp_a=split(',',$s);
@@ -701,7 +703,7 @@ sub updatenode
# Lookup Install dir location at this Mangment Node.
# XXX: Suppose that compute nodes has the same Install dir location.
my $installdir = xCAT::Utils->getInstallDir();
my $installdir = xCAT::TableUtils->getInstallDir();
#if the postscripts directory exists then make sure it is
# world readable and executable by root
@@ -1402,7 +1404,7 @@ sub doAIXcopy
#
# get a list of service nodes for this node list
my $sn = xCAT::Utils->get_ServiceNode(\@nodelist, "xcat", "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode(\@nodelist, "xcat", "MN");
if ($::ERROR_RC)
{
my $rsp;
@@ -2032,7 +2034,7 @@ sub updateAIXsoftware
# make sure pkg dir is exported
if (scalar(@pkglist)) {
my $ecmd;
my @nfsv4 = xCAT::Utils->get_site_attribute("useNFSv4onAIX");
my @nfsv4 = xCAT::TableUtils->get_site_attribute("useNFSv4onAIX");
if ($nfsv4[0] && ($nfsv4[0] =~ /1|Yes|yes|YES|Y|y/))
{
$ecmd = qq~exportfs -i -o vers=4 $pkgdir~;
@@ -2089,7 +2091,7 @@ sub updateAIXsoftware
# mount source dir to node
my $mcmd;
my @nfsv4 = xCAT::Utils->get_site_attribute("useNFSv4onAIX");
my @nfsv4 = xCAT::TableUtils->get_site_attribute("useNFSv4onAIX");
if ($nfsv4[0] && ($nfsv4[0] =~ /1|Yes|yes|YES|Y|y/))
{
$mcmd = qq~mkdir -m 644 -p /xcatmnt; mount -o vers=4 $serv:$pkgdir /xcatmnt~;
@@ -2520,10 +2522,10 @@ sub updateOS {
my $rsp;
# Get install directory
my $installDIR = xCAT::Utils->getInstallDir();
my $installDIR = xCAT::TableUtils->getInstallDir();
# Get HTTP server
my $http = xCAT::Utils->my_ip_facing($node);
my $http = xCAT::NetworkUtils->my_ip_facing($node);
if ( !$http ) {
push @{$rsp->{data}}, "$node: (Error) Missing HTTP server";
xCAT::MsgUtils->message("I", $rsp, $callback);
@@ -2713,7 +2715,7 @@ sub updatenodeappstat
my $appstat = $args[0];
my ($apps, $newstatus) = split(/=/,$appstat);
xCAT::Utils->setAppStatus(\@nodes, $apps, $newstatus);
xCAT::TableUtils->setAppStatus(\@nodes, $apps, $newstatus);
}
+3 -2
View File
@@ -16,7 +16,8 @@ require Sys::Hostname;
require xCAT::Table;
require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::ServiceNodeUtils;
require xCAT::MsgUtils;
use Getopt::Long;
1;
@@ -61,7 +62,7 @@ sub preprocess_request
# find service nodes for requested nodes
# build an individual request for each service node
my $sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
my $sn = xCAT::ServiceNodeUtils->get_ServiceNode($nodes, $service, "MN");
my @requests = ();
+6 -5
View File
@@ -7,6 +7,7 @@ use File::Copy;
use Getopt::Long;
use xCAT::MsgUtils;
use xCAT::TableUtils qw(get_site_attribute);
my $addkcmdlinehandled;
my $request;
my $callback;
@@ -76,9 +77,9 @@ sub setstate {
$kern->{kcmdline} .= " ".$kern->{addkcmdline};
}
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::Utils->my_ip_facing($node);
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my @myself = xCAT::Utils->determinehostname();
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
{
@@ -254,7 +255,7 @@ sub preprocess_request {
}
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');
my @entries = xCAT::Utils->get_site_attribute("sharedtftp");
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
$req->{'_disparatetftp'}=[1];
@@ -292,7 +293,7 @@ sub process_request {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::Utils->nodeonmynet($_)) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: vsmppxe netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
@@ -414,7 +415,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'dhcpsetup'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("dhcpsetup");
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if (defined($t_entry)) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
+7 -6
View File
@@ -10,6 +10,7 @@ use Sys::Syslog;
use File::Temp qw/tempdir/;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::SvrUtils;
use Socket;
use xCAT::MsgUtils;
@@ -41,7 +42,7 @@ sub process_request
my $arch = undef;
my $path = undef;
my $installroot;
$installroot = xCAT::Utils->getInstallDir();
$installroot = xCAT::TableUtils->getInstallDir();
if ($request->{command}->[0] eq 'copycd')
{
return copycd($request, $callback, $doreq);
@@ -65,7 +66,7 @@ sub mkimage {
#-If going to /audit, it's more useful than /oobe.
# audit complains about incorrect password on first boot, without any login attempt
# audit causes a 'system preparation tool' dialog on first boot that I close
my $installroot = xCAT::Utils->getInstallDir();
my $installroot = xCAT::TableUtils->getInstallDir();
my $request = shift;
my $callback = shift;
my $doreq = shift;
@@ -125,7 +126,7 @@ sub mkimage {
}
sub mkwinlinks {
my $installroot = xCAT::Utils->getInstallDir(); # for now put this, as it breaks for imagex
my $installroot = xCAT::TableUtils->getInstallDir(); # for now put this, as it breaks for imagex
my $node = shift;
my $ent = shift;
my $uuid = shift;
@@ -142,7 +143,7 @@ sub mkwinlinks {
}
sub winshell {
my $installroot = xCAT::Utils->getInstallDir();
my $installroot = xCAT::TableUtils->getInstallDir();
my $request = shift;
my $script = "cmd";
my @nodes = @{$request->{node}};
@@ -208,7 +209,7 @@ ENDAPPLY
sub mkinstall
{
my $installroot;
$installroot = xCAT::Utils->getInstallDir();
$installroot = xCAT::TableUtils->getInstallDir();
my $request = shift;
my $callback = shift;
my $doreq = shift;
@@ -476,7 +477,7 @@ sub copycd
#if ($sitetab)
#{
#(my $ref) = $sitetab->getAttribs({key => installdir}, value);
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) )
{
+3 -2
View File
@@ -15,7 +15,8 @@ use Sys::Hostname;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::MsgUtils;
use Getopt::Long;
1;
@@ -57,7 +58,7 @@ sub preprocess_request
# find service nodes for requested nodes
# build an individual request for each service node
if ($nodes) {
$sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
$sn = xCAT::ServiceNodeUtils->get_ServiceNode($nodes, $service, "MN");
# build each request for each service node
+4 -2
View File
@@ -16,6 +16,8 @@ use Sys::Hostname;
use xCAT::NodeRange;
use xCAT::Schema;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use xCAT::DBobjUtils;
use Data::Dumper;
@@ -107,7 +109,7 @@ sub preprocess_request
# - for the nodes that were provided
# - to handle node and group objects
my $sn;
$sn = xCAT::Utils->getSNformattedhash($mynodes, $service, "MN", $type);
$sn = xCAT::ServiceNodeUtils->getSNformattedhash($mynodes, $service, "MN", $type);
foreach my $snkey (keys %$sn) {
my $reqcopy = {%$req};
$reqcopy->{node} = $sn->{$snkey};
@@ -303,7 +305,7 @@ if(0) { # only do networks on the management node (NIM primary) for now
@servicenodes=split(',', $::SERVERS);
} else {
# do MN and all servers
@servicenodes=xCAT::Utils->getAllSN();
@servicenodes=xCAT::ServiceNodeUtils->getAllSN();
push(@servicenodes, $nimprime);
}
}
+5 -4
View File
@@ -20,7 +20,8 @@ use POSIX;
require xCAT::Table;
require xCAT::Utils;
require xCAT::TableUtils;
require xCAT::ServiceNodeUtils;
require xCAT::MsgUtils;
use Getopt::Long;
require xCAT::DSHCLI;
@@ -110,12 +111,12 @@ sub preprocess_request
# find service nodes for requested nodes
# build an individual request for each service node
# find out the names for the Management Node
my @MNnodeinfo = xCAT::Utils->determinehostname;
my @MNnodeinfo = xCAT::NetworkUtils->determinehostname;
my $MNnodename = pop @MNnodeinfo; # hostname
my @MNnodeipaddr = @MNnodeinfo; # ipaddresses
$::mnname = $MNnodeipaddr[0];
$::SNpath; # syncfile path on the service node
$sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
$sn = xCAT::ServiceNodeUtils->get_ServiceNode($nodes, $service, "MN");
my @snodes;
my @snoderange;
@@ -151,7 +152,7 @@ sub preprocess_request
{
# get the directory on the servicenode to put the files in
my @syndir = xCAT::Utils->get_site_attribute("SNsyncfiledir");
my @syndir = xCAT::TableUtils->get_site_attribute("SNsyncfiledir");
if ($syndir[0])
{
$synfiledir = $syndir[0];
+5 -3
View File
@@ -35,6 +35,8 @@ use Time::HiRes qw(gettimeofday sleep usleep);
use xCAT::DBobjUtils;
use Getopt::Long;
use xCAT::SvrUtils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
my %runningstates;
my $vmmaxp=64;
@@ -630,7 +632,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
@@ -768,7 +770,7 @@ sub process_request {
#my $tmp;
#if ($sitetab) {
#($tmp)=$sitetab->getAttribs({'key'=>'vmmaxp'},'value');
my @entries = xCAT::Utils->get_site_attribute("vmmaxp");
my @entries = xCAT::TableUtils->get_site_attribute("vmmaxp");
my $t_entry = $entries[0];
if (defined($t_entry)) { $vmmaxp=$t_entry; }
#}
@@ -819,7 +821,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'nodestatus'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("nodestatus");
my @entries = xCAT::TableUtils->get_site_attribute("nodestatus");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $global_check=0; }
+8 -6
View File
@@ -8,13 +8,15 @@ use File::Path;
use xCAT::Scope;
use xCAT::MsgUtils;
use Getopt::Long;
use xCAT::Utils;
use xCAT::TableUtils;
my $addkcmdlinehandled;
my $request;
my $callback;
my $dhcpconf = "/etc/dhcpd.conf";
#my $tftpdir = "/tftpboot";
my $globaltftpdir = xCAT::Utils->getTftpDir();
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
my %usage = (
@@ -152,7 +154,7 @@ sub setstate {
my $ipfn = '${next-server}';#xCAT::Utils->my_ip_facing($node);
$kern->{kcmdline} =~ s/!myipfn!/$ipfn/g;
$elilokcmdline =~ s/!myipfn!/%N/g;
$ipfn = xCAT::Utils->my_ip_facing($node);
$ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) { $ipfn = $::XCATSITEVALS{master}; }
if ($ipfn) {
$pxelinuxkcmdline =~ s/!myipfn!/$ipfn/g;
@@ -342,7 +344,7 @@ sub preprocess_request {
#they specify no sharedtftp in site table
#my $stab = xCAT::Table->new('site');
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');i
my @entries = xCAT::Utils->get_site_attribute("sharedtftp");
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
$req->{'_disparatetftp'}=[1];
@@ -363,7 +365,7 @@ sub preprocess_request {
# $sitetab->close;
# if ($ent and $ent->{value}) {
# foreach (split /,/,$ent->{value}) {
# if (xCAT::Utils->thishostisnot($_)) {
# if (xCAT::NetworkUtils->thishostisnot($_)) {
# my $reqcopy = {%$req};
# $reqcopy->{'_xcatdest'} = $_;
# $reqcopy->{_xcatpreprocessed}->[0] = 1;
@@ -431,7 +433,7 @@ sub process_request {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::Utils->nodeonmynet($_)) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: xnba netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
@@ -554,7 +556,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'dhcpsetup'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("dhcpsetup");
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if ( defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
+8 -6
View File
@@ -3,6 +3,8 @@ package xCAT_plugin::yaboot;
use Data::Dumper;
use Sys::Syslog;
use xCAT::Scope;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::NetworkUtils;
use xCAT::MsgUtils;
use File::Path;
@@ -15,7 +17,7 @@ my %normalnodes;
my $callback;
my $sub_req;
my $dhcpconf = "/etc/dhcpd.conf";
my $globaltftpdir = xCAT::Utils->getTftpDir();
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
#my $dhcpver = 3;
my %usage = (
@@ -89,7 +91,7 @@ sub setstate {
my %nrhash = %{shift()};
my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']);
if ($kern->{kcmdline} =~ /!myipfn!/) {
my $ipfn = xCAT::Utils->my_ip_facing($node);
my $ipfn = xCAT::NetworkUtils->my_ip_facing($node);
unless ($ipfn) {
my $servicenodes = $nrhash{$node}->[0];
if ($servicenodes and $servicenodes->{servicenode}) {
@@ -97,7 +99,7 @@ sub setstate {
foreach my $sn ( @sns ) {
# We are in the service node pools, print error if no facing ip.
if (xCAT::InstUtils->is_me($sn)) {
my @myself = xCAT::Utils->determinehostname();
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[(scalar @myself)-1];
$callback->(
{
@@ -355,7 +357,7 @@ sub preprocess_request {
#my $stab = xCAT::Table->new('site');
#my $sent = $stab->getAttribs({key=>'sharedtftp'},'value');
my @entries = xCAT::Utils->get_site_attribute("sharedtftp");
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
$req->{'_disparatetftp'}=[1];
@@ -429,7 +431,7 @@ sub process_request {
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
@nodes = ();
foreach (@rnodes) {
if (xCAT::Utils->nodeonmynet($_)) {
if (xCAT::NetworkUtils->nodeonmynet($_)) {
push @nodes,$_;
} else {
xCAT::MsgUtils->message("S", "$_: yaboot netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster.");
@@ -531,7 +533,7 @@ sub process_request {
#my $sitetab = xCAT::Table->new('site');
#if ($sitetab) {
#(my $ref) = $sitetab->getAttribs({key => 'dhcpsetup'}, 'value');
my @entries = xCAT::Utils->get_site_attribute("dhcpsetup");
my @entries = xCAT::TableUtils->get_site_attribute("dhcpsetup");
my $t_entry = $entries[0];
if (defined($t_entry) ) {
if ($t_entry =~ /0|n|N/) { $do_dhcpsetup=0; }
+8 -6
View File
@@ -16,6 +16,8 @@ use xCAT::MsgUtils;
use Sys::Hostname;
use xCAT::Table;
use xCAT::Utils;
use xCAT::TableUtils;
use xCAT::ServiceNodeUtils;
use xCAT::NetworkUtils;
use Getopt::Long;
use strict;
@@ -80,7 +82,7 @@ sub preprocess_request {
# Find service nodes for requested nodes
# Build an individual request for each service node
if ($nodes) {
$sn = xCAT::Utils->get_ServiceNode( $nodes, $service, "MN" );
$sn = xCAT::ServiceNodeUtils->get_ServiceNode( $nodes, $service, "MN" );
# Build each request for each service node
foreach my $snkey ( keys %$sn ) {
@@ -3222,13 +3224,13 @@ sub nodeSet {
$userId =~ tr/a-z/A-Z/;
# Get install directory and domain from site table
my @entries = xCAT::Utils->get_site_attribute("installdir");
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
my $installDir = $entries[0];
@entries = xCAT::Utils->get_site_attribute("domain");
@entries = xCAT::TableUtils->get_site_attribute("domain");
my $domain = $entries[0];
@entries = xCAT::Utils->get_site_attribute("master");
@entries = xCAT::TableUtils->get_site_attribute("master");
my $master = $entries[0];
@entries = xCAT::Utils->get_site_attribute("xcatdport");
@entries = xCAT::TableUtils->get_site_attribute("xcatdport");
my $xcatdPort = $entries[0];
# Get node OS, arch, and profile from 'nodetype' table
@@ -4310,7 +4312,7 @@ sub updateNode {
$userId =~ tr/a-z/A-Z/;
# Get install directory
my @entries = xCAT::Utils->get_site_attribute("installdir");
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
my $installDir = $entries[0];
# Get host IP and hostname from /etc/hosts