private Guid getQuotaId(ExternalVmImport vmImport) { if (vmImport.isSetQuota() && vmImport.getQuota().isSetId()) { return asGuid(vmImport.getQuota().getId()); } else { return null; } }
@Override public Response copy(Action action) { validateParameters(action, "storageDomain.id|name"); Guid storageDomainId = getStorageDomainId(action); Disk disk = get(); Guid imageId = getDiskImageId(disk.getImageId()); Guid sourceStorageDomainId = getSourceStorageDomainId(disk); MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(imageId, sourceStorageDomainId, storageDomainId, ImageOperation.Copy); params.setImageGroupID(asGuid(disk.getId())); params.setQuotaId(action.isSetQuota() ? asGuid(action.getQuota().getId()) : null); params.setDiskProfileId(action.isSetDiskProfile() ? asGuid(action.getDiskProfile().getId()) : null); Disk actionDisk = action.getDisk(); if (actionDisk != null) { String name = actionDisk.getName(); String alias = actionDisk.getAlias(); if (name != null && !StringUtils.isEmpty(name)) { params.setNewAlias(name); } else if (alias != null && !StringUtils.isEmpty(alias)) { params.setNewAlias(alias); } } return doAction(ActionType.MoveOrCopyDisk, params, action); }
@Override public Response move(Action action) { validateParameters(action, "storageDomain.id|name"); Guid storageDomainId = getStorageDomainId(action); Disk disk = get(); Guid imageId = getDiskImageId(disk.getImageId()); Guid sourceStorageDomainId = getSourceStorageDomainId(disk); MoveDiskParameters params = new MoveDiskParameters( imageId, sourceStorageDomainId, storageDomainId); params.setImageGroupID(asGuid(disk.getId())); params.setQuotaId(action.isSetQuota() ? asGuid(action.getQuota().getId()) : null); params.setDiskProfileId(action.isSetDiskProfile() ? asGuid(action.getDiskProfile().getId()) : null); return doAction(ActionType.MoveDisk, params, action); }
to.setId(from.getId());
diskImage.setQuotaId(GuidUtils.asGuid(disk.getQuota().getId()));
@Mapping(from = Quota.class, to = org.ovirt.engine.core.common.businessentities.Quota.class) public static org.ovirt.engine.core.common.businessentities.Quota map(Quota model, org.ovirt.engine.core.common.businessentities.Quota template) { org.ovirt.engine.core.common.businessentities.Quota entity = (template==null) ? new org.ovirt.engine.core.common.businessentities.Quota() : template; if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetName()) { entity.setQuotaName(model.getName()); } if (model.isSetDescription()) { entity.setDescription(model.getDescription()); } if (model.isSetDataCenter()) { entity.setStoragePoolId(GuidUtils.asGuid(model.getDataCenter().getId())); } if (model.isSetClusterHardLimitPct()) { entity.setGraceClusterPercentage(model.getClusterHardLimitPct()); } if (model.isSetStorageHardLimitPct()) { entity.setGraceStoragePercentage(model.getStorageHardLimitPct()); } if (model.isSetClusterSoftLimitPct()) { entity.setThresholdClusterPercentage(model.getClusterSoftLimitPct()); } if (model.isSetStorageSoftLimitPct()) { entity.setThresholdStoragePercentage(model.getStorageSoftLimitPct()); } return entity; }
entity.setQuotaId(GuidUtils.asGuid(model.getQuota().getId()));