Search in sources :

Example 1 with ExistingVmInstanceTypeManager

use of org.ovirt.engine.ui.uicommonweb.models.vms.instancetypes.ExistingVmInstanceTypeManager 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())));
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) Arrays(java.util.Arrays) Guid(org.ovirt.engine.core.compat.Guid) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) CommentVmBaseToUnitBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.CommentVmBaseToUnitBuilder) Map(java.util.Map) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) Version(org.ovirt.engine.core.compat.Version) InstanceTypeManager(org.ovirt.engine.ui.uicommonweb.models.vms.instancetypes.InstanceTypeManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) EnumSet(java.util.EnumSet) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VmActionByVmOriginTypeValidator(org.ovirt.engine.core.common.validation.VmActionByVmOriginTypeValidator) VmBase(org.ovirt.engine.core.common.businessentities.VmBase) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) VmNumaNode(org.ovirt.engine.core.common.businessentities.VmNumaNode) NameAndDescriptionVmBaseToUnitBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.NameAndDescriptionVmBaseToUnitBuilder) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) StringHelper(org.ovirt.engine.core.compat.StringHelper) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) CommonCompatibilityVersionUtils(org.ovirt.engine.core.common.utils.CommonCompatibilityVersionUtils) ExistingVmInstanceTypeManager(org.ovirt.engine.ui.uicommonweb.models.vms.instancetypes.ExistingVmInstanceTypeManager) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) CommonVmBaseToUnitBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.CommonVmBaseToUnitBuilder) VMStatus(org.ovirt.engine.core.common.businessentities.VMStatus) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ExistingVmInstanceTypeManager(org.ovirt.engine.ui.uicommonweb.models.vms.instancetypes.ExistingVmInstanceTypeManager) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 EnumSet (java.util.EnumSet)1 List (java.util.List)1 Map (java.util.Map)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VM (org.ovirt.engine.core.common.businessentities.VM)1 VMStatus (org.ovirt.engine.core.common.businessentities.VMStatus)1 VmBase (org.ovirt.engine.core.common.businessentities.VmBase)1 VmNumaNode (org.ovirt.engine.core.common.businessentities.VmNumaNode)1 DiskByDiskAliasComparator (org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)1 ConfigValues (org.ovirt.engine.core.common.config.ConfigValues)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1