public void setVm(VM value) { // to make the getVm() use the new value vm = null; vmStatic = value.getStaticData(); }
public AddVmPoolParameters(VmPool vmPool, VM vm, int vmsCount) { super(vmPool); graphicsDevices = new HashMap<>(); this.vmStaticData = vm.getStaticData(); this.vmsCount = vmsCount; }
@Override protected VmBase getVm() { return vm.getStaticData(); }
public OvfOvaVmWriter(VM vm, FullEntityOvfData fullEntityOvfData, Version version, OsRepository osRepository) { super(vm.getStaticData(), fullEntityOvfData.getDiskImages(), version, osRepository); this.vm = vm; }
/** * Computes the maximum allowed number of vCPUs that can be assigned * to a VM according to the specified compatibility level. * * @param vm The VM for which we want to know the maximum * @param compatibilityVersion The compatibility level * @return The maximum supported number of vCPUs */ public static Integer calcMaxVCpu(VM vm, Version compatibilityVersion) { return calcMaxVCpu(vm.getStaticData(), compatibilityVersion, architectureFamily(vm)); }
protected static VM buildVmOnNewTemplate(UnitVmModel model, VM vm) { VM resultVm = new VM(); resultVm.setId(vm.getId()); BuilderExecutor.build(model, resultVm.getStaticData(), new CommonUnitToVmBaseBuilder(), new MultiQueuesVmBaseBuilder()); BuilderExecutor.build(vm.getStaticData(), resultVm.getStaticData(), new VmBaseToVmBaseForTemplateCompositeBaseBuilder()); return resultVm; }
protected static VM buildVmOnNewTemplate(UnitVmModel model, VM vm) { VM resultVm = new VM(); resultVm.setId(vm.getId()); BuilderExecutor.build(model, resultVm.getStaticData(), new CommonUnitToVmBaseBuilder(), new MultiQueuesVmBaseBuilder()); BuilderExecutor.build(vm.getStaticData(), resultVm.getStaticData(), new VmBaseToVmBaseForTemplateCompositeBaseBuilder()); return resultVm; }
protected org.ovirt.engine.core.common.businessentities.VM setUpVm(Guid id) { VmStatic vmStatic = mock(VmStatic.class); when(vmStatic.getId()).thenReturn(id); org.ovirt.engine.core.common.businessentities.VM vm = mock(org.ovirt.engine.core.common.businessentities.VM.class); when(vm.getId()).thenReturn(id); when(vm.getStaticData()).thenReturn(vmStatic); return vm; }
protected org.ovirt.engine.core.common.businessentities.VM getVmEntity() { org.ovirt.engine.core.common.businessentities.VM entity = mock(org.ovirt.engine.core.common.businessentities.VM.class); when(entity.getId()).thenReturn(GUIDS[0]); when(entity.getStaticData()).thenReturn(new VmStatic()); return entity; }
@Mapping(from = VmPool.class, to = VM.class) public static VM map(VmPool model, VM template) { VM entity = template != null ? template : new VM(); entity.setStaticData(map(model, entity.getStaticData())); return entity; }
public static void buildVmOnSave(UnitVmModel model, VM vm) { BuilderExecutor.build(model, vm.getStaticData(), new FullUnitToVmBaseBuilder()); BuilderExecutor.build(model, vm, new VmSpecificUnitToVmBuilder()); }
@Override public void enableSinglePCI(boolean enabled) { super.enableSinglePCI(enabled); if (getInstanceTypeManager() != null) { getInstanceTypeManager().maybeSetSingleQxlPci(vm.getStaticData()); } }
public FullEntityOvfData(VM vm) { this.setVm(vm); this.setVmBase(vm.getStaticData()); this.setClusterName(vm.getClusterName()); }
public VmWithStatusForExclusiveLock(VM vm) { super(vm.getStaticData(), vm.getDynamicData(), vm.getStatisticsData()); setLockInfo(vm.getLockInfo()); }
@Mapping(from = VM.class, to = Cdrom.class) public static Cdrom map(VM entity, Cdrom template) { Cdrom model = template != null ? template : new Cdrom(); model.setId(CDROM_ID.toString()); if (!StringUtils.isEmpty(entity.getStaticData().getIsoPath())) { model.setFile(new File()); model.getFile().setId(entity.getStaticData().getIsoPath()); } return model; }
private void verifyBuiltPoolVm(VM vm) { verifyBuiltCoreVm(vm.getStaticData()); verifyBuiltKernelOptions(vm.getStaticData()); verifyBuiltMigrationOptions(vm.getStaticData()); verifyBuiltVmSpecific(vm); assertEquals(VM_NAME, vm.getName()); assertEquals(USB_POLICY, vm.getUsbPolicy()); assertEquals(HOST_ID, vm.getDedicatedVmForVdsList().get(0)); }
@Override protected void build(Pair<UnitVmModel, VM> source, VmManagementParametersBase destination) { final UnitVmModel newModel = source.getFirst(); final VM oldVm = source.getSecond(); final String newIcon = newModel.getIcon().getEntity().getIcon(); final String originalIcon = IconCache.getInstance().getIcon(oldVm.getStaticData().getLargeIconId()); if (!newIcon.equals(originalIcon) && IconUtils.isCustom(newIcon)) { destination.setVmLargeIcon(newIcon); } } }
@Mapping(from = Cdrom.class, to = VM.class) public static VM map(Cdrom model, VM template) { VM entity = template != null ? template : new VM(); if (model.isSetFile() && model.getFile().isSetId()) { entity.getStaticData().setIsoPath(model.getFile().getId()); } return entity; }
private void edit() { if (getWindow() != null) { return; } VmInterfaceModel model = EditVmInterfaceModel.createInstance(getEntity().getStaticData(), getEntity(), getEntity().getClusterCompatibilityVersion(), (ArrayList<VmNetworkInterface>) getItems(), getSelectedItem(), this); setWindow(model); }
@Test public void testBuildVmOnNewTemplate() { VM vm = VmListModel.buildVmOnNewTemplate(model, origVm); verifyBuiltCommonVm(vm.getStaticData()); verifyBuiltOrigVm(origVm, vm); assertEquals(origVm.getDedicatedVmForVdsList(), vm.getDedicatedVmForVdsList()); assertEquals(origVm.getMigrationSupport(), vm.getMigrationSupport()); assertEquals(origVm.getMigrationDowntime(), vm.getMigrationDowntime()); }