use of org.ovirt.engine.core.common.businessentities.ImageType in project ovirt-engine by oVirt.
the class VmTemplateDaoTest method testGetImageType.
/**
* Ensures that the template returned is image type.
*/
@Test
public void testGetImageType() {
ImageType result = dao.getImageType(EXISTING_IMAGE_TYPE_ID);
assertNotNull(result);
assertEquals(EXISTING_IMAGE_TYPE_ID, result.getId());
}
use of org.ovirt.engine.core.common.businessentities.ImageType in project ovirt-engine by oVirt.
the class AddVmCommand method updateVmObject.
/**
* This method override vm values with the instance type values
* in case instance type is selected for this vm
*/
private void updateVmObject() {
updateParametersVmFromInstanceType();
// set vm interface source id to be the instance type, vm interface are taken from it
if (getInstanceType() != null) {
vmInterfacesSourceId = getInstanceTypeId();
}
VmStatic vmStatic = getParameters().getVmStaticData();
ImageType imageType = getImageType();
if (imageType != null) {
vmStatic.setOsId(imageType.getOsId());
vmStatic.setIsoPath(imageType.getIsoPath());
vmStatic.setInitrdUrl(imageType.getInitrdUrl());
vmStatic.setKernelUrl(imageType.getKernelUrl());
vmStatic.setKernelParams(imageType.getKernelParams());
// set vm disks source to be the image type, vm disks are taken from it
vmDisksSource = (VmTemplate) imageType;
}
// Choose a proper default OS according to the cluster architecture
if (getParameters().getVmStaticData().getOsId() == OsRepository.AUTO_SELECT_OS) {
if (getCluster().getArchitecture() != ArchitectureType.undefined) {
Integer defaultOs = osRepository.getDefaultOSes().get(getCluster().getArchitecture());
getParameters().getVmStaticData().setOsId(defaultOs);
}
}
vmHandler.autoSelectUsbPolicy(getParameters().getVmStaticData());
// Choose a proper default display type according to the cluster architecture
vmHandler.autoSelectDefaultDisplayType(vmDevicesSourceId, getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices());
// If not set by user, choose proper graphics device according to the cluster architecture
vmHandler.autoSelectGraphicsDevice(vmDevicesSourceId, getParameters().getVmStaticData(), getCluster(), getParameters().getGraphicsDevices(), getEffectiveCompatibilityVersion());
}