Search in sources :

Example 1 with StorageDomains

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains)

Example 2 with StorageDomains

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains)

Example 3 with StorageDomains

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains) Disk(org.ovirt.engine.api.model.Disk)

Example 4 with StorageDomains

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());
}
Also used : Response(javax.ws.rs.core.Response) StorageDomain(org.ovirt.engine.api.model.StorageDomain) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) StorageDomains(org.ovirt.engine.api.model.StorageDomains) Disk(org.ovirt.engine.api.model.Disk) Test(org.junit.Test)

Example 5 with StorageDomains

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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomains(org.ovirt.engine.api.model.StorageDomains) Disk(org.ovirt.engine.api.model.Disk)

Aggregations

StorageDomains (org.ovirt.engine.api.model.StorageDomains)12 StorageDomain (org.ovirt.engine.api.model.StorageDomain)9 Disk (org.ovirt.engine.api.model.Disk)5 Statistics (org.ovirt.engine.api.model.Statistics)2 Vms (org.ovirt.engine.api.model.Vms)2 Response (javax.ws.rs.core.Response)1 Test (org.junit.Test)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 DiskProfile (org.ovirt.engine.api.model.DiskProfile)1 DiskSnapshot (org.ovirt.engine.api.model.DiskSnapshot)1 OpenStackVolumeType (org.ovirt.engine.api.model.OpenStackVolumeType)1 Quota (org.ovirt.engine.api.model.Quota)1 Snapshot (org.ovirt.engine.api.model.Snapshot)1 V3Disk (org.ovirt.engine.api.v3.types.V3Disk)1 V3DiskSnapshot (org.ovirt.engine.api.v3.types.V3DiskSnapshot)1 V3StorageDomains (org.ovirt.engine.api.v3.types.V3StorageDomains)1 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)1 Guid (org.ovirt.engine.core.compat.Guid)1