Search in sources :

Example 6 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class BackendStorageDomainImagesResourceTest method getEntity.

@Override
protected RepoImage getEntity(int index) {
    RepoImage entity = new RepoImage();
    entity.setRepoImageId(GUIDS[index].toString());
    entity.setFileType(ImageFileType.Disk);
    entity.setRepoImageName("RepoImage " + entity.getRepoImageId());
    return entity;
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage)

Example 7 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class RunOnceModel method setIsoImagePath.

public void setIsoImagePath(String isoPath) {
    if ("".equals(isoPath)) {
        // $NON-NLS-1$
        getAttachIso().setEntity(false);
    } else {
        getAttachIso().setEntity(true);
        RepoImage iso = new RepoImage(isoPath);
        getIsoImage().setSelectedItem(iso);
    }
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage)

Example 8 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class NewVmModelBehavior method selectedTemplateChanged.

private void selectedTemplateChanged(final VmTemplate template) {
    // Copy VM parameters from template.
    buildModel(template, (source, destination) -> {
        setSelectedOSType(template, getModel().getSelectedCluster().getArchitecture());
        doChangeDefaultHost(template.getDedicatedVmForVdsList());
        if (updateStatelessFlag) {
            getModel().getIsStateless().setEntity(template.isStateless());
        }
        updateStatelessFlag = true;
        getModel().getIsRunAndPause().setEntity(template.isRunAndPause());
        boolean hasCd = !StringHelper.isNullOrEmpty(template.getIsoPath());
        getModel().getCdImage().setIsChangeable(hasCd);
        getModel().getCdAttached().setEntity(hasCd);
        if (hasCd) {
            RepoImage currentCD = getModel().getCdImage().getItems().stream().filter(i -> i.getRepoImageId().equals(template.getIsoPath())).findFirst().orElse(null);
            getModel().getCdImage().setSelectedItem(currentCD);
        }
        updateTimeZone(template.getTimeZone());
        if (!template.getId().equals(Guid.Empty)) {
            getModel().getStorageDomain().setIsChangeable(true);
            getModel().getProvisioning().setIsChangeable(true);
            getModel().getCopyPermissions().setIsAvailable(true);
            initDisks();
        } else {
            getModel().getStorageDomain().setIsChangeable(false);
            getModel().getProvisioning().setIsChangeable(false);
            getModel().getCopyPermissions().setIsAvailable(false);
            getModel().setDisks(null);
            getModel().setIsDisksAvailable(false);
            getModel().getInstanceImages().setIsChangeable(true);
        }
        getModel().getAllowConsoleReconnect().setEntity(template.isAllowConsoleReconnect());
        getModel().getVmType().setSelectedItem(template.getVmType());
        getModel().getUsbPolicy().setSelectedItem(template.getUsbPolicy());
        updateRngDevice(template.getId());
        initStorageDomains();
        InstanceType selectedInstanceType = getModel().getInstanceTypes().getSelectedItem();
        int instanceTypeMinAllocatedMemory = selectedInstanceType != null ? selectedInstanceType.getMinAllocatedMem() : 0;
        // do not update if specified on template or instance type
        if (template.getMinAllocatedMem() == 0 && instanceTypeMinAllocatedMemory == 0) {
            updateMinAllocatedMemory();
        }
        updateQuotaByCluster(template.getQuotaId(), template.getQuotaName());
        getModel().getCustomPropertySheet().deserialize(template.getCustomProperties());
        getModel().getVmInitModel().init(template);
        getModel().getVmInitEnabled().setEntity(template.getVmInit() != null);
        if (getModel().getSelectedCluster() != null) {
            updateCpuProfile(getModel().getSelectedCluster().getId(), template.getCpuProfileId());
        }
        provisioning_SelectedItemChanged();
        updateMigrationForLocalSD();
        // A workaround for setting the current saved CustomCompatibilityVersion value after
        // it was reset by getTemplateWithVersion event
        getModel().getCustomCompatibilityVersion().setSelectedItem(getSavedCurrentCustomCompatibilityVersion());
        setCustomCompatibilityVersionChangeInProgress(false);
        updateLeaseStorageDomains(template.getLeaseStorageDomainId());
    });
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType)

Example 9 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class PoolModelBehaviorBase method setImagesToModel.

@Override
protected void setImagesToModel(UnitVmModel model, List<RepoImage> images) {
    if (getModel().getTemplateWithVersion().getSelectedItem() == null) {
        return;
    }
    VmTemplate template = getModel().getTemplateWithVersion().getSelectedItem().getTemplateVersion();
    model.getCdImage().setItems(images);
    if (!StringHelper.isNullOrEmpty(template.getIsoPath())) {
        RepoImage oldCdImage = images.stream().filter(i -> i.getRepoImageId().equals(template.getIsoPath())).findFirst().orElse(null);
        model.getCdImage().setSelectedItem(oldCdImage);
    }
}
Also used : RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 10 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class BaseVmListModelTest method setUpUnitVmModelExpectations.

protected void setUpUnitVmModelExpectations(UnitVmModel model) {
    when(model.getVmType().getSelectedItem()).thenReturn(VM_TYPE);
    VmTemplate template = new VmTemplate();
    template.setId(TEMPLATE_GUID);
    TemplateWithVersion templateWithVersion = mock(TemplateWithVersion.class);
    when(templateWithVersion.getTemplateVersion()).thenReturn(template);
    when(model.getTemplateWithVersion().getSelectedItem()).thenReturn(templateWithVersion);
    when(model.getName().getEntity()).thenReturn(VM_NAME);
    InstanceType instanceType = new VmTemplate();
    instanceType.setId(INSTANCE_TYPE_ID);
    when(model.getInstanceTypes().getSelectedItem()).thenReturn(instanceType);
    when(model.getOSType().getSelectedItem()).thenReturn(OS_TYPE);
    when(model.getNumOfMonitors().getSelectedItem()).thenReturn(NUM_OF_MONITORS);
    when(model.getDescription().getEntity()).thenReturn(DESCRIPTION);
    when(model.getComment().getEntity()).thenReturn(COMMENT);
    when(model.getEmulatedMachine().getSelectedItem()).thenReturn(EMULATED_MACHINE);
    when(model.getCustomCpu().getSelectedItem()).thenReturn(CUSTOM_CPU_NAME);
    when(model.getMemSize().getEntity()).thenReturn(MEM_SIZE);
    when(model.getMaxMemorySize().getEntity()).thenReturn(MAX_MEMORY_SIZE);
    when(model.getMinAllocatedMemory().getEntity()).thenReturn(MIN_MEM);
    when(model.getSelectedCluster().getId()).thenReturn(CLUSTER_ID);
    ListModel<TimeZoneModel> timeZoneModelListModel = mockTimeZoneListModel();
    when(model.getTimeZone()).thenReturn(timeZoneModelListModel);
    when(model.getNumOfSockets().getSelectedItem()).thenReturn(NUM_OF_SOCKETS);
    when(model.getCoresPerSocket().getSelectedItem()).thenReturn(CORES_PER_SOCKET);
    when(model.getThreadsPerCore().getSelectedItem()).thenReturn(THREADS_PER_CORE);
    SerialNumberPolicyModel serialNumberPolicyModel = mockSerialNumberPolicyModel();
    when(model.getSerialNumberPolicy()).thenReturn(serialNumberPolicyModel);
    when(model.getAllowConsoleReconnect().getEntity()).thenReturn(true);
    when(model.getIsSingleQxlEnabled().getEntity()).thenReturn(true);
    when(model.getTotalCPUCores().getEntity()).thenReturn(Integer.toString(TOTAL_CPU));
    when(model.getUsbPolicy().getSelectedItem()).thenReturn(USB_POLICY);
    when(model.getIsStateless().getEntity()).thenReturn(true);
    when(model.getIsSmartcardEnabled().getEntity()).thenReturn(true);
    when(model.getIsDeleteProtected().getEntity()).thenReturn(true);
    when(model.extractSelectedSsoMethod()).thenReturn(SSO_METHOD);
    when(model.getBootSequence()).thenReturn(BOOT_SEQUENCE);
    ListModel<RepoImage> cdListModel = mockCdListModel();
    when(model.getCdImage()).thenReturn(cdListModel);
    when(model.getIsHighlyAvailable().getEntity()).thenReturn(true);
    when(model.getInitrd_path().getEntity()).thenReturn(INITRD_PATH);
    when(model.getKernel_path().getEntity()).thenReturn(KERNEL_PATH);
    when(model.getKernel_parameters().getEntity()).thenReturn(KERNEL_PARAMS);
    when(model.getCustomPropertySheet().serialize()).thenReturn(CUSTOM_PROPERTIES);
    ListModel<Quota> quotaListModel = mockQuotaListModel();
    when(model.getQuota()).thenReturn(quotaListModel);
    when(model.getVncKeyboardLayout().getSelectedItem()).thenReturn(VNC_KEYBOARD_LAYOUT);
    when(model.getDisplayType().getSelectedItem()).thenReturn(DISPLAY_TYPE);
    EntityModel<Integer> priorityEntityModel = mockEntityModel(PRIORITY);
    when(model.getPriority().getSelectedItem()).thenReturn(priorityEntityModel);
    when(model.getIsRunAndPause().getEntity()).thenReturn(true);
    VDS defaultHost = new VDS();
    defaultHost.setId(HOST_ID);
    when(model.getDefaultHost().getSelectedItem()).thenReturn(defaultHost);
    when(model.getDefaultHost().getSelectedItems()).thenReturn(Collections.singletonList(defaultHost));
    when(model.getIsAutoAssign().getEntity()).thenReturn(false);
    when(model.getMigrationMode().getSelectedItem()).thenReturn(MIGRATION_SUPPORT);
    when(model.getSelectedMigrationDowntime()).thenReturn(MIGRATION_DOWNTIME);
    when(model.getBootMenuEnabled().getEntity()).thenReturn(true);
    when(model.getSpiceFileTransferEnabled().getEntity()).thenReturn(true);
    when(model.getSpiceCopyPasteEnabled().getEntity()).thenReturn(true);
    ListModel<CpuProfile> cpuProfiles = mockCpuProfiles();
    when(model.getCpuProfiles()).thenReturn(cpuProfiles);
    when(model.getNumaNodeCount().getEntity()).thenReturn(0);
    when(model.getNumaTuneMode().getSelectedItem()).thenReturn(NumaTuneMode.INTERLEAVE);
    when(model.getAutoConverge().getSelectedItem()).thenReturn(true);
    when(model.getMigrateCompressed().getSelectedItem()).thenReturn(true);
    when(model.getIcon().getEntity()).thenReturn(new IconWithOsDefault(LARGE_ICON_DATA, LARGE_OS_DEFAULT_ICON_DATA, SMALL_ICON_ID, ValidationResult.ok()));
    when(model.getIoThreadsEnabled().getEntity()).thenReturn(true);
    when(model.getConsoleDisconnectAction().getSelectedItem()).thenReturn(ConsoleDisconnectAction.REBOOT);
    when(model.getCustomCompatibilityVersion().getSelectedItem()).thenReturn(Version.v3_6);
    when(model.getOverrideMigrationPolicy().getEntity()).thenReturn(false);
    when(model.getLease().getSelectedItem()).thenReturn(null);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) TemplateWithVersion(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateWithVersion) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) Quota(org.ovirt.engine.core.common.businessentities.Quota) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) InstanceType(org.ovirt.engine.core.common.businessentities.InstanceType)

Aggregations

RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)41 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)5 Guid (org.ovirt.engine.core.compat.Guid)5 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 InstanceType (org.ovirt.engine.core.common.businessentities.InstanceType)3 Quota (org.ovirt.engine.core.common.businessentities.Quota)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 NullSafeRenderer (org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Lock (java.util.concurrent.locks.Lock)2 ReentrantLock (java.util.concurrent.locks.ReentrantLock)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)2 ListModelTypeAheadChangeableListBoxEditor (org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadChangeableListBoxEditor)2 VncKeyMapRenderer (org.ovirt.engine.ui.common.widget.editor.VncKeyMapRenderer)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2