/** * span a list of all possible sockets values */ private List<Integer> createSocketsRange() { List<Integer> res = new ArrayList<>(); int maxHostCpu = getHostCpu(); int cpusPerSockets = vm.getCpuPerSocket(); for (int i = 1; i <= maxHostCpu; i++) { // sockets stepping must not exceed the host maximum if (i * cpusPerSockets <= maxHostCpu) { res.add(i); } } return res; }
/** * Check if any CPUs may and need to be hotplugged or unplugged when configuration of a running VM is * updated from <code>source</code> to <code>destination</code>. * * @param source current configuration of the VM * @param destination new configuration of the VM * @return true, if any CPUs are to be hotplugged, false otherwise */ public static boolean isCpusToBeHotpluggedOrUnplugged(VM source, VM destination) { return source.getCpuPerSocket() == destination.getCpuPerSocket() && source.getNumOfSockets() != destination.getNumOfSockets() && source.getThreadsPerCpu() == destination.getThreadsPerCpu(); }
/** * Validates CPU count configuration. It may not be possible to use * configurations with too many threads or cores. * * @param vm The VM for which we want to check the CPU count configuration * @return Whether the CPU count configuration is valid */ public static boolean validateCpuCounts(VM vm) { ArchitectureType architecture = architectureFamily(vm); if (architecture == null || architecture == ArchitectureType.x86) { return bitWidth(vm.getThreadsPerCpu()) + bitWidth(vm.getCpuPerSocket()) <= maxBitWidth; } return true; } }
public void update(VM vm) { setVisible(vm != null); if (vm == null) { return; } definedMemory.setValue(messages.megabytes(String.valueOf(vm.getVmMemSizeMb()))); minAllocatedMemory.setValue(messages.megabytes(String.valueOf(vm.getMinAllocatedMem()))); cpuInfo.setValue(messages.cpuInfoLabel(vm.getNumOfCpus(), vm.getNumOfSockets(), vm.getCpuPerSocket(), vm.getThreadsPerCpu())); } }
@Override public void numOfSocketChanged() { if (isHotSetCpuSupported()) { int numOfSockets = extractIntFromListModel(getModel().getNumOfSockets()); int coresPerSocket = vm.getCpuPerSocket(); int threadsPerCore = vm.getThreadsPerCpu(); removeCpuListeners(); getModel().getTotalCPUCores().setEntity(Integer.toString(numOfSockets * coresPerSocket * threadsPerCore)); addCpuListeners(); } else { super.numOfSocketChanged(); } }
List<Integer> coresPerSockets = Arrays.asList(new Integer[]{vm.getCpuPerSocket()}); List<Integer> threadsPerCore = Arrays.asList(new Integer[]{vm.getThreadsPerCpu()}); getModel().getCoresPerSocket().setItems(coresPerSockets); getModel().getThreadsPerCore().setSelectedItem(vm.getThreadsPerCpu()); getModel().getCoresPerSocket().setSelectedItem(vm.getCpuPerSocket()); int sockets = totalCpuCores / (vm.getCpuPerSocket() * vm.getThreadsPerCpu()); getModel().getNumOfSockets().setSelectedItem(sockets);
private Container createGeneralItemContainerPanel(Snapshot snapshot, VmSnapshotListModel listModel) { Row content = new Row(); Column column = new Column(ColumnSize.MD_12); content.add(column); DListElement dl = Document.get().createDLElement(); dl.addClassName(DL_HORIZONTAL); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.dateSnapshot()), SafeHtmlUtils.fromString(getCreateDateString(snapshot)), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.statusSnapshot()), SafeHtmlUtils.fromString(snapshot.getStatus().name()), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.memorySnapshot()), SafeHtmlUtils.fromString(String.valueOf(snapshot.containsMemory())), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.descriptionSnapshot()), SafeHtmlUtils.fromTrustedString(getDescription(snapshot)), dl); VM entity = listModel.getEntity(); if (entity != null) { addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.definedMemoryVm()), SafeHtmlUtils.fromString(messages.megabytes(String.valueOf(entity.getVmMemSizeMb()))), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.physMemGauranteedVm()), SafeHtmlUtils.fromString(messages.megabytes(String.valueOf(entity.getMinAllocatedMem()))), dl); addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.numOfCpuCoresVm()), SafeHtmlUtils.fromString(messages.cpuInfoLabel(entity.getNumOfCpus(), entity.getNumOfSockets(), entity.getCpuPerSocket(), entity.getThreadsPerCpu())), dl); } column.getElement().appendChild(dl); return createItemContainerPanel(content); }
vm.getNumOfCpus(), vm.getNumOfSockets(), vm.getCpuPerSocket(), vm.getThreadsPerCpu()));
getvm().getNumOfCpus(), getvm().getNumOfSockets(), getvm().getCpuPerSocket(), getvm().getThreadsPerCpu())); setMonitorCount(getvm().getNumOfMonitors());
vm.getNumOfCpus(), vm.getNumOfSockets(), vm.getCpuPerSocket(), vm.getThreadsPerCpu()));
vm.setBootSequence(instance.getBootSequence()); vm.setClientIp(instance.getClientIp()); vm.setCpuPerSocket(instance.getCpuPerSocket()); vm.setThreadsPerCpu(instance.getThreadsPerCpu()); vm.setCpuSys(instance.getCpuSys());