use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmHandlerTest method testValidUpdateOfHostedEngineEditableFieldOnRunningVm.
@Test
public void testValidUpdateOfHostedEngineEditableFieldOnRunningVm() {
// Given
VmStatic src = new VmStatic();
src.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
src.setDescription(RandomUtils.instance().nextString(10));
VmStatic dest = new VmStatic();
dest.setOrigin(OriginType.MANAGED_HOSTED_ENGINE);
dest.setDescription(RandomUtils.instance().nextString(10));
// When
boolean updateIsValid = vmHandler.isUpdateValid(src, dest, VMStatus.Up, false);
// Then
assertTrue("Update should be valid for different descriptions on a running, hosted engine VM", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmHandlerTest method testInValidUpdateOfStatusRestrictedEditableFieldOnRunningVm.
@Test
public void testInValidUpdateOfStatusRestrictedEditableFieldOnRunningVm() {
// Given
VmStatic src = new VmStatic();
src.setSingleQxlPci(true);
VmStatic dest = new VmStatic();
dest.setSingleQxlPci(false);
// When
boolean updateIsValid = vmHandler.isUpdateValid(src, dest, VMStatus.Up, false);
// Then
assertFalse("Update should be invalid for different single QXL PCI statuses on a running VM", updateIsValid);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class ImportVmCommandBase method logImportEvents.
private void logImportEvents() {
// Some values at the OVF file are used for creating events at the GUI
// for the sake of providing information on the content of the VM that
// was exported,
// but not setting it in the imported VM
VmStatic vmStaticFromOvf = getVm().getStaticData();
OvfLogEventHandler<VmStatic> handler = new VMStaticOvfLogHandler(vmStaticFromOvf);
Map<String, String> aliasesValuesMap = handler.getAliasesValuesMap();
if (aliasesValuesMap != null) {
for (Map.Entry<String, String> entry : aliasesValuesMap.entrySet()) {
String fieldName = entry.getKey();
String fieldValue = entry.getValue();
logField(vmStaticFromOvf, fieldName, fieldValue);
}
}
handler.resetDefaults(vmStaticForDefaultValues);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class UpdateConvertedVmCommand method addImportedDevices.
private void addImportedDevices(VM vm) {
VmStatic vmStatic = vm.getStaticData();
// Disk devices were already added
vmStatic.setImages(new ArrayList<>());
importUtils.updateGraphicsDevices(vmStatic, getStoragePool().getCompatibilityVersion());
getVmDeviceUtils().addImportedDevices(vmStatic, false, false);
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmManagementCommandBase method updateParametersVmFromInstanceType.
protected void updateParametersVmFromInstanceType() {
InstanceType instanceType = getInstanceType();
VmStatic vmStatic = getParameters().getVmStaticData();
if (instanceType != null) {
vmStatic.setMemSizeMb(instanceType.getMemSizeMb());
vmStatic.setNumOfSockets(instanceType.getNumOfSockets());
vmStatic.setCpuPerSocket(instanceType.getCpuPerSocket());
vmStatic.setThreadsPerCpu(instanceType.getThreadsPerCpu());
vmStatic.setAutoStartup(instanceType.isAutoStartup());
if (FeatureSupported.isMigrationSupported(getCluster().getArchitecture(), getEffectiveCompatibilityVersion())) {
vmStatic.setMigrationSupport(instanceType.getMigrationSupport());
}
vmStatic.setNumOfIoThreads(instanceType.getNumOfIoThreads());
vmStatic.setMigrationDowntime(instanceType.getMigrationDowntime());
vmStatic.setPriority(instanceType.getPriority());
vmStatic.setTunnelMigration(instanceType.getTunnelMigration());
List<VmDevice> vmDevices = getVmDeviceUtils().getMemoryBalloons(instanceType.getId());
vmStatic.setMinAllocatedMem(instanceType.getMinAllocatedMem());
if (vmDevices.isEmpty()) {
getParameters().setBalloonEnabled(false);
} else if (osRepository.isBalloonEnabled(getParameters().getVmStaticData().getOsId(), getEffectiveCompatibilityVersion())) {
getParameters().setBalloonEnabled(true);
}
vmStatic.setMigrationPolicyId(instanceType.getMigrationPolicyId());
}
}
Aggregations