use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class VmBaseMapper method mapVmBaseEntityToModel.
/**
* Common for VM and template
*/
protected static void mapVmBaseEntityToModel(VmBase model, org.ovirt.engine.core.common.businessentities.VmBase entity) {
mapCommonEntityToModel(model, entity);
model.setComment(entity.getComment());
if (entity.getClusterId() != null) {
Cluster cluster = new Cluster();
cluster.setId(entity.getClusterId().toString());
model.setCluster(cluster);
}
if (entity.getVmType() != null) {
model.setType(mapVmType(entity.getVmType()));
}
if (entity.getResumeBehavior() != null) {
model.setStorageErrorResumeBehaviour(mapResumeBehavior(entity.getResumeBehavior()));
}
if (entity.getOrigin() != null) {
model.setOrigin(map(entity.getOrigin(), null));
}
model.setBios(new Bios());
model.getBios().setBootMenu(new BootMenu());
model.getBios().getBootMenu().setEnabled(entity.isBootMenuEnabled());
if (entity.getTimeZone() != null) {
model.setTimeZone(new TimeZone());
model.getTimeZone().setName(entity.getTimeZone());
}
if (entity.getVmInit() != null && entity.getVmInit().getDomain() != null && StringUtils.isNotBlank(entity.getVmInit().getDomain())) {
Domain domain = new Domain();
domain.setName(entity.getVmInit().getDomain());
model.setDomain(domain);
}
model.setStateless(entity.isStateless());
model.setDeleteProtected(entity.isDeleteProtected());
model.setSso(SsoMapper.map(entity.getSsoMethod(), null));
model.setTunnelMigration(entity.getTunnelMigration());
if (entity.getSerialNumberPolicy() != null) {
model.setSerialNumber(SerialNumberMapper.map(entity, null));
}
model.setStartPaused(entity.isRunAndPause());
if (entity.getCpuProfileId() != null) {
CpuProfile cpuProfile = new CpuProfile();
cpuProfile.setId(entity.getCpuProfileId().toString());
model.setCpuProfile(cpuProfile);
}
if (!StringUtils.isEmpty(entity.getCustomProperties())) {
CustomProperties hooks = new CustomProperties();
hooks.getCustomProperties().addAll(CustomPropertiesParser.parse(entity.getCustomProperties(), false));
model.setCustomProperties(hooks);
}
model.setCpuShares(entity.getCpuShares());
if (entity.getLargeIconId() != null) {
if (!model.isSetLargeIcon()) {
model.setLargeIcon(new Icon());
}
model.getLargeIcon().setId(entity.getLargeIconId().toString());
}
if (entity.getSmallIconId() != null) {
if (!model.isSetSmallIcon()) {
model.setSmallIcon(new Icon());
}
model.getSmallIcon().setId(entity.getSmallIconId().toString());
}
if (entity.getQuotaId() != null) {
Quota quota = new Quota();
quota.setId(entity.getQuotaId().toString());
model.setQuota(quota);
}
model.setLease(StorageDomainLeaseMapper.map(entity.getLeaseStorageDomainId()));
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class PermissionMapper method setObjectId.
/**
* Completeness of "{entityType}.id" already validated
*/
private static void setObjectId(Permission model, org.ovirt.engine.core.common.businessentities.Permission entity) {
String id = entity.getObjectId().toString();
switch(entity.getObjectType()) {
case System:
break;
case StoragePool:
model.setDataCenter(new DataCenter());
model.getDataCenter().setId(id);
break;
case Cluster:
model.setCluster(new Cluster());
model.getCluster().setId(id);
break;
case VDS:
model.setHost(new Host());
model.getHost().setId(id);
break;
case Storage:
model.setStorageDomain(new StorageDomain());
model.getStorageDomain().setId(id);
break;
case VM:
model.setVm(new Vm());
model.getVm().setId(id);
break;
case VmPool:
model.setVmPool(new VmPool());
model.getVmPool().setId(id);
break;
case VmTemplate:
model.setTemplate(new Template());
model.getTemplate().setId(id);
break;
case Disk:
model.setDisk(new Disk());
model.getDisk().setId(id);
break;
default:
assert false;
}
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class QuotaMapper method map.
private static void map(QuotaClusterLimit template, QuotaCluster quotaCluster, String clusterId, String dataCenterId, String quotaId) {
template.setQuota(new Quota());
template.getQuota().setId(quotaId);
template.getQuota().setDataCenter(new DataCenter());
template.getQuota().getDataCenter().setId(dataCenterId);
if (clusterId != null) {
template.setCluster(new Cluster());
template.getCluster().setId(clusterId);
}
if (quotaCluster.getMemSizeMB() != null) {
// show GB instead of MB (ignore -1)
double value = quotaCluster.getMemSizeMB() == -1 ? quotaCluster.getMemSizeMB().doubleValue() : quotaCluster.getMemSizeMB().doubleValue() / 1024.0;
template.setMemoryLimit(value);
}
if (quotaCluster.getMemSizeMBUsage() != null) {
template.setMemoryUsage(quotaCluster.getMemSizeMBUsage() / 1024.0);
}
if (quotaCluster.getVirtualCpu() != null) {
template.setVcpuLimit(quotaCluster.getVirtualCpu());
}
if (quotaCluster.getVirtualCpuUsage() != null) {
template.setVcpuUsage(quotaCluster.getVirtualCpuUsage());
}
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class BackendGlusterVolumesResource method addParents.
@Override
protected GlusterVolume addParents(GlusterVolume volume) {
volume.setCluster(new Cluster());
volume.getCluster().setId(clusterId);
return volume;
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class BackendVmPoolsResourceTest method getModel.
private VmPool getModel(int index) {
VmPool model = new VmPool();
model.setName(NAMES[index]);
model.setDescription(DESCRIPTIONS[index]);
model.setId(GUIDS[index].toString());
model.setCluster(new Cluster());
model.getCluster().setId(GUIDS[2].toString());
model.setTemplate(new Template());
model.getTemplate().setId(GUIDS[1].toString());
return model;
}
Aggregations