public class RebootMgr extends Object
This class provides a public API that hydra clients can use to dynamically
reboot hosts during a test run. The API can only be used for hosts that are
virtual machines, and only virtual machines running on Unix platforms.
Using reboot on a Window hosts requires the Bootstrapper to be
installed as a Windows service with the proper user name, using the build
under test.
The API is also restricted to hydra tasks of type "TASK". Only hosts used by hydra client JVMs and/or hydra-managed Hadoop processes are available for reboot. The source of a reboot, and other test processes, can be running on the same host as the virtual machine being rebooted and are unaffected by the reboot.
A host is not available to be rebooted if:
ClientVmMgr APIclearInfo(java.lang.String)RebootHostNotFoundException is thrown if a host is not available
to be used as a target.
Methods are available in synchronous versions only. They do not return until the host has rebooted and the hydra hostagent has been restarted on the host.
The reboot API returns the information needed to restart hydra client and
Hadoop processes on a host after it is rebooted. This information is
returned in a RebootInfo object, and is also available to any hydra
client after a reboot through the getInfo(java.lang.String) method.
The test must ensure that no Hadoop processes are being stopped or started during a reboot. Hydra does not enforce this, but assumes that all processes in a Hadoop cluster have been started at least once prior to any reboot. The test must also take care not to invoke any other methods that require the hostagent on the host being rebooted.
The reboot method can optionally return only processes that were live at the
time of the reboot or include those that were previously stopped using the
ClientVmMgr and/or HadoopHelper APIs.
It is the responsibility of the test to use the ClientVmMgr and
HadoopHelper APIs to restart the desired processes after reboot
using the information contained in the RebootInfo object. The test must then
use clearInfo(java.lang.String) to make the host available for another reboot.
The RebootInfo does not include processes started by hydra clients through
ProcessMgr.bgexec(java.lang.String) or ProcessMgr.fgexec(java.lang.String, int) methods, #java, HadoopHelper.runHadoopCommand(java.lang.String, java.lang.String, java.lang.String), or CacheServerHelper.
If processes started through these methods are running at the time of a
reboot, it is up to the test to manage the outcome, such as updating
nukerun scripts, and to optionally restart the processes using information
the test has saved.
Reboot is equivalent to pulling the plug on a host. As a result, the log files for processes running on the host will not show messages that were buffered at the time of the reboot. The product logger does a flush on each write, but messages are still logged by the operating system, disk subsystem, and physical disk. NFS also buffers, so message loss can be reduced by running processes with user directories local to the host being rebooted.
Dynamic actions are carried out in the master, using threads named for the
source client and the action, e.g., Dynamic Rebooter. To see
the steps in a reboot, look for messages from this thread in the hydra
taskmaster log.
| Constructor and Description |
|---|
RebootMgr() |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearInfo(String target)
Clears the for a rebooted host when it is no longer needed.
|
static RebootInfo |
getInfo(String target)
Returns the
RebootInfo for a rebooted host. |
static RebootInfo |
reboot(String reason,
String target,
boolean liveOnly)
Reboots the given host.
|
protected static void |
rebootRemote(String srcName,
int srcVmid,
int actionId,
String reason,
RebootInfo target)
Reboots a host previously reserved.
|
public static RebootInfo reboot(String reason, String target, boolean liveOnly) throws RebootHostNotFoundException
reason - The reason for rebooting the host.target - The name of the host.liveOnly - Whether to return only the processes on the host
that were live at the time of the reboot. When false,
processes that were stopped prior to the reboot using
other APIs are also returned.RebootInfo describing processes on the target host.RebootHostNotFoundException - if the host is unavailable as a target.IllegalArgumentException - if the host is not used in the test.DynamicActionException - if the test is terminating abnormally and
refuses to allow any further dynamic actions.public static RebootInfo getInfo(String target)
RebootInfo for a rebooted host. This method can be
used after reboot(java.lang.String, java.lang.String, boolean) to get the information needed to restart
processes. When the info is no longer needed, use #clearRebootInfo
to make the host available for reboot.public static void clearInfo(String target)
protected static void rebootRemote(String srcName, int srcVmid, int actionId, String reason, RebootInfo target)
Copyright © 2010-2015 Pivotal Software, Inc. All rights reserved.