use of org.ovirt.engine.api.model.Qos in project ovirt-engine by oVirt.
the class CpuProfileMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.profiles.CpuProfile.class, to = CpuProfile.class)
public static CpuProfile map(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile entity, CpuProfile template) {
CpuProfile model = template != null ? template : new CpuProfile();
if (entity.getId() != null) {
model.setId(entity.getId().toString());
}
if (entity.getName() != null) {
model.setName(entity.getName());
}
if (entity.getDescription() != null) {
model.setDescription(entity.getDescription());
}
if (entity.getClusterId() != null) {
model.setCluster(new Cluster());
model.getCluster().setId(entity.getClusterId().toString());
}
if (entity.getQosId() != null) {
model.setQos(new Qos());
model.getQos().setId(entity.getQosId().toString());
}
return model;
}
use of org.ovirt.engine.api.model.Qos in project ovirt-engine by oVirt.
the class DiskProfileMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.profiles.DiskProfile.class, to = DiskProfile.class)
public static DiskProfile map(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile entity, DiskProfile template) {
DiskProfile model = template != null ? template : new DiskProfile();
if (entity.getId() != null) {
model.setId(entity.getId().toString());
}
if (entity.getName() != null) {
model.setName(entity.getName());
}
if (entity.getDescription() != null) {
model.setDescription(entity.getDescription());
}
if (entity.getStorageDomainId() != null) {
model.setStorageDomain(new StorageDomain());
model.getStorageDomain().setId(entity.getStorageDomainId().toString());
}
if (entity.getQosId() != null) {
model.setQos(new Qos());
model.getQos().setId(entity.getQosId().toString());
}
return model;
}
use of org.ovirt.engine.api.model.Qos in project ovirt-engine by oVirt.
the class VnicProfileMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.network.VnicProfile.class, to = VnicProfile.class)
public static VnicProfile map(org.ovirt.engine.core.common.businessentities.network.VnicProfile entity, VnicProfile template) {
VnicProfile model = template != null ? template : new VnicProfile();
if (entity.getId() != null) {
model.setId(entity.getId().toString());
}
if (entity.getName() != null) {
model.setName(entity.getName());
}
if (entity.getDescription() != null) {
model.setDescription(entity.getDescription());
}
if (entity.getNetworkId() != null) {
model.setNetwork(new Network());
model.getNetwork().setId(entity.getNetworkId().toString());
}
model.setPortMirroring(entity.isPortMirroring());
if (entity.getCustomProperties() != null && !entity.getCustomProperties().isEmpty()) {
CustomProperties hooks = new CustomProperties();
hooks.getCustomProperties().addAll(CustomPropertiesParser.parse(DevicePropertiesUtils.getInstance().convertProperties(entity.getCustomProperties()), false));
model.setCustomProperties(hooks);
}
if (entity.getNetworkQosId() != null) {
model.setQos(new Qos());
model.getQos().setId(entity.getNetworkQosId().toString());
}
final VnicPassThrough vnicPassThrough = new VnicPassThrough();
vnicPassThrough.setMode(map(entity.isPassthrough()));
model.setPassThrough(vnicPassThrough);
if (entity.getNetworkFilterId() != null) {
model.setNetworkFilter(new NetworkFilter());
model.getNetworkFilter().setId(entity.getNetworkFilterId().toString());
}
if (entity.isPassthrough()) {
model.setMigratable(entity.isMigratable());
}
return model;
}
use of org.ovirt.engine.api.model.Qos in project ovirt-engine by oVirt.
the class HostNicMapperTest method postPopulate.
@Override
protected HostNic postPopulate(HostNic model) {
HostNic hostNIC = super.postPopulate(model);
Qos qos = hostNIC.getQos();
qos.setType(QosType.HOSTNETWORK);
qos.setName(null);
qos.setDataCenter(null);
model.setBootProtocol(MappingTestHelper.shuffle(BootProtocol.class, BootProtocol.AUTOCONF));
return hostNIC;
}
use of org.ovirt.engine.api.model.Qos in project ovirt-engine by oVirt.
the class AbstractBackendCpuProfilesResource method mapCollection.
protected CpuProfiles mapCollection(List<org.ovirt.engine.core.common.businessentities.profiles.CpuProfile> entities) {
CpuProfiles collection = new CpuProfiles();
Map<Guid, Qos> qosMap = new HashMap<>();
for (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile entity : entities) {
CpuProfile profile = populate(map(entity), entity);
collection.getCpuProfiles().add(profile);
if (entity.getQosId() != null) {
qosMap.put(entity.getQosId(), profile.getQos());
}
}
handleQosDataCenterLinks(qosMap);
for (CpuProfile cpuProfile : collection.getCpuProfiles()) {
addLinks(cpuProfile);
}
return collection;
}
Aggregations