Search in sources :

Example 46 with StorageDomain

use of org.ovirt.engine.api.model.StorageDomain 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;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) ExternalVmImport(org.ovirt.engine.api.model.ExternalVmImport) Vm(org.ovirt.engine.api.model.Vm) Cluster(org.ovirt.engine.api.model.Cluster) Host(org.ovirt.engine.api.model.Host) File(org.ovirt.engine.api.model.File)

Example 47 with StorageDomain

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

the class StorageDomainLeaseMapper method map.

public static StorageDomainLease map(Guid storageDomainId) {
    if (storageDomainId != null) {
        StorageDomain storageDomain = new StorageDomain();
        storageDomain.setId(storageDomainId.toString());
        StorageDomainLease lease = new StorageDomainLease();
        lease.setStorageDomain(storageDomain);
        return lease;
    }
    return null;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) StorageDomainLease(org.ovirt.engine.api.model.StorageDomainLease)

Example 48 with StorageDomain

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

the class QuotaMapper method map.

private static void map(QuotaStorageLimit model, QuotaStorage quotaStorage, String storageDomainId, String dataCenterId, String quotaId) {
    model.setQuota(new Quota());
    model.getQuota().setId(quotaId);
    model.getQuota().setDataCenter(new DataCenter());
    model.getQuota().getDataCenter().setId(dataCenterId);
    if (storageDomainId != null) {
        model.setStorageDomain(new StorageDomain());
        model.getStorageDomain().setId(storageDomainId);
    }
    if (quotaStorage.getStorageSizeGB() != null) {
        model.setLimit(quotaStorage.getStorageSizeGB());
    }
    if (quotaStorage.getStorageSizeGBUsage() != null) {
        model.setUsage(quotaStorage.getStorageSizeGBUsage());
    }
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) DataCenter(org.ovirt.engine.api.model.DataCenter) Quota(org.ovirt.engine.api.model.Quota)

Example 49 with StorageDomain

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

the class LinkHelperTest method testFileLinks.

@Test
public void testFileLinks() throws Exception {
    File file = new File();
    file.setId(FILE_ID);
    file.setStorageDomain(new StorageDomain());
    file.getStorageDomain().setId(STORAGE_DOMAIN_ID);
    LinkHelper.addLinks(file);
    assertEquals(FILE_HREF, file.getHref());
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) File(org.ovirt.engine.api.model.File) Test(org.junit.Test)

Example 50 with StorageDomain

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

the class LinkHelperTest method testStorageDomainLinks.

@Test
public void testStorageDomainLinks() throws Exception {
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(STORAGE_DOMAIN_ID);
    storageDomain.setStorage(new HostStorage());
    storageDomain.getStorage().setPath("foo");
    LinkHelper.addLinks(storageDomain);
    assertEquals(STORAGE_DOMAIN_HREF, storageDomain.getHref());
    assertNull(storageDomain.getStorage().getHref());
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) HostStorage(org.ovirt.engine.api.model.HostStorage) Test(org.junit.Test)

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