use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class ExistingVmModelBehavior method initialize.
@Override
public void initialize() {
super.initialize();
toggleAutoSetVmHostname();
getModel().getVmInitEnabled().setEntity(getVm().getVmInit() != null);
getModel().getVmInitModel().init(getVm().getStaticData());
getModel().getVmType().setIsChangeable(true);
getModel().getIsSoundcardEnabled().setIsChangeable(true);
getModel().getInstanceTypes().setIsChangeable(!vm.isRunning());
getModel().getLabelList().setIsAvailable(true);
getModel().getVmId().setIsAvailable(true);
getModel().getVmId().setIsChangeable(false);
loadDataCenter();
instanceTypeManager = new ExistingVmInstanceTypeManager(getModel(), vm);
if (vm.getVmPoolId() != null) {
instanceTypeManager.setAlwaysEnabledFieldUpdate(true);
}
Frontend.getInstance().runQuery(QueryType.GetVmNumaNodesByVmId, new IdQueryParameters(vm.getId()), new AsyncQuery<QueryReturnValue>(returnValue -> {
List<VmNumaNode> nodes = returnValue.getReturnValue();
getModel().setVmNumaNodes(nodes);
getModel().updateNodeCount(nodes.size());
}));
// load dedicated host names into host names list
if (getVm().getDedicatedVmForVdsList().size() > 0) {
Frontend.getInstance().runQuery(QueryType.GetAllHostNamesPinnedToVmById, new IdQueryParameters(vm.getId()), asyncQuery((QueryReturnValue returnValue) -> setDedicatedHostsNames((List<String>) returnValue.getReturnValue())));
}
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class AddVmCommand method addVmNumaNodes.
private void addVmNumaNodes() {
List<VmNumaNode> numaNodes = getParameters().getVm().getvNumaNodeList();
if (numaNodes.isEmpty()) {
return;
}
VmNumaNodeOperationParameters params = new VmNumaNodeOperationParameters(getParameters().getVm(), numaNodes);
ActionReturnValue returnValueBase = backend.runInternalAction(ActionType.AddVmNumaNodes, params);
if (!returnValueBase.getSucceeded()) {
auditLogDirector.log(this, AuditLogType.NUMA_ADD_VM_NUMA_NODE_FAILED);
}
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class NumaValidator method validateNumaCompatibility.
/**
* Check if a VM can run on specific hostNumaNodes with the provided numa configuration. The numa nodes for
* validation need to be passed in separately because the numa nodes are not necessarily part of the VM when the
* validation takes place.
*
* @param vm with numa nodes
* @param vmNumaNodes to use for validation
* @param hostNumaNodes from a host
* @return weather the vm can run on the hostNumaNodes or not
*/
public ValidationResult validateNumaCompatibility(final VM vm, final List<VmNumaNode> vmNumaNodes, final List<VdsNumaNode> hostNumaNodes) {
if (hostNumaNodes == null || hostNumaNodes.isEmpty()) {
return new ValidationResult(EngineMessage.VM_NUMA_PINNED_VDS_NODE_EMPTY);
}
if (hostNumaNodes.size() == 1) {
// One node is equal to no NUMA node architecture present
return new ValidationResult(EngineMessage.HOST_NUMA_NOT_SUPPORTED);
}
final HashMap<Integer, VdsNumaNode> hostNodeMap = new HashMap<>();
for (VdsNumaNode hostNumaNode : hostNumaNodes) {
hostNodeMap.put(hostNumaNode.getIndex(), hostNumaNode);
}
boolean memStrict = vm.getNumaTuneMode() == NumaTuneMode.STRICT;
for (VmNumaNode vmNumaNode : vmNumaNodes) {
for (Integer pinnedIndex : vmNumaNode.getVdsNumaNodeList()) {
if (pinnedIndex == null) {
return new ValidationResult(EngineMessage.VM_NUMA_NODE_PINNED_INDEX_ERROR);
}
if (!hostNodeMap.containsKey(pinnedIndex)) {
return new ValidationResult(EngineMessage.VM_NUMA_NODE_HOST_NODE_INVALID_INDEX, String.format("$vdsNodeIndex %d", pinnedIndex));
}
if (memStrict) {
final VdsNumaNode hostNumaNode = hostNodeMap.get(pinnedIndex);
if (vmNumaNode.getMemTotal() > hostNumaNode.getMemTotal()) {
return new ValidationResult(EngineMessage.VM_NUMA_NODE_MEMORY_ERROR);
}
}
}
}
return ValidationResult.VALID;
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class InClusterUpgradeValidator method checkVmReadyForUpgrade.
protected List<String> checkVmReadyForUpgrade(final VM vm) {
requireNonNull(vm);
final List<String> errors = new ArrayList<>();
if (vm.getStatus().isSuspended()) {
errors.addAll(toVmEngineMessage(vm, EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_SUSPENDED));
}
if (!StringUtils.isEmpty(vm.getCpuPinning())) {
errors.addAll(toVmEngineMessage(vm, EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_CPUS_PINNED));
}
for (VmNumaNode vmNumaNode : vm.getvNumaNodeList()) {
if (!vmNumaNode.getVdsNumaNodeList().isEmpty()) {
errors.addAll(toVmEngineMessage(vm, EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_NUMA_PINNED));
break;
}
}
if (MigrationSupport.MIGRATABLE != vm.getMigrationSupport()) {
errors.addAll(toVmEngineMessage(vm, EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_NOT_MIGRATABLE));
}
// TODO use a more efficient way, this does a db call per VM
if (hostDeviceManager.checkVmNeedsDirectPassthrough(vm)) {
errors.addAll(toVmEngineMessage(vm, EngineMessage.CLUSTER_UPGRADE_DETAIL_VM_NEEDS_PASSTHROUGH));
}
return errors;
}
Aggregations