use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.
the class Agent method sendStartup.
public void sendStartup(final Link link) {
final StartupCommand[] startup = this.resource.initialize();
if (startup != null) {
final Command[] commands = new Command[startup.length];
for (int i = 0; i < startup.length; i++) {
setupStartupCommand(startup[i]);
commands[i] = startup[i];
}
final Request request = new Request(this._id != null ? this._id : -1, -1, commands, false, false);
request.setSequence(getNextSequence());
if (logger.isDebugEnabled()) {
logger.debug("Sending Startup: " + request.toString());
}
lockStartupTask(link);
try {
link.send(request.toBytes());
} catch (final ClosedChannelException e) {
logger.warn("Unable to send request: " + request.toString());
}
}
}
use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.
the class LibvirtComputingResource method initialize.
@Override
public StartupCommand[] initialize() {
final List<StartupCommand> startupCommandList = new ArrayList<>();
final List<Object> info = getHostInfo();
this.totalMemory = (Long) info.get(1);
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(3), (String) info.get(2), getHypervisorType(), RouterPrivateIpStrategy.HostLocal);
cmd.setCpuSockets((Integer) info.get(4));
fillNetworkInformation(cmd);
this.privateIp = cmd.getPrivateIpAddress();
cmd.getHostDetails().putAll(getVersionStrings());
cmd.setPool(getPool());
cmd.setCluster(getCluster());
cmd.setGatewayIpAddress(this.localGateway);
cmd.setIqn(getIqn());
cmd.setVersion(LibvirtComputingResource.class.getPackage().getImplementationVersion());
startupCommandList.add(cmd);
startupCommandList.addAll(initializeLocalstorage());
return startupCommandList.toArray(new StartupCommand[startupCommandList.size()]);
}
use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.
the class NiciraNvpResource method initialize.
@Override
public StartupCommand[] initialize() {
final StartupNiciraNvpCommand sc = new StartupNiciraNvpCommand();
sc.setGuid(this.guid);
sc.setName(this.name);
sc.setDataCenter(this.zoneId);
sc.setPod("");
sc.setPrivateIpAddress("");
sc.setStorageIpAddress("");
sc.setVersion(NiciraNvpResource.class.getPackage().getImplementationVersion());
return new StartupCommand[] { sc };
}
use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.
the class XcpServerDiscoverer method createHostVOForDirectConnectAgent.
@Override
public HostVO createHostVOForDirectConnectAgent(final HostVO host, final StartupCommand[] startup, final ServerResource resource, final Map<String, String> details, final List<String> hostTags) {
final StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupRoutingCommand)) {
return null;
}
final StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd);
if (ssCmd.getHypervisorType() != HypervisorType.XenServer) {
return null;
}
final HostPodVO pod = this._podDao.findById(host.getPodId());
final Zone zone = this.zoneRepository.findById(host.getDataCenterId()).orElse(null);
s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.XenServer + ". Checking CIDR...");
this._resourceMgr.checkCIDR(pod, zone, ssCmd.getPrivateIpAddress(), ssCmd.getPrivateNetmask());
return this._resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.XenServer, details, hostTags);
}
use of com.cloud.legacymodel.communication.command.startup.StartupCommand in project cosmic by MissionCriticalCloud.
the class SshKeysDistriMonitor method processConnect.
@Override
public void processConnect(final Host host, final StartupCommand[] startupCommands, final boolean forRebalance) {
for (final StartupCommand startupCommand : startupCommands) {
if (startupCommand instanceof StartupRoutingCommand) {
if (((StartupRoutingCommand) startupCommand).getHypervisorType() == HypervisorType.KVM || ((StartupRoutingCommand) startupCommand).getHypervisorType() == HypervisorType.XenServer) {
/*TODO: Get the private/public keys here*/
final String pubKey = _configDao.getValue("ssh.publickey");
final String prvKey = _configDao.getValue("ssh.privatekey");
try {
final ModifySshKeysCommand cmds = new ModifySshKeysCommand(pubKey, prvKey);
final Commands c = new Commands(cmds);
_agentMgr.send(host.getId(), c, this);
} catch (final AgentUnavailableException e) {
s_logger.debug("Failed to send keys to agent: " + host.getId());
}
}
}
}
}
Aggregations