use of com.cloud.agent.api.StartupCommand in project cloudstack by apache.
the class SimulatorSecondaryDiscoverer method createHostVOForDirectConnectAgent.
@Override
public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map<String, String> details, List<String> hostTags) {
//for detecting SSVM dispatch
StartupCommand firstCmd = startup[0];
if (!(firstCmd instanceof StartupSecondaryStorageCommand)) {
return null;
}
host.setType(com.cloud.host.Host.Type.SecondaryStorageVM);
return host;
}
use of com.cloud.agent.api.StartupCommand in project CloudStack-archive by CloudStack-extras.
the class FakeComputingResource method initialize.
@Override
public StartupCommand[] initialize() {
Map<String, VmState> changes = null;
final List<Object> info = getHostInfo();
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal, changes);
fillNetworkInformation(cmd);
cmd.getHostDetails().putAll(getVersionStrings());
cmd.setCluster(getConfiguredProperty("cluster", "1"));
StoragePoolInfo pi = initializeLocalStorage();
StartupStorageCommand sscmd = new StartupStorageCommand();
sscmd.setPoolInfo(pi);
sscmd.setGuid(pi.getUuid());
sscmd.setDataCenter((String) _params.get("zone"));
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
return new StartupCommand[] { cmd, sscmd };
}
use of com.cloud.agent.api.StartupCommand in project CloudStack-archive by CloudStack-extras.
the class AgentRoutingResource method initialize.
@Override
public StartupCommand[] initialize() {
synchronized (_vms) {
_vms.clear();
}
Map<String, State> changes = _simMgr.getVmStates(this.hostGuid);
Map<String, MockVMVO> vmsMaps = _simMgr.getVms(this.hostGuid);
totalCpu = agentHost.getCpuCount() * agentHost.getCpuSpeed();
totalMem = agentHost.getMemorySize();
for (Map.Entry<String, MockVMVO> entry : vmsMaps.entrySet()) {
MockVMVO vm = entry.getValue();
usedCpu += vm.getCpu();
usedMem += vm.getMemory();
_runningVms.put(entry.getKey(), new Pair<Long, Long>(Long.valueOf(vm.getCpu()), vm.getMemory()));
}
List<Object> info = getHostInfo();
StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.Simulator, RouterPrivateIpStrategy.HostLocal);
cmd.setStateChanges(changes);
Map<String, String> hostDetails = new HashMap<String, String>();
hostDetails.put(RouterPrivateIpStrategy.class.getCanonicalName(), RouterPrivateIpStrategy.DcGlobal.toString());
cmd.setHostDetails(hostDetails);
cmd.setAgentTag("agent-simulator");
cmd.setPrivateIpAddress(agentHost.getPrivateIpAddress());
cmd.setPrivateNetmask(agentHost.getPrivateNetMask());
cmd.setPrivateMacAddress(agentHost.getPrivateMacAddress());
cmd.setStorageIpAddress(agentHost.getStorageIpAddress());
cmd.setStorageNetmask(agentHost.getStorageNetMask());
cmd.setStorageMacAddress(agentHost.getStorageMacAddress());
cmd.setStorageIpAddressDeux(agentHost.getStorageIpAddress());
cmd.setStorageNetmaskDeux(agentHost.getStorageNetMask());
cmd.setStorageMacAddressDeux(agentHost.getStorageIpAddress());
cmd.setName(agentHost.getName());
cmd.setGuid(agentHost.getGuid());
cmd.setVersion(agentHost.getVersion());
cmd.setAgentTag("agent-simulator");
cmd.setDataCenter(String.valueOf(agentHost.getDataCenterId()));
cmd.setPod(String.valueOf(agentHost.getPodId()));
cmd.setCluster(String.valueOf(agentHost.getClusterId()));
StartupStorageCommand ssCmd = initializeLocalSR();
return new StartupCommand[] { cmd, ssCmd };
}
use of com.cloud.agent.api.StartupCommand in project CloudStack-archive by CloudStack-extras.
the class AgentStorageResource method initialize.
@Override
public StartupCommand[] initialize() {
StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand();
cmd.setPrivateIpAddress(agentHost.getPrivateIpAddress());
cmd.setPrivateNetmask(agentHost.getPrivateNetMask());
cmd.setPrivateMacAddress(agentHost.getPrivateMacAddress());
cmd.setStorageIpAddress(agentHost.getStorageIpAddress());
cmd.setStorageNetmask(agentHost.getStorageNetMask());
cmd.setStorageMacAddress(agentHost.getStorageMacAddress());
cmd.setPublicIpAddress(agentHost.getPublicIpAddress());
cmd.setName(agentHost.getName());
cmd.setAgentTag("agent-simulator");
cmd.setVersion(agentHost.getVersion());
cmd.setDataCenter(String.valueOf(agentHost.getDataCenterId()));
cmd.setPod(String.valueOf(agentHost.getPodId()));
cmd.setGuid(agentHost.getGuid());
return new StartupCommand[] { cmd };
}
use of com.cloud.agent.api.StartupCommand in project CloudStack-archive by CloudStack-extras.
the class Agent method sendStartup.
public void sendStartup(Link link) {
final StartupCommand[] startup = _resource.initialize();
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(_id != null ? _id : -1, -1, commands, false, false);
request.setSequence(getNextSequence());
if (s_logger.isDebugEnabled()) {
s_logger.debug("Sending Startup: " + request.toString());
}
synchronized (this) {
_startup = new StartupTask(link);
_timer.schedule(_startup, _startupWait);
}
try {
link.send(request.toBytes());
} catch (final ClosedChannelException e) {
s_logger.warn("Unable to send reques: " + request.toString());
}
}
Aggregations