Search in sources :

Example 56 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class BackendStorageDomainDiskSnapshotsResource method mapCollection.

protected DiskSnapshots mapCollection(List<Disk> entities) {
    DiskSnapshots collection = new DiskSnapshots();
    for (Disk disk : entities) {
        DiskSnapshot diskSnapshot = getMapper(Disk.class, DiskSnapshot.class).map(disk, null);
        // this code generates back-link to the corresponding SD
        diskSnapshot.setStorageDomain(new StorageDomain());
        diskSnapshot.getStorageDomain().setId(this.storageDomainId.toString());
        collection.getDiskSnapshots().add(addLinks(populate(diskSnapshot, disk)));
    }
    return collection;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) DiskSnapshots(org.ovirt.engine.api.model.DiskSnapshots) DiskSnapshot(org.ovirt.engine.api.model.DiskSnapshot) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 57 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class LinkHelperTest method testStorageDomainTemplateLinks.

@Test
public void testStorageDomainTemplateLinks() throws Exception {
    Template template = new Template();
    template.setId(TEMPLATE_ID);
    template.setStorageDomain(new StorageDomain());
    template.getStorageDomain().setId(STORAGE_DOMAIN_ID);
    template = LinkHelper.addLinks(template);
    assertEquals(STORAGE_DOMAIN_TEMPLATE_HREF, template.getHref());
    assertEquals(STORAGE_DOMAIN_HREF, template.getStorageDomain().getHref());
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) Template(org.ovirt.engine.api.model.Template) Test(org.junit.Test)

Example 58 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class LinkHelperTest method testAttachedStorageDomainLinks.

@Test
public void testAttachedStorageDomainLinks() throws Exception {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(STORAGE_DOMAIN_ID);
    storageDomain.setDataCenter(new DataCenter());
    storageDomain.getDataCenter().setId(DATA_CENTER_ID);
    LinkHelper.addLinks(storageDomain);
    assertEquals(ATTACHED_STORAGE_DOMAIN_HREF, storageDomain.getHref());
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) DataCenter(org.ovirt.engine.api.model.DataCenter) Test(org.junit.Test)

Example 59 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class LinkHelperTest method testStorageDomainVmLinks.

@Test
public void testStorageDomainVmLinks() throws Exception {
    Vm vm = new Vm();
    vm.setId(VM_ID);
    vm.setStorageDomain(new StorageDomain());
    vm.getStorageDomain().setId(STORAGE_DOMAIN_ID);
    vm = LinkHelper.addLinks(vm);
    assertEquals(STORAGE_DOMAIN_VM_HREF, vm.getHref());
    assertEquals(STORAGE_DOMAIN_HREF, vm.getStorageDomain().getHref());
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Example 60 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.

the class AbstractBackendStorageDomainContentsResource method getStorageDomainModel.

public StorageDomain getStorageDomainModel() {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(storageDomainId.toString());
    return storageDomain;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain)

Aggregations

StorageDomain (org.ovirt.engine.api.model.StorageDomain)88 Test (org.junit.Test)41 WebApplicationException (javax.ws.rs.WebApplicationException)14 Action (org.ovirt.engine.api.model.Action)14 Response (javax.ws.rs.core.Response)13 Host (org.ovirt.engine.api.model.Host)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 Disk (org.ovirt.engine.api.model.Disk)9 StorageDomains (org.ovirt.engine.api.model.StorageDomains)9 BackendStorageDomainVmsResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmsResourceTest.setUpStorageDomain)8 HostStorage (org.ovirt.engine.api.model.HostStorage)6 BackendStorageDomainTemplatesResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain)6 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)6 DataCenter (org.ovirt.engine.api.model.DataCenter)5 Vm (org.ovirt.engine.api.model.Vm)5 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)5 Guid (org.ovirt.engine.core.compat.Guid)5 DiskProfile (org.ovirt.engine.api.model.DiskProfile)4 ExportRepoImageParameters (org.ovirt.engine.core.common.action.ExportRepoImageParameters)4 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)4