2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-11-01 11:52:31 +00:00

deal with conflicts between master and 2.13

This commit is contained in:
Zhao Er Tao
2018-03-13 07:25:05 -04:00
9 changed files with 62 additions and 15 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@@ -30,4 +30,11 @@ The following commands are currently supported:
Data
----
TBD
The following graph shows performance gains in the Python code implementation of ``mgt=openbmc`` when compared to the Perl implementation.
rpower <noderange> state
````````````````````````
This chart gathers data points on a single 18-node frame, up to 4 frames (72-nodes).
.. image:: images/rpower_state.png

View File

@@ -116,7 +116,7 @@ if (@ARGV > 0) {
}
if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
my $tmpimgs = `lsdef -t osimage -w provmethod=~'/statelite|netboot/' |cut -d' ' -f1`;
my $tmpimgs = `XCATXMLTRACE=0 XCATBYPASS=0 lsdef -t osimage -w provmethod=~'/statelite|netboot/' |cut -d' ' -f1`;
if ($? == 0) {
if (($tmpimgs) && ($tmpimgs !~ /^Could/)) { #Could is returned when the osimage table is empty
my @images = split('\n', $tmpimgs);
@@ -162,8 +162,7 @@ if ((!$imagename) && (!$profile) && (!$os) && (!$arch)) {
# get the install directory
my @entries = xCAT::TableUtils->get_site_attribute("installdir");
my $installdir = $entries[0];
my $installdir = `XCATXMLTRACE=0 XCATBYPASS=0 lsdef -t site -o clustersite -i installdir|grep -w 'installdir'|cut -d= -f2`;
chomp($installdir);
# lots of error checking to make sure it exists.

View File

@@ -26,6 +26,11 @@ class AgentShell(object):
"with the client",
default='/var/run/xcat/agent.sock',
type=str)
parser.add_argument('--lockfile',
help="The lock file to communicate "
"with the xcat",
default='/var/lock/xcat/agent.lock',
type=str)
return parser
def do_help(self, args):
@@ -38,7 +43,8 @@ class AgentShell(object):
if options.help:
self.do_help(options)
return 0
s = server.Server(options.sock, options.standalone)
s = server.Server(options.sock, options.standalone, options.lockfile)
s.start()
class HelpFormatter(argparse.HelpFormatter):

View File

@@ -14,7 +14,7 @@ from xcatagent import base as xcat_manager
MSG_TYPE = 'message'
DB_TYPE = 'db'
LOCK_FILE = '/var/lock/xcat/agent.lock'
#LOCK_FILE = '/var/lock/xcat/agent.lock'
class XCATMessager(utils.Messager):
@@ -50,7 +50,7 @@ class XCATMessager(utils.Messager):
class Server(object):
def __init__(self, address, standalone):
def __init__(self, address, standalone=True, lockfile=None):
try:
os.unlink(address)
except OSError:
@@ -58,6 +58,7 @@ class Server(object):
raise
self.address = address
self.standalone = standalone
self.lockfile = lockfile
self.server = StreamServer(self._serve(), self._handle)
def _serve(self):
@@ -117,7 +118,7 @@ class Server(object):
def keep_peer_alive(self):
def acquire():
fd = open(LOCK_FILE, "r+")
fd = open(self.lockfile, "r+")
fcntl.flock(fd.fileno(), fcntl.LOCK_EX)
# if reach here, parent process may exit
print("xcat process exit unexpectedly.", file=sys.stderr)

View File

@@ -25,8 +25,8 @@ use xCAT_monitoring::monitorctrl;
use xCAT::TableUtils;
my $LOCK_DIR = "/var/lock/xcat/";
my $LOCK_PATH = "/var/lock/xcat/agent.lock";
my $AGENT_SOCK_PATH = "/var/run/xcat/agent.sock";
my $LOCK_PATH = "/var/lock/xcat/agent-$$.lock";
my $AGENT_SOCK_PATH = "/var/run/xcat/agent-$$.sock";
my $PYTHON_LOG_PATH = "/var/log/xcat/agent.log";
my $PYTHON_AGENT_FILE = "/opt/xcat/lib/python/agent/agent.py";
my $MSG_TYPE = "message";
@@ -76,32 +76,43 @@ sub exists_python_agent {
}
return 0;
}
sub python_agent_reaper {
unlink($LOCK_PATH);
unlink($AGENT_SOCK_PATH);
}
sub start_python_agent {
if (!defined(acquire_lock())) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to acquire lock");
return undef;
}
my $fd;
open($fd, '>', $AGENT_SOCK_PATH) && close($fd);
my $pid = fork;
if (!defined $pid) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Unable to fork process");
return undef;
} elsif ($pid){
open($fd, '>', $AGENT_SOCK_PATH) && close($fd);
$SIG{INT} = $SIG{TERM} = \&python_agent_reaper;
return $pid;
}
$SIG{CHLD} = 'DEFAULT';
if (!$pid) {
# child
open($fd, ">>", $PYTHON_LOG_PATH) && close($fd);
open(STDOUT, '>>', $PYTHON_LOG_PATH) or die("open: $!");
open(STDERR, '>>&', \*STDOUT) or die("open: $!");
my $ret = exec ($PYTHON_AGENT_FILE);
my @args = ( "$PYTHON_AGENT_FILE --sock $AGENT_SOCK_PATH --lockfile $LOCK_PATH" );
my $ret = exec @args;
if (!defined($ret)) {
xCAT::MsgUtils->message("S", "start_python_agent() Error: Failed to start the xCAT Python agent.");
exit(1);
}
}
return $pid;
}
sub handle_message {
@@ -201,6 +212,7 @@ sub wait_agent {
xCAT::MsgUtils->message("E", { data => ["Agent exited unexpectedly. See $PYTHON_LOG_PATH for details."] }, $callback);
xCAT::MsgUtils->message("I", { data => ["To revert to Perl framework: chdef -t site clustersite openbmcperl=ALL"] }, $callback);
}
python_agent_reaper();
}
#--------------------------------------------------------------------------------

View File

@@ -328,6 +328,10 @@ EOF
#force openibd load all modules in need, restart again
sleep 1
service openibd restart
if [ "$?" != "0" ] ;then
echo "[Error] service openibd restart failed."
exit 1
fi
fi
if [[ "$NODESETSTATE" == "genimage" ]]; then

View File

@@ -1,4 +1,4 @@
# <the template for PowerLE NV node definition>
# <the template for ipmi controlled PowerLE NV node definition>
ppc64le-template:
objtype=node
@@ -15,4 +15,4 @@ ppc64le-template:
nodetype=mp
serialport=0
serialspeed=115200
usercomment="the template for PowerLE NV node definition"
usercomment="the template for ipmi controlled PowerLE NV node definition"

View File

@@ -0,0 +1,18 @@
# <the template for openbmc controlled PowerLE NV node definition>
ppc64le-openbmc-template:
objtype=node
arch=ppc64le
bmc="MANDATORY:The hostname or ip address of the BMC adapater"
bmcpassword="MANDATORY:the password of the BMC"
bmcusername="MANDATORY:the username of the BMC"
cons=openbmc
groups=all
ip=OPTIONAL:the ip address of the node
mac=OPTIONAL:the mac of the node
mgt=openbmc
netboot=petitboot
nodetype=mp
serialport=0
serialspeed=115200
usercomment="the template for openbmc controlled PowerLE NV node definition"