@Override public StartupCommand[] initialize() { StartupRoutingCommand cmd = new StartupRoutingCommand(); cmd.setCpus(1); cmd.setSpeed(1000L); cmd.setMemory(1000000L); cmd.setDom0MinMemory(256L); cmd.setCaps("hvm"); cmd.setGuid(_guid); cmd.setDataCenter(_zone); cmd.setPod(_pod); cmd.setHypervisorType(HypervisorType.None); cmd.setAgentTag("vmops-simulator"); cmd.setName(_url); cmd.setPrivateIpAddress(this.getHostPrivateIp()); cmd.setPrivateMacAddress(this.getHostMacAddress().toString()); cmd.setPrivateNetmask("255.255.0.0"); cmd.setIqn("iqn:" + _url); cmd.setStorageIpAddress(getHostStoragePrivateIp()); cmd.setStorageMacAddress(getHostStorageMacAddress().toString()); cmd.setStorageIpAddressDeux(getHostStoragePrivateIp2()); cmd.setStorageMacAddressDeux(getHostStorageMacAddress2().toString()); cmd.setPublicIpAddress(getHostStoragePrivateIp()); cmd.setPublicMacAddress(getHostStorageMacAddress().toString()); cmd.setPublicNetmask("255.255.0.0"); cmd.setVersion(DummyHostServerResource.class.getPackage().getImplementationVersion()); return new StartupCommand[] {cmd}; }
OvmHost.Details hostDetails = OvmHost.getDetails(_conn); cmd.setName(hostDetails.name); cmd.setSpeed(hostDetails.cpuSpeed); cmd.setCpus(hostDetails.cpuNum); cmd.setMemory(hostDetails.freeMemory); cmd.setDom0MinMemory(hostDetails.dom0Memory); cmd.setGuid(_guid); cmd.setDataCenter(_zoneId.toString()); cmd.setPod(_podId.toString()); cmd.setCluster(_clusterId.toString()); cmd.setVersion(OvmResourceBase.class.getPackage().getImplementationVersion()); cmd.setHypervisorType(HypervisorType.Ovm); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(_ip); _guestNetworkName = _privateNetworkName; Map<String, String> d = cmd.getHostDetails(); d.put("public.network.device", _publicNetworkName); d.put("private.network.device", _privateNetworkName); d.put("guest.network.device", _guestNetworkName); cmd.setHostDetails(d);
@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.Ovm) { return null; } return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Ovm, details, hostTags); }
@Override public StartupCommand[] initialize() { StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.KVM, new HashMap<String, String>()); cmd.setDataCenter(_zoneId); cmd.setPod(_podId); cmd.setCluster(_clusterId); cmd.setGuid(_guid); cmd.setName(_agentIp); cmd.setPrivateIpAddress(_agentIp); cmd.setStorageIpAddress(_agentIp); cmd.setVersion(KvmDummyResourceBase.class.getPackage().getImplementationVersion()); return new StartupCommand[] {cmd}; }
@Override public StartupCommand[] initialize() { StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.BareMetal, new HashMap<String, String>()); cmd.setDataCenter(_zone); cmd.setPod(_pod); cmd.setCluster(_cluster); cmd.setGuid(_uuid); cmd.setName(_ip); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(_ip); cmd.setVersion(BareMetalResourceBase.class.getPackage().getImplementationVersion()); cmd.setCpus((int) _cpuNum); cmd.setSpeed(_cpuCapacity); cmd.setMemory(_memCapacity); cmd.setPrivateMacAddress(_mac); cmd.setPublicMacAddress(_mac); return new StartupCommand[] { cmd }; }
@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; } }
Map<String, String> details = cmd.getHostDetails(); if (details == null) { details = new HashMap<String, String>(); if (hr.softwareVersion.get("product_version_text_short") != null) { details.put("product_version_text_short", hr.softwareVersion.get("product_version_text_short")); cmd.setHypervisorVersion(hr.softwareVersion.get("product_version_text_short")); cmd.setHypervisorVersion(_host.getProductVersion()); cmd.setHostDetails(details); cmd.setName(hr.nameLabel); cmd.setGuid(_host.getUuid()); cmd.setPool(_host.getPool()); cmd.setDataCenter(Long.toString(_dcId)); for (final String cap : hr.capabilities) { if (cap.length() > 0) { cmd.setCaps(caps.toString()); cmd.setSpeed(_host.getSpeed()); cmd.setCpuSockets(_host.getCpuSockets()); cmd.setCpus(_host.getCpus()); cmd.setMemory(ram); cmd.setDom0MinMemory(dom0Ram); PIF.Record pifr = pif.getRecord(conn); if (pifr.IP != null && pifr.IP.length() > 0) {
new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.Hyperv, RouterPrivateIpStrategy.HostLocal); defaultStartRoutCmd.setDataCenter(_zoneId); defaultStartRoutCmd.setPod(_podId); defaultStartRoutCmd.setCluster(_clusterId); defaultStartRoutCmd.setGuid(_guid); defaultStartRoutCmd.setName(_name); defaultStartRoutCmd.setPrivateIpAddress(_agentIp); defaultStartRoutCmd.setStorageIpAddress(_agentIp); defaultStartRoutCmd.setPool(_clusterGuid); defaultStartRoutCmd.setVersion(this.getClass().getPackage().getImplementationVersion()); if (!startCmd.getDataCenter().equals(defaultStartRoutCmd.getDataCenter())) { final String errMsg = String.format("Host %s (IP %s) changed zone/data center. Was " + defaultStartRoutCmd.getDataCenter() + " NOW its " + startCmd.getDataCenter(), _name, _agentIp); s_logger.error(errMsg); if (!startCmd.getPod().equals(defaultStartRoutCmd.getPod())) { final String errMsg = String.format("Host %s (IP %s) changed pod. Was " + defaultStartRoutCmd.getPod() + " NOW its " + startCmd.getPod(), _name, _agentIp); s_logger.error(errMsg); if (!startCmd.getCluster().equals(defaultStartRoutCmd.getCluster())) { final String errMsg = String.format("Host %s (IP %s) changed cluster. Was " + defaultStartRoutCmd.getCluster() + " NOW its " + startCmd.getCluster(), _name, _agentIp); s_logger.error(errMsg); if (!startCmd.getGuid().equals(defaultStartRoutCmd.getGuid())) {
new StartupRoutingCommand(info.getCpus(), info.getCpuSpeed(), info.getTotalMemory(), info.getReservedMemory(), capabilities, _hypervisorType, RouterPrivateIpStrategy.HostLocal); cmd.setCpuSockets(info.getCpuSockets()); fillNetworkInformation(cmd); _privateIp = cmd.getPrivateIpAddress(); cmd.getHostDetails().putAll(getVersionStrings()); cmd.getHostDetails().put(KeyStoreUtils.SECURED, String.valueOf(isHostSecured()).toLowerCase()); cmd.setPool(_pool); cmd.setCluster(_clusterId); cmd.setGatewayIpAddress(_localGateway); cmd.setIqn(getIqn()); if (cmd.getHostDetails().containsKey("Host.OS")) { _hostDistro = cmd.getHostDetails().get("Host.OS"); new com.cloud.agent.api.StoragePoolInfo(localStoragePool.getUuid(), cmd.getPrivateIpAddress(), _localStoragePath, _localStoragePath, StoragePoolType.Filesystem, localStoragePool.getCapacity(), localStoragePool.getAvailable());
@Override public StartupCommand[] initialize() { 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); 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}; }
@Override public StartupCommand[] initialize() throws IllegalArgumentException { final Connection conn = getConnection(); if (!getHostInfo(conn)) { s_logger.warn("Unable to get host information for " + _host.getIp()); return null; } final StartupRoutingCommand cmd = new StartupRoutingCommand(); fillHostInfo(conn, cmd); cmd.setHypervisorType(HypervisorType.XenServer); cmd.setCluster(_cluster); cmd.setPoolSync(false); try { final Pool pool = Pool.getByUuid(conn, _host.getPool()); final Pool.Record poolr = pool.getRecord(conn); poolr.master.getRecord(conn); } catch (final Throwable e) { s_logger.warn("Check for master failed, failing the FULL Cluster sync command"); } List<StartupStorageCommand> startUpLocalStorageCommands = null; try { startUpLocalStorageCommands = initializeLocalSrs(conn); } catch (XenAPIException | XmlRpcException e) { s_logger.warn("Could not initialize local SRs on host: " + _host.getUuid(), e); } if (CollectionUtils.isEmpty(startUpLocalStorageCommands)) { return new StartupCommand[] {cmd}; } return createStartupCommandsArray(cmd, startUpLocalStorageCommands); }
@Override public HostVO fillRoutingHostVO(final HostVO host, final StartupRoutingCommand ssCmd, final HypervisorType hyType, Map<String, String> details, final List<String> hostTags) { if (host.getPodId() == null) { s_logger.error("Host " + ssCmd.getPrivateIpAddress() + " sent incorrect pod, pod id is null"); throw new IllegalArgumentException("Host " + ssCmd.getPrivateIpAddress() + " sent incorrect pod, pod id is null"); final Map<String, String> hostDetails = ssCmd.getHostDetails(); if (hostDetails != null) { if (details != null) { checkIPConflicts(pod, dc, ssCmd.getPrivateIpAddress(), ssCmd.getPublicIpAddress(), ssCmd.getPublicIpAddress(), ssCmd.getPublicNetmask()); host.setType(com.cloud.host.Host.Type.Routing); host.setDetails(details); host.setCaps(ssCmd.getCapabilities()); host.setCpuSockets(ssCmd.getCpuSockets()); host.setCpus(ssCmd.getCpus()); host.setTotalMemory(ssCmd.getMemory()); host.setSpeed(ssCmd.getSpeed()); host.setHypervisorType(hyType); host.setHypervisorVersion(ssCmd.getHypervisorVersion()); host.setGpuGroups(ssCmd.getGpuGroupDetails()); return host;
@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.XenServer) { return null; } HostPodVO pod = _podDao.findById(host.getPodId()); DataCenterVO dc = _dcDao.findById(host.getDataCenterId()); s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.XenServer + ". Checking CIDR..."); _resourceMgr.checkCIDR(pod, dc, ssCmd.getPrivateIpAddress(), ssCmd.getPrivateNetmask()); return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.XenServer, details, hostTags); }
if (startup.getHypervisorType() != HypervisorType.XenServer) { s_logger.debug("Not XenServer so moving on."); return; cluster.setGuid(startup.getPool()); _clusterDao.update(cluster.getId(), cluster); } else if (!cluster.getGuid().equals(startup.getPool())) { String msg = "pool uuid for cluster " + cluster.getId() + " changed from " + cluster.getGuid() + " to " + startup.getPool(); s_logger.warn(msg); throw new CloudRuntimeException(msg); Map<String, String> details = startup.getHostDetails(); String prodBrand = details.get("product_brand").trim(); String prodVersion = details.get("product_version").trim();
@Override public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) { StartupCommand firstCmd = cmd[0]; if (!(firstCmd instanceof StartupRoutingCommand)) { return null; } StartupRoutingCommand ssCmd = ((StartupRoutingCommand)firstCmd); if (ssCmd.getHypervisorType() != getHypervisorType()) { return null; } /* KVM requires host are the same in cluster */ ClusterVO clusterVO = _clusterDao.findById(host.getClusterId()); if (clusterVO == null) { s_logger.debug("cannot find cluster: " + host.getClusterId()); throw new IllegalArgumentException("cannot add host, due to can't find cluster: " + host.getClusterId()); } List<HostVO> hostsInCluster = _resourceMgr.listAllHostsInCluster(clusterVO.getId()); if (!hostsInCluster.isEmpty()) { HostVO oneHost = hostsInCluster.get(0); _hostDao.loadDetails(oneHost); String hostOsInCluster = oneHost.getDetail("Host.OS"); String hostOs = ssCmd.getHostDetails().get("Host.OS"); if (!hostOsInCluster.equalsIgnoreCase(hostOs)) { throw new IllegalArgumentException("Can't add host: " + firstCmd.getPrivateIpAddress() + " with hostOS: " + hostOs + " into a cluster," + "in which there are " + hostOsInCluster + " hosts added"); } } _hostDao.loadDetails(host); return _resourceMgr.fillRoutingHostVO(host, ssCmd, getHypervisorType(), host.getDetails(), null); }
final StartupRoutingCommand startup = (StartupRoutingCommand)cmd; final String dataCenter = startup.getDataCenter(); throw new IllegalArgumentException("Host " + startup.getPrivateIpAddress() + " sent incorrect data center: " + dataCenter); final HypervisorType hypervisorType = startup.getHypervisorType();
@Override protected void fillHostInfo(final Connection conn, final StartupRoutingCommand cmd) { super.fillHostInfo(conn, cmd); final Map<String, String> details = cmd.getHostDetails(); final Boolean hotFix62ESP1004 = hostHasHotFix(conn, XenserverConfigs.XSHotFix62ESP1004); if( hotFix62ESP1004 != null && hotFix62ESP1004 ) { details.put(XenserverConfigs.XS620HotFix , XenserverConfigs.XSHotFix62ESP1004); } else { final Boolean hotFix62ESP1 = hostHasHotFix(conn, XenserverConfigs.XSHotFix62ESP1); if( hotFix62ESP1 != null && hotFix62ESP1 ) { details.put(XenserverConfigs.XS620HotFix , XenserverConfigs.XSHotFix62ESP1); } } cmd.setHostDetails(details); } }
@Override public StartupCommand[] initialize() { LOGGER.debug("Ovm3 resource intializing"); try { StartupRoutingCommand srCmd = new StartupRoutingCommand(); StartupStorageCommand ssCmd = new StartupStorageCommand(); /* here stuff gets completed, but where should state live ? */ hypervisorsupport.fillHostInfo(srCmd); hypervisorsupport.vmStateMapClear(); LOGGER.debug("Ovm3 pool " + ssCmd + " " + srCmd); return new StartupCommand[] {srCmd, ssCmd}; } catch (Exception e) { LOGGER.debug("Ovm3 resource initializes failed", e); return new StartupCommand[] {}; } }
public StartupRoutingCommand(int cpus, long speed, long memory, long dom0MinMemory, String caps, HypervisorType hypervisorType, RouterPrivateIpStrategy privIpStrategy) { this(cpus, speed, memory, dom0MinMemory, caps, hypervisorType); getHostDetails().put(RouterPrivateIpStrategy.class.getCanonicalName(), privIpStrategy.toString()); }
if (startup.getHypervisorType() != HypervisorType.Hyperv) { s_logger.debug("Not Hyper-V hypervisor, so moving on."); return; cluster.setGuid(startup.getPool()); _clusterDao.update(cluster.getId(), cluster);