use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainDiskResource method get.
@Override
public Disk get() {
Disk disk;
boolean unregistered = ParametersHelper.getBooleanParameter(httpHeaders, uriInfo, UNREGISTERED_CONSTRAINT_PARAMETER, true, false);
if (unregistered) {
QueryReturnValue result = runQuery(QueryType.GetDiskByDiskId, new IdQueryParameters(guid));
if (!result.getSucceeded() || result.getReturnValue() == null) {
Guid dataCenterId = BackendDataCenterHelper.lookupByStorageDomainId(this, storageDomainId);
disk = performGet(QueryType.GetUnregisteredDisk, new GetUnregisteredDiskQueryParameters(guid, storageDomainId, dataCenterId));
} else {
// parameter was passed.
return notFound();
}
} else {
disk = getDelegate().get();
}
if (disk.isSetStorageDomains() && !disk.getStorageDomains().getStorageDomains().isEmpty()) {
for (StorageDomain sd : disk.getStorageDomains().getStorageDomains()) {
if (sd.isSetId() && sd.getId().equals(storageDomainId.toString())) {
return disk;
}
}
}
return notFound();
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainImageResource method addParents.
@Override
protected Image addParents(Image image) {
StorageDomain storageDomain = new StorageDomain();
storageDomain.setId(getStorageDomainId().toString());
image.setStorageDomain(storageDomain);
return image;
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainImagesResource method addParents.
@Override
protected Image addParents(Image image) {
StorageDomain sd = new StorageDomain();
sd.setId(storageDomainId.toString());
image.setStorageDomain(sd);
return super.addParents(image);
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendStorageDomainResource method update.
@Override
public StorageDomain update(StorageDomain incoming) {
QueryIdResolver<Guid> storageDomainResolver = new QueryIdResolver<>(QueryType.GetStorageDomainById, IdQueryParameters.class);
org.ovirt.engine.core.common.businessentities.StorageDomain entity = getEntity(storageDomainResolver, true);
StorageDomain model = map(entity, new StorageDomain());
StorageType storageType = entity.getStorageType();
if (storageType != null) {
switch(storageType) {
case ISCSI:
case FCP:
extendStorageDomain(incoming, model);
break;
default:
break;
}
}
return addLinks(performUpdate(incoming, entity, model, storageDomainResolver, ActionType.UpdateStorageDomain, new UpdateParametersProvider()), new String[] { "templates", "vms" });
}
use of org.ovirt.engine.api.model.StorageDomain in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method testExport.
@Test
public void testExport() throws Exception {
setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[] { "ImageGroupID", "DestinationDomainId" }, new Object[] { DISK_ID, GUIDS[3] }, true, true, null, null, true));
Action action = new Action();
action.setStorageDomain(new StorageDomain());
action.getStorageDomain().setId(GUIDS[3].toString());
verifyActionResponse(resource.export(action));
}
Aggregations