use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class GlusterHookMapper method map.
@Mapping(from = GlusterHookEntity.class, to = GlusterHook.class)
public static GlusterHook map(GlusterHookEntity entity, GlusterHook hook) {
GlusterHook model = hook != null ? hook : new GlusterHook();
if (entity.getId() != null) {
model.setId(entity.getId().toString());
}
if (entity.getClusterId() != null) {
model.setCluster(new Cluster());
model.getCluster().setId(entity.getClusterId().toString());
}
if (entity.getHookKey() != null) {
model.setName(entity.getHookKey());
}
if (entity.getGlusterCommand() != null) {
model.setGlusterCommand(entity.getGlusterCommand());
}
if (entity.getStage() != null) {
model.setStage(map(entity.getStage(), null));
}
if (entity.getStatus() != null) {
model.setStatus(mapHookStatus(entity.getStatus()));
}
if (entity.getContentType() != null) {
model.setContentType(map(entity.getContentType(), null));
}
if (entity.getChecksum() != null) {
model.setChecksum(entity.getChecksum());
}
if (entity.getContent() != null) {
model.setContent(entity.getContent());
}
if (entity.getConflictStatus() != null) {
model.setConflictStatus(entity.getConflictStatus());
model.setConflicts(mapConflicts(entity));
}
if (entity.getServerHooks() != null && !entity.getServerHooks().isEmpty()) {
model.setServerHooks(new GlusterServerHooks());
for (GlusterServerHook serverHookEntity : entity.getServerHooks()) {
model.getServerHooks().getGlusterServerHooks().add(map(serverHookEntity));
}
}
return model;
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class VmPoolMapper method map.
@Mapping(from = org.ovirt.engine.core.common.businessentities.VmPool.class, to = VmPool.class)
public static VmPool map(org.ovirt.engine.core.common.businessentities.VmPool entity, VmPool template) {
VmPool model = template != null ? template : new VmPool();
model.setId(entity.getVmPoolId().toString());
model.setName(entity.getName());
model.setDescription(entity.getVmPoolDescription());
model.setComment(entity.getComment());
model.setSize(entity.getAssignedVmsCount());
model.setPrestartedVms(entity.getPrestartedVms());
if (entity.getClusterId() != null || entity.getClusterName() != null) {
model.setCluster(new Cluster());
model.getCluster().setId(entity.getClusterId().toString());
}
model.setMaxUserVms(entity.getMaxAssignedVmsPerUser());
if (StringUtils.isNotBlank(entity.getSpiceProxy())) {
Display display = new Display();
display.setProxy(entity.getSpiceProxy());
model.setDisplay(display);
}
model.setType(map(entity.getVmPoolType(), null));
model.setStateful(entity.isStateful());
model.setAutoStorageSelect(entity.isAutoStorageSelect());
return model;
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class BrickStatisticalQuery method clone.
private GlusterBrick clone(GlusterBrick brick) {
// Needed to avoid NPE in LinkHelper due to unsetting of grandparent in LinkHelper#addLinks.
GlusterBrick cloned = new GlusterBrick();
cloned.setId(brick.getId());
cloned.setGlusterVolume(new GlusterVolume());
cloned.getGlusterVolume().setId(brick.getGlusterVolume().getId());
cloned.getGlusterVolume().setCluster(new Cluster());
cloned.getGlusterVolume().getCluster().setId(brick.getGlusterVolume().getCluster().getId());
return cloned;
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class AbstractBackendCpuProfilesResourceTest method testAddCpuProfile.
@Test
public void testAddCpuProfile() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpClusterQueryExpectations();
setUpCreationExpectations(ActionType.AddCpuProfile, CpuProfileParameters.class, new String[] {}, new Object[] {}, true, true, GUIDS[0], QueryType.GetCpuProfileById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { Guid.Empty }, getEntity(0));
CpuProfile model = getModel(0);
model.setCluster(new Cluster());
model.getCluster().setId(CLUSTER_ID.toString());
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof CpuProfile);
verifyModel((CpuProfile) response.getEntity(), 0);
}
use of org.ovirt.engine.api.model.Cluster in project ovirt-engine by oVirt.
the class BackendExternalVmImportsResourceTest method createVmImport.
private ExternalVmImport createVmImport() {
File file = new File();
file.setId(DRIVERS_ISO);
ExternalVmImport vmImport = new ExternalVmImport();
vmImport.setName(EXTERNAL_VM_NAME);
vmImport.setVm(new Vm());
vmImport.getVm().setName(CREATED_VM_NAME);
vmImport.setCluster(new Cluster());
vmImport.getCluster().setId(CLUSTER_ID.toString());
vmImport.setStorageDomain(new StorageDomain());
vmImport.getStorageDomain().setId(STORAGE_DOMAIN_ID.toString());
vmImport.setHost(new Host());
vmImport.getHost().setId(HOST_ID.toString());
vmImport.setSparse(true);
vmImport.setProvider(ExternalVmProviderType.VMWARE);
vmImport.setDriversIso(file);
vmImport.setUsername(USERNAME);
vmImport.setPassword(PASSWORD);
vmImport.setUrl(VMWARE_URL);
return vmImport;
}
Aggregations