public VDS clone() { VDS vds = new VDS(); vds.setClusterId(getClusterId()); vds.setClusterCpuName(getClusterCpuName()); vds.setCpuName(getCpuName()); vds.setClusterDescription(getClusterDescription()); vds.setId(getId()); vds.setVdsName(getName()); vds.setHostName(getHostName()); vds.setComment(getComment()); vds.setPort(getPort()); vds.setSshPort(getSshPort()); vds.setSshUsername(getSshUsername()); vds.setStatus(getStatus()); vds.setExternalStatus(getExternalStatus()); vds.setHardwareManufacturer(getHardwareManufacturer()); vds.setHardwareProductName(getHardwareProductName()); vds.setHardwareVersion(getHardwareVersion()); vds.setHardwareSerialNumber(getHardwareSerialNumber()); vds.setHardwareUUID(getHardwareUUID()); vds.setHardwareFamily(getHardwareFamily()); vds.setCpuCores(getCpuCores()); vds.setCpuThreads(getCpuThreads()); vds.setCpuModel(getCpuModel()); vds.setOnlineCpus(getOnlineCpus()); vds.setCpuSpeedMh(getCpuSpeedMh()); vds.setIfTotalSpeed(getIfTotalSpeed()); vds.setKvmEnabled(getKvmEnabled()); vds.setPhysicalMemMb(getPhysicalMemMb()); vds.setCpuIdle(getCpuIdle());
static VDS setUpEntityExpectations(VDS entity, VdsStatistics statistics, int index) { entity.setId(GUIDS[index]); entity.getStaticData().setName(NAMES[index]); entity.setHostName(ADDRESSES[index]); entity.setStatus(VDS_STATUS[index]); entity.setStoragePoolId(GUIDS[1]); if (statistics != null) { setUpStatisticalEntityExpectations(entity, statistics); } return entity; }
public VDS getvds() { VDS vds = new VDS(); vds.setStaticData(vdsStatic); return vds; }
public float getFreeVirtualMemory() { if (getMemCommited() != null && getPhysicalMemMb() != null && getReservedMem() != null) { float freeMemory = (getMaxVdsMemoryOverCommit() * getPhysicalMemMb() / 100.0f) - getMemCommited() - getReservedMem(); // avoid negative values return freeMemory > 0 ? freeMemory : 0; } else { return 0; } }
private void calculateFreeSchedulingMemoryCache() { if (getMemCommited() != null && getPhysicalMemMb() != null && getReservedMem() != null) { maxSchedulingMemory = getFreeVirtualMemory() - getPendingVmemSize(); // avoid negative values maxSchedulingMemory = maxSchedulingMemory > 0 ? maxSchedulingMemory : 0; } }
private static Object cloneVDS(VDS instance) { VDS obj = new VDS(); obj.setHostName(instance.getHostName()); obj.setSshKeyFingerprint(instance.getSshKeyFingerprint()); obj.setSshPort(instance.getSshPort()); obj.setSshUsername(instance.getSshUsername()); obj.setFenceAgents(cloneAgents(instance.getFenceAgents())); obj.setDisablePowerManagementPolicy(instance.isDisablePowerManagementPolicy()); obj.setPmKdumpDetection(instance.isPmKdumpDetection()); obj.setPort(instance.getPort()); obj.setServerSslEnabled(instance.isServerSslEnabled()); obj.setClusterId(instance.getClusterId()); obj.setId(instance.getId()); obj.setVdsName(instance.getName()); obj.setVdsStrength(instance.getVdsStrength()); obj.setVdsType(instance.getVdsType()); obj.setUniqueId(instance.getUniqueId()); obj.setVdsSpmPriority(instance.getVdsSpmPriority()); obj.setCurrentKernelCmdline(instance.getCurrentKernelCmdline()); obj.setKernelCmdlineParsable(instance.isKernelCmdlineParsable()); obj.setLastStoredKernelCmdline(instance.getLastStoredKernelCmdline()); obj.setKernelCmdlineBlacklistNouveau(instance.isKernelCmdlineBlacklistNouveau()); obj.setKernelCmdlineIommu(instance.isKernelCmdlineIommu()); obj.setKernelCmdlineKvmNested(instance.isKernelCmdlineKvmNested()); obj.setKernelCmdlinePciRealloc(instance.isKernelCmdlinePciRealloc()); obj.setKernelCmdlineFips(instance.isKernelCmdlineFips()); obj.setKernelCmdlineUnsafeInterrupts(instance.isKernelCmdlineUnsafeInterrupts()); return obj; }
@Mapping(from = VDS.class, to = Host.class) public static Host map(VDS entity, Host template) { Host model = template != null ? template : new Host(); model.setId(entity.getId().toString()); model.setName(entity.getName()); model.setComment(entity.getComment()); if (entity.getClusterId() != null) { Cluster cluster = new Cluster(); cluster.setId(entity.getClusterId().toString()); model.setCluster(cluster); model.setAddress(entity.getHostName()); if (entity.getPort() > 0) { model.setPort(entity.getPort()); HostStatus status = map(entity.getStatus(), null); model.setStatus(status); if (entity.getExternalStatus() != null) { ExternalStatus externalStatus = ExternalStatusMapper.map(entity.getExternalStatus()); model.setExternalStatus(externalStatus); model.setStatusDetail(entity.getNonOperationalReason().name().toLowerCase()); } else if (status == HostStatus.MAINTENANCE || status == HostStatus.PREPARING_FOR_MAINTENANCE) { model.setStatusDetail(entity.getMaintenanceReason()); spm.setPriority(entity.getVdsSpmPriority()); if (entity.getSpmStatus() != null) { spm.setStatus(mapSpmStatus(entity.getSpmStatus())); if (entity.getVersion() != null &&
VDS host = model.getIsNew() ? new VDS() : (VDS) Cloner.clone(getSelectedItem()); host.setVdsName(model.getName().getEntity()); host.setComment(model.getComment().getEntity()); host.setHostName(model.getHost().getEntity().trim()); host.setPort(Integer.parseInt(model.getPort().getEntity().toString())); host.setSshPort(Integer.parseInt(model.getAuthSshPort().getEntity().toString())); boolean sshUsernameSet = model.getUserName().getEntity() != null; host.setSshUsername(sshUsernameSet ? model.getUserName().getEntity() : null); boolean sshFpSet = model.getFetchSshFingerprint().getEntity() != null; host.setSshKeyFingerprint(!sshFpSet ? null : model.getFetchSshFingerprint().getEntity()); host.setVdsSpmPriority(model.getSpmPriorityValue()); boolean consoleAddressSet = model.getConsoleAddressEnabled().getEntity(); host.setConsoleAddress(!consoleAddressSet ? null : model.getConsoleAddress().getEntity()); host.setVgpuPlacement(model.getVgpuPlacement().getValue()); Guid oldClusterId = host.getClusterId(); Guid newClusterId = model.getCluster().getSelectedItem().getId(); host.setClusterId(newClusterId); host.setVdsSpmPriority(model.getSpmPriorityValue()); host.setFenceProxySources(FenceProxySourceTypeHelper.parseFromString(model.getPmProxyPreferences())); host.setPmEnabled(model.getIsPm().getEntity()); host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity()); host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity()); host.setCurrentKernelCmdline(model.getKernelCmdline().getEntity()); host.setKernelCmdlineBlacklistNouveau(model.getKernelCmdlineBlacklistNouveau().getEntity()); host.setKernelCmdlineParsable(model.isKernelCmdlineParsable()); host.setKernelCmdlineIommu(model.getKernelCmdlineIommu().getEntity());
setOS(vds.getHostOs()); setOsPrettyName(vds.getPrettyName()); setKernelVersion(vds.getKernelVersion()); setKvmVersion(vds.getKvmVersion()); setLibvirtVersion(vds.getLibvirtVersion()); setVdsmVersion(vds.getVersion()); setSpiceVersion(vds.getSpiceVersion()); setGlusterVersion(vds.getGlusterVersion()); setLibrbdVersion(vds.getLibrbdVersion()); setOvsVersion(vds.getOvsVersion()); setIScsiInitiatorName(vds.getIScsiInitiatorName()); setSpmPriorityValue(vds.getVdsSpmPriority()); setActiveVms(vds.getVmActive()); setPhysicalMemory(vds.getPhysicalMemMb()); setSwapTotal(vds.getSwapTotal()); setSwapFree(vds.getSwapFree()); setSharedMemory(vds.getMemSharedPercent()); setMemoryPageSharing(vds.getKsmState()); setAutomaticLargePage(vds.getTransparentHugePagesState()); if (vds.getHugePages() != null) { setHugePages( vds.getHugePages().stream().map( page -> messages.hugePages( String.valueOf(page.getSizeKB()), setBootTime(vds.getBootTime());
public void updateModelFromVds(VDS vds, List<StoragePool> dataCenters, boolean isEditWithPMemphasis) { setHostId(vds.getId()); setIsHostedEngineDeployed(vds.isHostedEngineDeployed()); updateExternalHostModels(vds.getHostProviderId()); getOverrideIpTables().setIsAvailable(showInstallationProperties()); setSpmPriorityValue(vds.getVdsSpmPriority()); setOriginalName(vds.getName()); getName().setEntity(vds.getName()); getComment().setEntity(vds.getComment()); getHost().setEntity(vds.getHostName()); getFetchSshFingerprint().setEntity(vds.getSshKeyFingerprint()); getUserName().setEntity(vds.getSshUsername()); getAuthSshPort().setEntity(vds.getSshPort()); if (StringHelper.isNotNullOrEmpty(vds.getKernelArgs())) { getCurrentKernelCmdLine().setEntity(constants.currentKernelCmdLine() + " " + vds.getKernelArgs()); //$NON-NLS-1$ boolean consoleAddressEnabled = vds.getConsoleAddress() != null; getConsoleAddressEnabled().setEntity(consoleAddressEnabled); getConsoleAddress().setEntity(vds.getConsoleAddress()); getConsoleAddress().setIsChangeable(consoleAddressEnabled); setVgpuPlacement(VgpuPlacement.forValue(vds.getVgpuPlacement())); setVgpuPlacementChangeability(getCluster().getSelectedItem().getCompatibilityVersion()); if (vds.isFenceAgentsExist()) { orderAgents(vds.getFenceAgents()); List<FenceAgentModel> agents = getFenceAgentModelList(vds); getFenceAgentListModel().setItems(agents);
VDS host = new VDS(); host.setVdsName(model.getName().getEntity()); host.setHostName(model.getHost().getEntity()); host.setPort(model.getPort().getEntity()); host.setSshPort(model.getAuthSshPort().getEntity()); host.setSshUsername(model.getUserName().getEntity()); host.setSshKeyFingerprint(model.getFetchSshFingerprint().getEntity()); host.setClusterId(model.getCluster().getSelectedItem().getId()); host.setVdsSpmPriority(model.getSpmPriorityValue()); host.setPmEnabled(model.getIsPm().getEntity()); host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity()); host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity()); addVdsParams.setVdsId(host.getId()); addVdsParams.setvds(host); if (model.getUserPassword().getEntity() != null) {
HostDetailModel hostDetailModel = (HostDetailModel) ((EntityModel) object).getEntity(); VDS host = new VDS(); host.setVdsName(hostDetailModel.getName()); host.setHostName(hostDetailModel.getAddress()); host.setSshKeyFingerprint(hostDetailModel.getFingerprint()); host.setPort(54321); host.setSshPort(22); // TODO: get from UI, till then using defaults. host.setSshUsername("root"); //$NON-NLS-1$ host.setClusterId(hostsModel.getClusterModel().getClusterId()); host.setPmEnabled(false); parameters.setVdsId(host.getId()); parameters.setvds(host); parameters.setPassword(hostDetailModel.getPassword());
@Override protected VDS getInverse(VdsStatic to) { VDS inverse = new VDS(); inverse.setId(to.getId()); inverse.setVdsName(to.getName()); inverse.setHostName(to.getHostName()); inverse.setClusterId(to.getClusterId()); inverse.setPort(to.getPort()); inverse.setSshKeyFingerprint(to.getSshKeyFingerprint()); inverse.setHostProviderId(to.getHostProviderId()); inverse.setSshPort(to.getSshPort()); inverse.setSshUsername(to.getSshUsername()); inverse.setVdsSpmPriority(to.getVdsSpmPriority()); inverse.setConsoleAddress(to.getConsoleAddress()); inverse.setComment(to.getComment()); return inverse; }
setHasNICsAlert(getEntity().getNetConfigDirty() == null ? false : getEntity().getNetConfigDirty()); getEntity().getClusterCompatibilityVersion().getValue())) { setHasDefaultRouteAlert(!NetworkCommonUtils.hasDefaultRoute(getEntity().getInterfaces())); if (getEntity().getStatus() == VDSStatus.NonResponsive && !getEntity().isPmEnabled() && ((getEntity().getVmActive() == null ? 0 : getEntity().getVmActive()) > 0 || getEntity().getSpmStatus() == VdsSpmStatus.SPM)) { setHasManualFenceAlert(true); } else if (!getEntity().isPmEnabled()) { setHasNoPowerManagementAlert(true); if (getEntity().getStaticData().isReinstallRequired()) { setHasReinstallRequiredAlert(true); if (getEntity().getStatus() == VDSStatus.NonResponsive) { setHasReinstallAlertNonResponsive(true); } else if (getEntity().getStatus() == VDSStatus.InstallFailed) { setHasReinstallAlertInstallFailed(true); } else if (getEntity().getStatus() == VDSStatus.Maintenance) { setHasReinstallAlertMaintenance(true); if (getEntity().getClusterSupportsGlusterService() && !(getEntity().getStatus() == VDSStatus.Installing || getEntity().getStatus() == VDSStatus.Initializing) && getEntity().getGlusterPeerStatus() != PeerStatus.CONNECTED) { setHasGlusterDisconnectedAlert(true); setNonOperationalReasonEntity(getEntity().getNonOperationalReason() == NonOperationalReason.NONE ?
@Test public void testMaxSchedulingMemory() { VDS vds = new VDS(); vds.setId(Guid.Empty); vds.setPhysicalMemMb(4000); vds.setMemCommited(1000); vds.setMaxVdsMemoryOverCommit(150); vds.setReservedMem(65); Host host = HostMapper.map(vds, (Host) null); long vdsValue = (long) vds.getMaxSchedulingMemory(); Long hostValue = host.getMaxSchedulingMemory() / HostMapper.BYTES_IN_MEGABYTE; assertTrue(vdsValue > 0 && hostValue > 0 && vdsValue == hostValue); }
@Test public void testHostedEngineMapping() { VDS vds = new VDS(); vds.setId(Guid.Empty); vds.setHighlyAvailableIsConfigured(true); vds.setHighlyAvailableIsActive(false); vds.setHighlyAvailableScore(123); vds.setHighlyAvailableGlobalMaintenance(true); vds.setHighlyAvailableLocalMaintenance(false); HostedEngine hostedEngine = HostMapper.map(vds, (HostedEngine) null); assertNotNull(hostedEngine); assertEquals(Boolean.TRUE, hostedEngine.isConfigured()); assertEquals(Boolean.FALSE, hostedEngine.isActive()); assertEquals(Integer.valueOf(123), hostedEngine.getScore()); assertEquals(Boolean.TRUE, hostedEngine.isGlobalMaintenance()); assertEquals(Boolean.FALSE, hostedEngine.isLocalMaintenance()); }
public MomPolicyVDSParameters(VDS vds, boolean enableBallooning, boolean enableKsm, boolean ksmMergeAcrossNumaNodes) { super(vds.getId()); this.enableBalloon = enableBallooning; this.enableKsm = enableKsm; this.ksmMergeAcrossNumaNodes = ksmMergeAcrossNumaNodes; }
protected void setGetVdsQueryExpectations(int times) { while (times-- > 0) { VDS vds = new VDS(); vds.setClusterId(GUIDS[0]); setUpEntityQueryExpectations(QueryType.GetVdsByVdsId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { PARENT_GUID }, vds); } }