use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class VmwareManagerImpl method updateClusterNativeHAState.
@DB
private void updateClusterNativeHAState(Host host, StartupCommand cmd) {
ClusterVO cluster = _clusterDao.findById(host.getClusterId());
if (cluster.getClusterType() == ClusterType.ExternalManaged) {
if (cmd instanceof StartupRoutingCommand) {
StartupRoutingCommand hostStartupCmd = (StartupRoutingCommand) cmd;
Map<String, String> details = hostStartupCmd.getHostDetails();
if (details.get("NativeHA") != null && details.get("NativeHA").equalsIgnoreCase("true")) {
_clusterDetailsDao.persist(host.getClusterId(), "NativeHA", "true");
} else {
_clusterDetailsDao.persist(host.getClusterId(), "NativeHA", "false");
}
}
}
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class OvmResourceBase method initialize.
@Override
public StartupCommand[] initialize() {
try {
StartupRoutingCommand cmd = new StartupRoutingCommand();
fillHostInfo(cmd);
cmd.setCaps("hvm");
return new StartupCommand[] { cmd };
} catch (Exception e) {
s_logger.debug("Ovm resource initializes failed", e);
return null;
}
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class VmwareResource method initialize.
@Override
public StartupCommand[] initialize() {
try {
String hostApiVersion = "4.1";
VmwareContext context = getServiceContext();
try {
VmwareHypervisorHost hyperHost = getHyperHost(context);
assert (hyperHost instanceof HostMO);
if (!((HostMO) hyperHost).isHyperHostConnected()) {
s_logger.info("Host " + hyperHost.getHyperHostName() + " is not in connected state");
return null;
}
((HostMO) hyperHost).enableVncOnHostFirewall();
AboutInfo aboutInfo = ((HostMO) hyperHost).getHostAboutInfo();
hostApiVersion = aboutInfo.getApiVersion();
} catch (Exception e) {
String msg = "VmwareResource intialize() failed due to : " + VmwareHelper.getExceptionMessage(e);
s_logger.error(msg);
invalidateServiceContext();
return null;
}
StartupRoutingCommand cmd = new StartupRoutingCommand();
fillHostInfo(cmd);
cmd.setHypervisorType(HypervisorType.VMware);
cmd.setCluster(_cluster);
cmd.setHypervisorVersion(hostApiVersion);
List<StartupStorageCommand> storageCmds = initializeLocalStorage();
StartupCommand[] answerCmds = new StartupCommand[1 + storageCmds.size()];
answerCmds[0] = cmd;
for (int i = 0; i < storageCmds.size(); i++) {
answerCmds[i + 1] = storageCmds.get(i);
}
return answerCmds;
} finally {
recycleServiceContext();
}
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class SshKeysDistriMonitor method processConnect.
@Override
public void processConnect(Host host, StartupCommand cmd, boolean forRebalance) throws ConnectionException {
if (cmd instanceof StartupRoutingCommand) {
if (((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.KVM || ((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.XenServer || ((StartupRoutingCommand) cmd).getHypervisorType() == HypervisorType.LXC) {
/*TODO: Get the private/public keys here*/
String pubKey = _configDao.getValue("ssh.publickey");
String prvKey = _configDao.getValue("ssh.privatekey");
try {
ModifySshKeysCommand cmds = new ModifySshKeysCommand(pubKey, prvKey);
Commands c = new Commands(cmds);
_agentMgr.send(host.getId(), c, this);
} catch (AgentUnavailableException e) {
s_logger.debug("Failed to send keys to agent: " + host.getId());
}
}
}
}
use of com.cloud.agent.api.StartupRoutingCommand in project cloudstack by apache.
the class SimulatorDiscoverer method createHostVOForDirectConnectAgent.
@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupRoutingCommand)) {
return null;
}
StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
if (ssCmd.getHypervisorType() != HypervisorType.Simulator) {
return null;
}
return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Simulator, details, hostTags);
}
Aggregations