use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.
the class AbstractBackendStorageDomainDiskResource method addParents.
@Override
protected Disk addParents(Disk disk) {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(storageDomainId.toString());
StorageDomains storageDomains = new StorageDomains();
storageDomains.getStorageDomains().add(storageDomain);
disk.setStorageDomain(storageDomain);
disk.setStorageDomains(storageDomains);
return disk;
}
use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.
the class BackendStorageDomainDiskResource method addParents.
@Override
protected Disk addParents(Disk disk) {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(storageDomainId.toString());
StorageDomains storageDomains = new StorageDomains();
storageDomains.getStorageDomains().add(storageDomain);
disk.setStorageDomain(storageDomain);
disk.setStorageDomains(storageDomains);
return disk;
}
use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method getModel.
static Disk getModel() {
Disk model = new Disk();
model.setFormat(DiskFormat.COW);
model.setSparse(true);
model.setShareable(false);
model.setPropagateErrors(true);
model.setStorageDomains(new StorageDomains());
model.getStorageDomains().getStorageDomains().add(new StorageDomain());
model.getStorageDomains().getStorageDomains().get(0).setId(GUIDS[2].toString());
model.setProvisionedSize(1000000000L);
return model;
}
use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.
the class BackendVmDisksResourceTest method testAddDiskWithinStorageDomain.
@Test
public void testAddDiskWithinStorageDomain() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpHttpHeaderExpectations("Expect", "201-created");
setUpGetDiskExpectations();
setUpEntityQueryExpectations(QueryType.GetStorageDomainById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[3] }, getStorageDomain(GUIDS[3]));
setUpCreationExpectations(ActionType.AddDisk, AddDiskParameters.class, new String[] { "VmId", "StorageDomainId" }, new Object[] { VM_ID, GUIDS[3] }, true, true, GUIDS[0], asList(GUIDS[3]), asList(new AsyncTaskStatus(AsyncTaskStatusEnum.finished)), QueryType.GetDiskByDiskId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DISK_ID }, asList(getEntity(0)));
Disk model = getModel();
model.setStorageDomains(new StorageDomains());
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(GUIDS[3].toString());
model.getStorageDomains().getStorageDomains().add(storageDomain);
model.setProvisionedSize(1024 * 1024L);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Disk);
verifyModel((Disk) response.getEntity(), 0);
assertNull(((Disk) response.getEntity()).getCreationStatus());
}
use of org.ovirt.engine.api.model.StorageDomains in project ovirt-engine by oVirt.
the class BackendDisksResourceTest method getModel.
static Disk getModel() {
Disk model = new Disk();
model.setProvisionedSize(1024 * 1024L);
model.setFormat(DiskFormat.COW);
model.setSparse(true);
model.setShareable(false);
model.setPropagateErrors(true);
model.setStorageDomains(new StorageDomains());
model.getStorageDomains().getStorageDomains().add(new StorageDomain());
model.getStorageDomains().getStorageDomains().get(0).setId(GUIDS[2].toString());
return model;
}
Aggregations