use of org.ovirt.engine.core.common.queries.VmIconIdSizePair in project ovirt-engine by oVirt.
the class AddVmCommand method setIconIds.
/**
* Icon processing policy:
* <ul>
* <li>If there is an attached icon, it is used as large icon as base for computation of small icon.
* Predefined icons should not be sent in parameters.</li>
* <li>If there are no icon in parameters && both (small and large) icon ids are set then those ids are used.
* </li>
* <li>Otherwise (at least one icon id is null) both icon ids are copied from template.</li>
* </ul>
*/
private void setIconIds(VmStatic vmStatic) {
if (getParameters().getVmLargeIcon() != null) {
final VmIconIdSizePair iconIds = iconUtils.ensureIconPairInDatabase(getParameters().getVmLargeIcon());
vmStatic.setLargeIconId(iconIds.getLarge());
vmStatic.setSmallIconId(iconIds.getSmall());
} else {
if (vmStatic.getLargeIconId() == null || vmStatic.getSmallIconId() == null) {
vmStatic.setSmallIconId(getVmTemplate().getSmallIconId());
vmStatic.setLargeIconId(getVmTemplate().getLargeIconId());
}
}
}
use of org.ovirt.engine.core.common.queries.VmIconIdSizePair in project ovirt-engine by oVirt.
the class AddVmTemplateCommand method updateVmIcons.
private void updateVmIcons() {
if (getParameters().getVmLargeIcon() != null) {
final VmIconIdSizePair iconIdPair = iconUtils.ensureIconPairInDatabase(getParameters().getVmLargeIcon());
getVmTemplate().setSmallIconId(iconIdPair.getSmall());
getVmTemplate().setLargeIconId(iconIdPair.getLarge());
}
}
use of org.ovirt.engine.core.common.queries.VmIconIdSizePair in project ovirt-engine by oVirt.
the class CommonVmPoolCommand method buildAddVmParameters.
private AddVmParameters buildAddVmParameters(String vmName) {
VmStatic currVm = new VmStatic(getParameters().getVmStaticData());
currVm.setName(vmName);
currVm.setStateless(!getVmPool().isStateful());
if (getParameters().getVmLargeIcon() != null) {
final VmIconIdSizePair iconIds = iconUtils.ensureIconPairInDatabase(getParameters().getVmLargeIcon());
currVm.setSmallIconId(iconIds.getSmall());
currVm.setLargeIconId(iconIds.getLarge());
}
AddVmParameters parameters = new AddVmParameters(currVm);
parameters.setPoolId(getVmPool().getVmPoolId());
if (getVmPool().isAutoStorageSelect()) {
parameters.setDiskInfoDestinationMap(autoSelectTargetDomainAndVolumeFormat());
} else {
parameters.setDiskInfoDestinationMap(diskInfoDestinationMap);
}
if (StringUtils.isEmpty(getParameters().getSessionId())) {
parameters.setParametersCurrentUser(getCurrentUser());
} else {
parameters.setSessionId(getParameters().getSessionId());
}
parameters.setParentCommand(getActionType());
parameters.setParentParameters(getParameters());
// check if device is enabled or we need to override it to true
parameters.setSoundDeviceEnabled(Boolean.TRUE.equals(getParameters().isSoundDeviceEnabled()) || vmDeviceUtils.shouldOverrideSoundDevice(getParameters().getVmStaticData(), getEffectiveCompatibilityVersion(), getParameters().isSoundDeviceEnabled()));
parameters.setConsoleEnabled(getParameters().isConsoleEnabled());
parameters.setVirtioScsiEnabled(getParameters().isVirtioScsiEnabled());
parameters.setBalloonEnabled(getParameters().isBalloonEnabled());
parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED);
VmRngDevice rngDevice = getParameters().getRngDevice();
if (rngDevice != null) {
parameters.setUpdateRngDevice(true);
parameters.setRngDevice(rngDevice);
}
parameters.getGraphicsDevices().putAll(getParameters().getGraphicsDevices());
return parameters;
}
use of org.ovirt.engine.core.common.queries.VmIconIdSizePair in project ovirt-engine by oVirt.
the class IconLoader method setIconsByOs.
private void setIconsByOs(VmBase vmBase) {
final VmIconIdSizePair iconIdPair = getIconIdPairByOsId(vmBase.getOsId());
vmBase.setSmallIconId(iconIdPair.getSmall());
vmBase.setLargeIconId(iconIdPair.getLarge());
}
use of org.ovirt.engine.core.common.queries.VmIconIdSizePair in project ovirt-engine by oVirt.
the class IconLoader method updateVmIconDefaultsTable.
/**
* It recreates 'vm_icon_defaults' table based on new configuration.
*/
private void updateVmIconDefaultsTable() {
vmIconDefaultDao.removeAll();
for (Map.Entry<Integer, VmIconIdSizePair> entry : osIdToIconIdMap.entrySet()) {
final VmIconDefault osDefaultIconIds = new VmIconDefault(Guid.newGuid(), entry.getKey(), entry.getValue().getSmall(), entry.getValue().getLarge());
vmIconDefaultDao.save(osDefaultIconIds);
}
}
Aggregations