Search in sources :

Example 11 with VmStatic

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

the class VmMapper method map.

public static VmStatic map(VmTemplate entity, VmStatic template, Version version) {
    VmStatic staticVm = template != null ? template : new VmStatic();
    staticVm.setId(Guid.Empty);
    staticVm.setVmtGuid(entity.getId());
    staticVm.setClusterId(entity.getClusterId());
    staticVm.setOsId(entity.getOsId());
    staticVm.setNiceLevel(entity.getNiceLevel());
    staticVm.setCpuShares(entity.getCpuShares());
    staticVm.setFailBack(entity.isFailBack());
    staticVm.setStateless(entity.isStateless());
    staticVm.setDeleteProtected(entity.isDeleteProtected());
    staticVm.setSsoMethod(entity.getSsoMethod());
    staticVm.setVmType(entity.getVmType());
    staticVm.setIsoPath(entity.getIsoPath());
    staticVm.setKernelUrl(entity.getKernelUrl());
    staticVm.setKernelParams(entity.getKernelParams());
    staticVm.setInitrdUrl(entity.getInitrdUrl());
    staticVm.setTimeZone(entity.getTimeZone());
    staticVm.setAllowConsoleReconnect(entity.isAllowConsoleReconnect());
    staticVm.setVncKeyboardLayout(entity.getVncKeyboardLayout());
    staticVm.setVmInit(entity.getVmInit());
    staticVm.setSerialNumberPolicy(entity.getSerialNumberPolicy());
    staticVm.setCustomSerialNumber(entity.getCustomSerialNumber());
    staticVm.setSpiceFileTransferEnabled(entity.isSpiceFileTransferEnabled());
    staticVm.setSpiceCopyPasteEnabled(entity.isSpiceCopyPasteEnabled());
    staticVm.setRunAndPause(entity.isRunAndPause());
    staticVm.setCpuProfileId(entity.getCpuProfileId());
    staticVm.setAutoConverge(entity.getAutoConverge());
    staticVm.setMigrateCompressed(entity.getMigrateCompressed());
    staticVm.setCustomProperties(entity.getCustomProperties());
    staticVm.setCustomEmulatedMachine(entity.getCustomEmulatedMachine());
    staticVm.setCustomCpuName(entity.getCustomCpuName());
    staticVm.setConsoleDisconnectAction(entity.getConsoleDisconnectAction());
    staticVm.setSmallIconId(entity.getSmallIconId());
    staticVm.setLargeIconId(entity.getLargeIconId());
    staticVm.setQuotaId(entity.getQuotaId());
    staticVm.setBootMenuEnabled(entity.isBootMenuEnabled());
    return doMapVmBaseHwPartToVmStatic(entity, staticVm, version);
}
Also used : VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic)

Example 12 with VmStatic

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

the class VmPoolMapper method map.

@Mapping(from = VmPool.class, to = VmStatic.class)
public static VmStatic map(VmPool model, VmStatic template) {
    VmStatic entity = template != null ? template : new VmStatic();
    if (model.getVm() != null) {
        entity = VmMapper.map(model.getVm(), entity);
    }
    entity.setName(model.getName());
    entity.setDescription(model.getDescription());
    if (model.isSetTemplate() && model.getTemplate().isSetId()) {
        entity.setVmtGuid(GuidUtils.asGuid(model.getTemplate().getId()));
    }
    if (model.isSetCluster() && model.getCluster().isSetId()) {
        entity.setClusterId(GuidUtils.asGuid(model.getCluster().getId()));
    }
    if (model.isSetUseLatestTemplateVersion()) {
        entity.setUseLatestVersion(model.isUseLatestTemplateVersion());
    }
    return entity;
}
Also used : VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic)

Example 13 with VmStatic

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

the class AddGraphicsAndVideoDevicesCommand method setVmToNonHeadlessMode.

private void setVmToNonHeadlessMode() {
    VmStatic vmStatic = vmStaticDao.get(getVmBaseId());
    if (vmStatic == null) {
        return;
    }
    if (vmStatic.getDefaultDisplayType() == DisplayType.none) {
        vmStatic.setDefaultDisplayType(DisplayType.qxl);
        resourceManager.getVmManager(getVmBaseId()).update(vmStatic);
    }
    vmDeviceUtils.addVideoDevicesOnlyIfNoVideoDeviceExists(vmStatic);
}
Also used : VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic)

Example 14 with VmStatic

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

the class AddAffinityGroupCommandTest method setup.

@Before
public void setup() {
    command.setCluster(new Cluster());
    VmStatic vmStatic = new VmStatic();
    vmStatic.setClusterId(clusterId);
    vmStatic.setId(vmId);
    doReturn(Collections.singletonList(vmStatic)).when(vmStaticDao).getByIds(any());
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic) Before(org.junit.Before)

Example 15 with VmStatic

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

the class EntityDaoImplTest method testGetEntityNameByIdAndTypeForVM.

@Test
public void testGetEntityNameByIdAndTypeForVM() {
    VmStatic vmStatic = vmStaticDao.get(VM_ID);
    assertNotNull(vmStatic);
    String name = vmStatic.getName();
    assertEquals(name, underTest.getEntityNameByIdAndType(VM_STATIC_GUID, VdcObjectType.VM));
}
Also used : VmStatic(org.ovirt.engine.core.common.businessentities.VmStatic) Test(org.junit.Test)

Aggregations

VmStatic (org.ovirt.engine.core.common.businessentities.VmStatic)87 Test (org.junit.Test)26 Guid (org.ovirt.engine.core.compat.Guid)15 VM (org.ovirt.engine.core.common.businessentities.VM)11 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)9 VmDynamic (org.ovirt.engine.core.common.businessentities.VmDynamic)8 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)8 Label (org.ovirt.engine.core.common.businessentities.Label)7 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)5 HashSet (java.util.HashSet)4 Map (java.util.Map)4 Response (javax.ws.rs.core.Response)4 AddVmTemplateParameters (org.ovirt.engine.core.common.action.AddVmTemplateParameters)4 LabelBuilder (org.ovirt.engine.core.common.businessentities.LabelBuilder)4 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)4 VmStatistics (org.ovirt.engine.core.common.businessentities.VmStatistics)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 PostConstruct (javax.annotation.PostConstruct)3 Before (org.junit.Before)3