Search in sources :

Example 6 with AsyncJobVO

use of org.apache.cloudstack.framework.jobs.impl.AsyncJobVO in project cloudstack by apache.

the class VolumeApiServiceImplTest method setup.

@Before
public void setup() throws Exception {
    MockitoAnnotations.initMocks(this);
    _svc._volsDao = _volumeDao;
    _svc._accountMgr = _accountMgr;
    _svc._userVmDao = _userVmDao;
    _svc._storagePoolDao = _storagePoolDao;
    _svc._vmSnapshotDao = _vmSnapshotDao;
    _svc._vmInstanceDao = _vmInstanceDao;
    _svc._jobMgr = _jobMgr;
    _svc.volFactory = _volFactory;
    _svc.volService = volService;
    _svc._userVmMgr = _userVmMgr;
    _svc._dcDao = _dcDao;
    _svc._resourceLimitMgr = _resourceLimitMgr;
    _svc._accountDao = _accountDao;
    _svc._hostDao = _hostDao;
    _svc._gson = GsonHelper.getGsonLogger();
    // mock caller context
    AccountVO account = new AccountVO("admin", 1L, "networkDomain", Account.ACCOUNT_TYPE_NORMAL, "uuid");
    AccountVO account2 = new AccountVO("Account2", 2L, "networkDomain", Account.ACCOUNT_TYPE_NORMAL, "uuid");
    UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
    CallContext.register(user, account);
    // mock async context
    AsyncJobExecutionContext context = new AsyncJobExecutionContext();
    AsyncJobExecutionContext.init(_svc._jobMgr, _joinMapDao);
    AsyncJobVO job = new AsyncJobVO();
    context.setJob(job);
    AsyncJobExecutionContext.setCurrentExecutionContext(context);
    TransactionLegacy txn = TransactionLegacy.open("runVolumeDaoImplTest");
    try {
        // volume of running vm id=1
        VolumeVO volumeOfRunningVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 1L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        when(_svc._volsDao.findById(1L)).thenReturn(volumeOfRunningVm);
        UserVmVO runningVm = new UserVmVO(1L, "vm", "vm", 1, HypervisorType.XenServer, 1L, false, false, 1L, 1L, 1, 1L, null, "vm", null);
        runningVm.setState(State.Running);
        runningVm.setDataCenterId(1L);
        when(_svc._userVmDao.findById(1L)).thenReturn(runningVm);
        // volume of stopped vm id=2
        VolumeVO volumeOfStoppedVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        volumeOfStoppedVm.setPoolId(1L);
        when(_svc._volsDao.findById(2L)).thenReturn(volumeOfStoppedVm);
        UserVmVO stoppedVm = new UserVmVO(2L, "vm", "vm", 1, HypervisorType.XenServer, 1L, false, false, 1L, 1L, 1, 1L, null, "vm", null);
        stoppedVm.setState(State.Stopped);
        stoppedVm.setDataCenterId(1L);
        when(_svc._userVmDao.findById(2L)).thenReturn(stoppedVm);
        // volume of hyperV vm id=3
        UserVmVO hyperVVm = new UserVmVO(3L, "vm", "vm", 1, HypervisorType.Hyperv, 1L, false, false, 1L, 1L, 1, 1L, null, "vm", null);
        hyperVVm.setState(State.Stopped);
        hyperVVm.setDataCenterId(1L);
        when(_svc._userVmDao.findById(3L)).thenReturn(hyperVVm);
        VolumeVO volumeOfStoppeHyperVVm = new VolumeVO("root", 1L, 1L, 1L, 1L, 3L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        volumeOfStoppeHyperVVm.setPoolId(1L);
        when(_svc._volsDao.findById(3L)).thenReturn(volumeOfStoppeHyperVVm);
        StoragePoolVO unmanagedPool = new StoragePoolVO();
        when(_svc._storagePoolDao.findById(1L)).thenReturn(unmanagedPool);
        // volume of managed pool id=4
        StoragePoolVO managedPool = new StoragePoolVO();
        managedPool.setManaged(true);
        when(_svc._storagePoolDao.findById(2L)).thenReturn(managedPool);
        VolumeVO managedPoolVolume = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        managedPoolVolume.setPoolId(2L);
        when(_svc._volsDao.findById(4L)).thenReturn(managedPoolVolume);
        // non-root non-datadisk volume
        VolumeInfo volumeWithIncorrectVolumeType = Mockito.mock(VolumeInfo.class);
        when(volumeWithIncorrectVolumeType.getId()).thenReturn(5L);
        when(volumeWithIncorrectVolumeType.getVolumeType()).thenReturn(Volume.Type.ISO);
        when(_svc.volFactory.getVolume(5L)).thenReturn(volumeWithIncorrectVolumeType);
        // correct root volume
        VolumeInfo correctRootVolume = Mockito.mock(VolumeInfo.class);
        when(correctRootVolume.getId()).thenReturn(6L);
        when(correctRootVolume.getDataCenterId()).thenReturn(1L);
        when(correctRootVolume.getVolumeType()).thenReturn(Volume.Type.ROOT);
        when(correctRootVolume.getInstanceId()).thenReturn(null);
        when(correctRootVolume.getState()).thenReturn(Volume.State.Ready);
        when(correctRootVolume.getTemplateId()).thenReturn(null);
        when(correctRootVolume.getPoolId()).thenReturn(1L);
        when(_svc.volFactory.getVolume(6L)).thenReturn(correctRootVolume);
        VolumeVO correctRootVolumeVO = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        when(_svc._volsDao.findById(6L)).thenReturn(correctRootVolumeVO);
        // managed root volume
        VolumeInfo managedVolume = Mockito.mock(VolumeInfo.class);
        when(managedVolume.getId()).thenReturn(7L);
        when(managedVolume.getDataCenterId()).thenReturn(1L);
        when(managedVolume.getVolumeType()).thenReturn(Volume.Type.ROOT);
        when(managedVolume.getInstanceId()).thenReturn(null);
        when(managedVolume.getPoolId()).thenReturn(2L);
        when(_svc.volFactory.getVolume(7L)).thenReturn(managedVolume);
        VolumeVO managedVolume1 = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        managedVolume1.setPoolId(2L);
        managedVolume1.setDataCenterId(1L);
        when(_svc._volsDao.findById(7L)).thenReturn(managedVolume1);
        // vm having root volume
        UserVmVO vmHavingRootVolume = new UserVmVO(4L, "vm", "vm", 1, HypervisorType.XenServer, 1L, false, false, 1L, 1L, 1, 1L, null, "vm", null);
        vmHavingRootVolume.setState(State.Stopped);
        vmHavingRootVolume.setDataCenterId(1L);
        when(_svc._userVmDao.findById(4L)).thenReturn(vmHavingRootVolume);
        List<VolumeVO> vols = new ArrayList<VolumeVO>();
        vols.add(new VolumeVO());
        when(_svc._volsDao.findByInstanceAndDeviceId(4L, 0L)).thenReturn(vols);
        // volume in uploaded state
        VolumeInfo uploadedVolume = Mockito.mock(VolumeInfo.class);
        when(uploadedVolume.getId()).thenReturn(8L);
        when(uploadedVolume.getDataCenterId()).thenReturn(1L);
        when(uploadedVolume.getVolumeType()).thenReturn(Volume.Type.ROOT);
        when(uploadedVolume.getInstanceId()).thenReturn(null);
        when(uploadedVolume.getPoolId()).thenReturn(1L);
        when(uploadedVolume.getState()).thenReturn(Volume.State.Uploaded);
        when(_svc.volFactory.getVolume(8L)).thenReturn(uploadedVolume);
        VolumeVO upVolume = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root", Storage.ProvisioningType.THIN, 1, null, null, "root", Volume.Type.ROOT);
        upVolume.setPoolId(1L);
        upVolume.setDataCenterId(1L);
        upVolume.setState(Volume.State.Uploaded);
        when(_svc._volsDao.findById(8L)).thenReturn(upVolume);
        // helper dao methods mock
        when(_svc._vmSnapshotDao.findByVm(any(Long.class))).thenReturn(new ArrayList<VMSnapshotVO>());
        when(_svc._vmInstanceDao.findById(any(Long.class))).thenReturn(stoppedVm);
        DataCenterVO enabledZone = Mockito.mock(DataCenterVO.class);
        when(enabledZone.getAllocationState()).thenReturn(Grouping.AllocationState.Enabled);
        when(_svc._dcDao.findById(anyLong())).thenReturn(enabledZone);
    } finally {
        txn.close("runVolumeDaoImplTest");
    }
    // helper methods mock
    doNothing().when(_svc._accountMgr).checkAccess(any(Account.class), any(AccessType.class), any(Boolean.class), any(ControlledEntity.class));
    doNothing().when(_svc._jobMgr).updateAsyncJobAttachment(any(Long.class), any(String.class), any(Long.class));
    when(_svc._jobMgr.submitAsyncJob(any(AsyncJobVO.class), any(String.class), any(Long.class))).thenReturn(1L);
}
Also used : DataCenterVO(com.cloud.dc.DataCenterVO) Account(com.cloud.user.Account) UserVmVO(com.cloud.vm.UserVmVO) AsyncJobExecutionContext(org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext) ArrayList(java.util.ArrayList) VolumeInfo(org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo) Matchers.anyString(org.mockito.Matchers.anyString) AccountVO(com.cloud.user.AccountVO) AsyncJobVO(org.apache.cloudstack.framework.jobs.impl.AsyncJobVO) TransactionLegacy(com.cloud.utils.db.TransactionLegacy) VMSnapshotVO(com.cloud.vm.snapshot.VMSnapshotVO) UserVO(com.cloud.user.UserVO) ControlledEntity(org.apache.cloudstack.acl.ControlledEntity) StoragePoolVO(org.apache.cloudstack.storage.datastore.db.StoragePoolVO) Matchers.anyLong(org.mockito.Matchers.anyLong) AccessType(org.apache.cloudstack.acl.SecurityChecker.AccessType) Before(org.junit.Before)

Example 7 with AsyncJobVO

use of org.apache.cloudstack.framework.jobs.impl.AsyncJobVO in project cloudstack by apache.

the class SnapshotSchedulerImpl method checkStatusOfCurrentlyExecutingSnapshots.

private void checkStatusOfCurrentlyExecutingSnapshots() {
    final SearchCriteria<SnapshotScheduleVO> sc = _snapshotScheduleDao.createSearchCriteria();
    sc.addAnd("asyncJobId", SearchCriteria.Op.NNULL);
    final List<SnapshotScheduleVO> snapshotSchedules = _snapshotScheduleDao.search(sc, null);
    for (final SnapshotScheduleVO snapshotSchedule : snapshotSchedules) {
        final Long asyncJobId = snapshotSchedule.getAsyncJobId();
        final AsyncJobVO asyncJob = _asyncJobDao.findById(asyncJobId);
        switch(asyncJob.getStatus()) {
            case SUCCEEDED:
                // The snapshot has been successfully backed up.
                // The snapshot state has also been cleaned up.
                // We can schedule the next job for this snapshot.
                // Remove the existing entry in the snapshot_schedule table.
                scheduleNextSnapshotJob(snapshotSchedule);
                break;
            case FAILED:
                // Check the snapshot status.
                final Long snapshotId = snapshotSchedule.getSnapshotId();
                if (snapshotId == null) {
                    // createSnapshotAsync exited, successfully or unsuccessfully,
                    // even before creating a snapshot record
                    // No cleanup needs to be done.
                    // Schedule the next snapshot.
                    scheduleNextSnapshotJob(snapshotSchedule);
                } else {
                    final SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
                    if (snapshot == null || snapshot.getRemoved() != null) {
                        // This snapshot has been deleted successfully from the primary storage
                        // Again no cleanup needs to be done.
                        // Schedule the next snapshot.
                        // There's very little probability that the code reaches this point.
                        // The snapshotId is a foreign key for the snapshot_schedule table
                        // set to ON DELETE CASCADE. So if the snapshot entry is deleted, the snapshot_schedule entry will be too.
                        // But what if it has only been marked as removed?
                        scheduleNextSnapshotJob(snapshotSchedule);
                    } else {
                        // The management server executing this snapshot job appears to have crashed
                        // while creating the snapshot on primary storage/or backing it up.
                        // We have no idea whether the snapshot was successfully taken on the primary or not.
                        // Schedule the next snapshot job.
                        // The ValidatePreviousSnapshotCommand will take appropriate action on this snapshot
                        // If the snapshot was taken successfully on primary, it will retry backing it up.
                        // and cleanup the previous snapshot
                        // Set the userId to that of system.
                        //_snapshotManager.validateSnapshot(1L, snapshot);
                        // In all cases, schedule the next snapshot job
                        scheduleNextSnapshotJob(snapshotSchedule);
                    }
                }
                break;
            case IN_PROGRESS:
                // And it will remain in stasis.
                break;
        }
    }
}
Also used : SnapshotVO(com.cloud.storage.SnapshotVO) SnapshotScheduleVO(com.cloud.storage.SnapshotScheduleVO) AsyncJobVO(org.apache.cloudstack.framework.jobs.impl.AsyncJobVO)

Example 8 with AsyncJobVO

use of org.apache.cloudstack.framework.jobs.impl.AsyncJobVO in project cloudstack by apache.

the class AsyncJobDaoImpl method getExpiredJobs.

@Override
public List<AsyncJobVO> getExpiredJobs(Date cutTime, int limit) {
    SearchCriteria<AsyncJobVO> sc = expiringAsyncJobSearch.create();
    sc.setParameters("created", cutTime);
    Filter filter = new Filter(AsyncJobVO.class, "created", true, 0L, (long) limit);
    return listIncludingRemovedBy(sc, filter);
}
Also used : Filter(com.cloud.utils.db.Filter) AsyncJobVO(org.apache.cloudstack.framework.jobs.impl.AsyncJobVO)

Example 9 with AsyncJobVO

use of org.apache.cloudstack.framework.jobs.impl.AsyncJobVO in project cloudstack by apache.

the class SnapshotSchedulerImpl method scheduleSnapshots.

@DB
protected void scheduleSnapshots() {
    String displayTime = DateUtil.displayDateInTimezone(DateUtil.GMT_TIMEZONE, _currentTimestamp);
    s_logger.debug("Snapshot scheduler.poll is being called at " + displayTime);
    final List<SnapshotScheduleVO> snapshotsToBeExecuted = _snapshotScheduleDao.getSchedulesToExecute(_currentTimestamp);
    s_logger.debug("Got " + snapshotsToBeExecuted.size() + " snapshots to be executed at " + displayTime);
    for (final SnapshotScheduleVO snapshotToBeExecuted : snapshotsToBeExecuted) {
        SnapshotScheduleVO tmpSnapshotScheduleVO = null;
        final long snapshotScheId = snapshotToBeExecuted.getId();
        final long policyId = snapshotToBeExecuted.getPolicyId();
        final long volumeId = snapshotToBeExecuted.getVolumeId();
        try {
            final VolumeVO volume = _volsDao.findById(volumeId);
            if (volume.getPoolId() == null) {
                // this volume is not attached
                continue;
            }
            Account volAcct = _acctDao.findById(volume.getAccountId());
            if (volAcct == null || volAcct.getState() == Account.State.disabled) {
                // this account has been removed, so don't trigger recurring snapshot
                if (s_logger.isDebugEnabled()) {
                    s_logger.debug("Skip snapshot for volume " + volume.getUuid() + " since its account has been removed or disabled");
                }
                continue;
            }
            if (_snapshotPolicyDao.findById(policyId) == null) {
                _snapshotScheduleDao.remove(snapshotToBeExecuted.getId());
            }
            if (s_logger.isDebugEnabled()) {
                final Date scheduledTimestamp = snapshotToBeExecuted.getScheduledTimestamp();
                displayTime = DateUtil.displayDateInTimezone(DateUtil.GMT_TIMEZONE, scheduledTimestamp);
                s_logger.debug("Scheduling 1 snapshot for volume id " + volumeId + " (volume name:" + volume.getName() + ") for schedule id: " + snapshotToBeExecuted.getId() + " at " + displayTime);
            }
            tmpSnapshotScheduleVO = _snapshotScheduleDao.acquireInLockTable(snapshotScheId);
            final Long eventId = ActionEventUtils.onScheduledActionEvent(User.UID_SYSTEM, volume.getAccountId(), EventTypes.EVENT_SNAPSHOT_CREATE, "creating snapshot for volume Id:" + volumeId, true, 0);
            final Map<String, String> params = new HashMap<String, String>();
            params.put(ApiConstants.VOLUME_ID, "" + volumeId);
            params.put(ApiConstants.POLICY_ID, "" + policyId);
            params.put("ctxUserId", "1");
            params.put("ctxAccountId", "" + volume.getAccountId());
            params.put("ctxStartEventId", String.valueOf(eventId));
            final CreateSnapshotCmd cmd = new CreateSnapshotCmd();
            ComponentContext.inject(cmd);
            _dispatcher.dispatchCreateCmd(cmd, params);
            params.put("id", "" + cmd.getEntityId());
            params.put("ctxStartEventId", "1");
            AsyncJobVO job = new AsyncJobVO("", User.UID_SYSTEM, volume.getAccountId(), CreateSnapshotCmd.class.getName(), ApiGsonHelper.getBuilder().create().toJson(params), cmd.getEntityId(), cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null, null);
            job.setDispatcher(_asyncDispatcher.getName());
            final long jobId = _asyncMgr.submitAsyncJob(job);
            tmpSnapshotScheduleVO.setAsyncJobId(jobId);
            _snapshotScheduleDao.update(snapshotScheId, tmpSnapshotScheduleVO);
        } catch (final Exception e) {
            // TODO Logging this exception is enough?
            s_logger.warn("Scheduling snapshot failed due to " + e.toString());
        } finally {
            if (tmpSnapshotScheduleVO != null) {
                _snapshotScheduleDao.releaseFromLockTable(snapshotScheId);
            }
        }
    }
}
Also used : Account(com.cloud.user.Account) HashMap(java.util.HashMap) CreateSnapshotCmd(org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotCmd) Date(java.util.Date) ConfigurationException(javax.naming.ConfigurationException) AsyncJobVO(org.apache.cloudstack.framework.jobs.impl.AsyncJobVO) VolumeVO(com.cloud.storage.VolumeVO) SnapshotScheduleVO(com.cloud.storage.SnapshotScheduleVO) DB(com.cloud.utils.db.DB)

Example 10 with AsyncJobVO

use of org.apache.cloudstack.framework.jobs.impl.AsyncJobVO in project cloudstack by apache.

the class ApiServer method queueCommand.

private String queueCommand(final BaseCmd cmdObj, final Map<String, String> params, StringBuilder log) throws Exception {
    final CallContext ctx = CallContext.current();
    final Long callerUserId = ctx.getCallingUserId();
    final Account caller = ctx.getCallingAccount();
    // BaseAsyncCmd: cmd is processed and submitted as an AsyncJob, job related info is serialized and returned.
    if (cmdObj instanceof BaseAsyncCmd) {
        Long objectId = null;
        String objectUuid = null;
        if (cmdObj instanceof BaseAsyncCreateCmd) {
            final BaseAsyncCreateCmd createCmd = (BaseAsyncCreateCmd) cmdObj;
            dispatcher.dispatchCreateCmd(createCmd, params);
            objectId = createCmd.getEntityId();
            objectUuid = createCmd.getEntityUuid();
            params.put("id", objectId.toString());
            Class entityClass = EventTypes.getEntityClassForEvent(createCmd.getEventType());
            if (entityClass != null)
                ctx.putContextParameter(entityClass, objectUuid);
        } else {
            // Extract the uuid before params are processed and id reflects internal db id
            objectUuid = params.get(ApiConstants.ID);
            dispatchChainFactory.getStandardDispatchChain().dispatch(new DispatchTask(cmdObj, params));
        }
        final BaseAsyncCmd asyncCmd = (BaseAsyncCmd) cmdObj;
        if (callerUserId != null) {
            params.put("ctxUserId", callerUserId.toString());
        }
        if (caller != null) {
            params.put("ctxAccountId", String.valueOf(caller.getId()));
        }
        if (objectUuid != null) {
            params.put("uuid", objectUuid);
        }
        long startEventId = ctx.getStartEventId();
        asyncCmd.setStartEventId(startEventId);
        // save the scheduled event
        final Long eventId = ActionEventUtils.onScheduledActionEvent((callerUserId == null) ? (Long) User.UID_SYSTEM : callerUserId, asyncCmd.getEntityOwnerId(), asyncCmd.getEventType(), asyncCmd.getEventDescription(), asyncCmd.isDisplay(), startEventId);
        if (startEventId == 0) {
            // There was no create event before, set current event id as start eventId
            startEventId = eventId;
        }
        params.put("ctxStartEventId", String.valueOf(startEventId));
        params.put("cmdEventType", asyncCmd.getEventType().toString());
        params.put("ctxDetails", ApiGsonHelper.getBuilder().create().toJson(ctx.getContextParameters()));
        Long instanceId = (objectId == null) ? asyncCmd.getInstanceId() : objectId;
        // users can provide the job id they want to use, so log as it is a uuid and is unique
        String injectedJobId = asyncCmd.getInjectedJobId();
        uuidMgr.checkUuidSimple(injectedJobId, AsyncJob.class);
        AsyncJobVO job = new AsyncJobVO("", callerUserId, caller.getId(), cmdObj.getClass().getName(), ApiGsonHelper.getBuilder().create().toJson(params), instanceId, asyncCmd.getInstanceType() != null ? asyncCmd.getInstanceType().toString() : null, injectedJobId);
        job.setDispatcher(asyncDispatcher.getName());
        final long jobId = asyncMgr.submitAsyncJob(job);
        if (jobId == 0L) {
            final String errorMsg = "Unable to schedule async job for command " + job.getCmd();
            s_logger.warn(errorMsg);
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errorMsg);
        }
        final String response;
        if (objectId != null) {
            final String objUuid = (objectUuid == null) ? objectId.toString() : objectUuid;
            response = getBaseAsyncCreateResponse(jobId, (BaseAsyncCreateCmd) asyncCmd, objUuid);
        } else {
            SerializationContext.current().setUuidTranslation(true);
            response = getBaseAsyncResponse(jobId, asyncCmd);
        }
        // Always log response for async for now, I don't think any sensitive data will be in here.
        // It might be nice to send this through scrubbing similar to how
        // ApiResponseSerializer.toSerializedStringWithSecureLogs works. For now, this gets jobid's
        // in the api logs.
        log.append(response);
        return response;
    } else {
        dispatcher.dispatch(cmdObj, params, false);
        // For those listXXXCommand which we have already created DB views, this step is not needed since async job is joined in their db views.
        if (cmdObj instanceof BaseListCmd && !(cmdObj instanceof ListVMsCmd) && !(cmdObj instanceof ListVMsCmdByAdmin) && !(cmdObj instanceof ListRoutersCmd) && !(cmdObj instanceof ListSecurityGroupsCmd) && !(cmdObj instanceof ListTagsCmd) && !(cmdObj instanceof ListEventsCmd) && !(cmdObj instanceof ListVMGroupsCmd) && !(cmdObj instanceof ListProjectsCmd) && !(cmdObj instanceof ListProjectAccountsCmd) && !(cmdObj instanceof ListProjectInvitationsCmd) && !(cmdObj instanceof ListHostsCmd) && !(cmdObj instanceof ListVolumesCmd) && !(cmdObj instanceof ListVolumesCmdByAdmin) && !(cmdObj instanceof ListUsersCmd) && !(cmdObj instanceof ListAccountsCmd) && !(cmdObj instanceof ListAccountsCmdByAdmin) && !(cmdObj instanceof ListStoragePoolsCmd) && !(cmdObj instanceof ListDiskOfferingsCmd) && !(cmdObj instanceof ListServiceOfferingsCmd) && !(cmdObj instanceof ListZonesCmd) && !(cmdObj instanceof ListZonesCmdByAdmin)) {
            buildAsyncListResponse((BaseListCmd) cmdObj, caller);
        }
        SerializationContext.current().setUuidTranslation(true);
        return ApiResponseSerializer.toSerializedStringWithSecureLogs((ResponseObject) cmdObj.getResponseObject(), cmdObj.getResponseType(), log);
    }
}
Also used : UserAccount(com.cloud.user.UserAccount) Account(com.cloud.user.Account) ListHostsCmd(org.apache.cloudstack.api.command.admin.host.ListHostsCmd) ListVolumesCmdByAdmin(org.apache.cloudstack.api.command.admin.volume.ListVolumesCmdByAdmin) ListZonesCmdByAdmin(org.apache.cloudstack.api.command.admin.zone.ListZonesCmdByAdmin) AsyncJobVO(org.apache.cloudstack.framework.jobs.impl.AsyncJobVO) ListZonesCmd(org.apache.cloudstack.api.command.user.zone.ListZonesCmd) ServerApiException(org.apache.cloudstack.api.ServerApiException) ListProjectInvitationsCmd(org.apache.cloudstack.api.command.user.project.ListProjectInvitationsCmd) ListProjectAccountsCmd(org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd) ListAccountsCmd(org.apache.cloudstack.api.command.user.account.ListAccountsCmd) DispatchTask(com.cloud.api.dispatch.DispatchTask) ListUsersCmd(org.apache.cloudstack.api.command.admin.user.ListUsersCmd) BaseListCmd(org.apache.cloudstack.api.BaseListCmd) ListSecurityGroupsCmd(org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCmd) ListEventsCmd(org.apache.cloudstack.api.command.user.event.ListEventsCmd) ListVolumesCmd(org.apache.cloudstack.api.command.user.volume.ListVolumesCmd) ListDiskOfferingsCmd(org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd) BaseAsyncCreateCmd(org.apache.cloudstack.api.BaseAsyncCreateCmd) ListRoutersCmd(org.apache.cloudstack.api.command.admin.router.ListRoutersCmd) ListProjectsCmd(org.apache.cloudstack.api.command.user.project.ListProjectsCmd) ListAccountsCmdByAdmin(org.apache.cloudstack.api.command.admin.account.ListAccountsCmdByAdmin) CallContext(org.apache.cloudstack.context.CallContext) ListVMGroupsCmd(org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd) BaseAsyncCmd(org.apache.cloudstack.api.BaseAsyncCmd) ListVMsCmd(org.apache.cloudstack.api.command.user.vm.ListVMsCmd) ListVMsCmdByAdmin(org.apache.cloudstack.api.command.admin.vm.ListVMsCmdByAdmin) ListStoragePoolsCmd(org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd) ListServiceOfferingsCmd(org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd) ListTagsCmd(org.apache.cloudstack.api.command.user.tag.ListTagsCmd)

Aggregations

AsyncJobVO (org.apache.cloudstack.framework.jobs.impl.AsyncJobVO)11 Account (com.cloud.user.Account)4 Filter (com.cloud.utils.db.Filter)4 SnapshotScheduleVO (com.cloud.storage.SnapshotScheduleVO)2 VmWorkAttachVolume (com.cloud.vm.VmWorkAttachVolume)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ConfigurationException (javax.naming.ConfigurationException)2 CallContext (org.apache.cloudstack.context.CallContext)2 DispatchTask (com.cloud.api.dispatch.DispatchTask)1 DataCenterVO (com.cloud.dc.DataCenterVO)1 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)1 InsufficientStorageCapacityException (com.cloud.exception.InsufficientStorageCapacityException)1 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)1 StorageUnavailableException (com.cloud.exception.StorageUnavailableException)1 SnapshotVO (com.cloud.storage.SnapshotVO)1 VolumeVO (com.cloud.storage.VolumeVO)1 AccountVO (com.cloud.user.AccountVO)1 User (com.cloud.user.User)1 UserAccount (com.cloud.user.UserAccount)1