@Override public long getEntityOwnerId() { Volume volume = _entityMgr.findById(Volume.class, getVolumeId()); if (volume == null) { throw new InvalidParameterValueException("Unable to find volume by id=" + volumeId); } Account account = _accountService.getAccount(volume.getAccountId()); // Can create templates for enabled projects/accounts only if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { Project project = _projectService.findByProjectAccountId(volume.getAccountId()); if (project.getState() != Project.State.Active) { throw new PermissionDeniedException( "Can't add resources to the project id=" + project.getId() + " in state=" + project.getState() + " as it's no longer active"); } } else if (account.getState() == Account.State.disabled) { throw new PermissionDeniedException("The owner of template is disabled: " + account); } return volume.getAccountId(); }
// Copy Constructor public VolumeVO(Volume that) { this( that.getName(), that.getDataCenterId(), that.getPodId(), that.getAccountId(), that.getDomainId(), that.getInstanceId(), that.getFolder(), that.getPath(), that.getSize(), that.getMinIops(), that.getMaxIops(), that.get_iScsiName(), that.getVolumeType()); this.recreatable = that.isRecreatable(); this.state = that.getState(); this.size = that.getSize(); this.minIops = that.getMinIops(); this.maxIops = that.getMaxIops(); this._iScsiName = that.get_iScsiName(); this.diskOfferingId = that.getDiskOfferingId(); this.poolId = that.getPoolId(); this.attached = that.getAttached(); this.chainInfo = that.getChainInfo(); this.templateId = that.getTemplateId(); this.deviceId = that.getDeviceId(); this.format = that.getFormat(); this.uuid = UUID.randomUUID().toString(); }
@Override public long getEntityOwnerId() { Volume volume = _responseGenerator.findVolumeById(getId()); if (volume == null) { return Account .ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are // tracked } return volume.getAccountId(); }
// Copy Constructor public VolumeVO(Volume that) { this( that.getName(), that.getDataCenterId(), that.getPodId(), that.getAccountId(), that.getDomainId(), that.getInstanceId(), that.getFolder(), that.getPath(), that.getSize(), that.getVolumeType()); this.recreatable = that.isRecreatable(); this.state = that.getState(); this.size = that.getSize(); this.diskOfferingId = that.getDiskOfferingId(); this.poolId = that.getPoolId(); this.attached = that.getAttached(); this.chainInfo = that.getChainInfo(); this.templateId = that.getTemplateId(); this.deviceId = that.getDeviceId(); }