Package com.cloud.user

Examples of com.cloud.user.User


        if (accountId != null) {
            return accountId;
        }
        Account account = null;
        if (autoscaleUserId != null) {
            User user = _entityMgr.findById(User.class, autoscaleUserId);
            account = _entityMgr.findById(Account.class, user.getAccountId());
        } else {
            account = UserContext.current().getCaller();
        }
        accountId = account.getAccountId();
        domainId = account.getDomainId();
View Full Code Here


        Account account = _accountService.getActiveAccountByName(accountName, domainId);
        if (account == null) {
            return _accountService.createUserAccount(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName,
                    accountType, domainId, networkDomain, details, accountUUID, userUUID);
        } else {
            User newUser = _accountService.createUser(username, generatePassword(), user.getFirstname(), user.getLastname(), user.getEmail(), timezone, accountName,
                                                      domainId, userUUID);
            return _accountService.getUserAccountById(newUser.getId());
        }
    }
View Full Code Here

    }

    public Outcome<VMSnapshot> createVMSnapshotThroughJobQueue(final Long vmId, final Long vmSnapshotId, final boolean quiesceVm) {

        final CallContext context = CallContext.current();
        final User callingUser = context.getCallingUser();
        final Account callingAccount = context.getCallingAccount();

        final VMInstanceVO vm = _vmInstanceDao.findById(vmId);

        Object[] result = Transaction.execute(new TransactionCallback<Object[]>() {
            @Override
            public Object[] doInTransaction(TransactionStatus status) {
                VmWorkJobVO workJob = null;

                _vmInstanceDao.lockRow(vm.getId(), true);
                workJob = new VmWorkJobVO(context.getContextId());

                workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
                workJob.setCmd(VmWorkCreateVMSnapshot.class.getName());

                workJob.setAccountId(callingAccount.getId());
                workJob.setUserId(callingUser.getId());
                workJob.setStep(VmWorkJobVO.Step.Starting);
                workJob.setVmType(VirtualMachine.Type.Instance);
                workJob.setVmInstanceId(vm.getId());
                workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());

                // save work context info (there are some duplications)
                VmWorkCreateVMSnapshot workInfo = new VmWorkCreateVMSnapshot(callingUser.getId(), callingAccount.getId(), vm.getId(),
                        VMSnapshotManagerImpl.VM_WORK_JOB_HANDLER, vmSnapshotId, quiesceVm);
                workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));

                _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());
View Full Code Here

    }

    public Outcome<VMSnapshot> deleteVMSnapshotThroughJobQueue(final Long vmId, final Long vmSnapshotId) {

        final CallContext context = CallContext.current();
        final User callingUser = context.getCallingUser();
        final Account callingAccount = context.getCallingAccount();

        final VMInstanceVO vm = _vmInstanceDao.findById(vmId);

        Object[] result = Transaction.execute(new TransactionCallback<Object[]>() {
            @Override
            public Object[] doInTransaction(TransactionStatus status) {
                VmWorkJobVO workJob = null;

                _vmInstanceDao.lockRow(vm.getId(), true);
                workJob = new VmWorkJobVO(context.getContextId());

                workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
                workJob.setCmd(VmWorkDeleteVMSnapshot.class.getName());

                workJob.setAccountId(callingAccount.getId());
                workJob.setUserId(callingUser.getId());
                workJob.setStep(VmWorkJobVO.Step.Starting);
                workJob.setVmType(VirtualMachine.Type.Instance);
                workJob.setVmInstanceId(vm.getId());
                workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());

                // save work context info (there are some duplications)
                VmWorkDeleteVMSnapshot workInfo = new VmWorkDeleteVMSnapshot(callingUser.getId(), callingAccount.getId(), vm.getId(),
                        VMSnapshotManagerImpl.VM_WORK_JOB_HANDLER, vmSnapshotId);
                workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));

                _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());
View Full Code Here

    }

    public Outcome<VMSnapshot> revertToVMSnapshotThroughJobQueue(final Long vmId, final Long vmSnapshotId) {

        final CallContext context = CallContext.current();
        final User callingUser = context.getCallingUser();
        final Account callingAccount = context.getCallingAccount();

        final VMInstanceVO vm = _vmInstanceDao.findById(vmId);

        Object[] result = Transaction.execute(new TransactionCallback<Object[]>() {
            @Override
            public Object[] doInTransaction(TransactionStatus status) {
                VmWorkJobVO workJob = null;

                _vmInstanceDao.lockRow(vm.getId(), true);
                workJob = new VmWorkJobVO(context.getContextId());

                workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
                workJob.setCmd(VmWorkRevertToVMSnapshot.class.getName());

                workJob.setAccountId(callingAccount.getId());
                workJob.setUserId(callingUser.getId());
                workJob.setStep(VmWorkJobVO.Step.Starting);
                workJob.setVmType(VirtualMachine.Type.Instance);
                workJob.setVmInstanceId(vm.getId());
                workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());

                // save work context info (there are some duplications)
                VmWorkRevertToVMSnapshot workInfo = new VmWorkRevertToVMSnapshot(callingUser.getId(), callingAccount.getId(), vm.getId(),
                        VMSnapshotManagerImpl.VM_WORK_JOB_HANDLER, vmSnapshotId);
                workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));

                _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());
View Full Code Here

    }

    public Outcome<VirtualMachine> deleteAllVMSnapshotsThroughJobQueue(final Long vmId, final VMSnapshot.Type type) {

        final CallContext context = CallContext.current();
        final User callingUser = context.getCallingUser();
        final Account callingAccount = context.getCallingAccount();

        final VMInstanceVO vm = _vmInstanceDao.findById(vmId);

        Object[] result = Transaction.execute(new TransactionCallback<Object[]>() {
            @Override
            public Object[] doInTransaction(TransactionStatus status) {
                VmWorkJobVO workJob = null;

                _vmInstanceDao.lockRow(vm.getId(), true);
                workJob = new VmWorkJobVO(context.getContextId());

                workJob.setDispatcher(VmWorkConstants.VM_WORK_JOB_DISPATCHER);
                workJob.setCmd(VmWorkDeleteAllVMSnapshots.class.getName());

                workJob.setAccountId(callingAccount.getId());
                workJob.setUserId(callingUser.getId());
                workJob.setStep(VmWorkJobVO.Step.Starting);
                workJob.setVmType(VirtualMachine.Type.Instance);
                workJob.setVmInstanceId(vm.getId());
                workJob.setRelated(AsyncJobExecutionContext.getOriginJobContextId());

                // save work context info (there are some duplications)
                VmWorkDeleteAllVMSnapshots workInfo = new VmWorkDeleteAllVMSnapshots(callingUser.getId(), callingAccount.getId(), vm.getId(),
                        VMSnapshotManagerImpl.VM_WORK_JOB_HANDLER, type);
                workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));

                _jobMgr.submitAsyncJob(workJob, VmWorkConstants.VM_WORK_QUEUE, vm.getId());
View Full Code Here

    @Override
    public VirtualRouter startRouter(long routerId, boolean reprogramNetwork) throws ResourceUnavailableException,
    InsufficientCapacityException, ConcurrentOperationException {
        Account caller = CallContext.current().getCallingAccount();
        User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());

        // verify parameters
        DomainRouterVO router = _routerDao.findById(routerId);
        if (router == null) {
            throw new InvalidParameterValueException("Unable to find router by id " + routerId + ".");
View Full Code Here

        if (forced && !_accountMgr.isRootAdmin(caller.getType())) {
            throw new InvalidParameterValueException("Delete network with 'forced' option can only be called by root admins");
        }

        User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
        ReservationContext context = new ReservationContextImpl(null, null, callerUser, owner);

        return _networkMgr.destroyNetwork(networkId, context, forced);
    }
View Full Code Here

    @ActionEvent(eventType = EventTypes.EVENT_NETWORK_RESTART, eventDescription = "restarting network", async = true)
    public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
        // This method restarts all network elements belonging to the network and re-applies all the rules
        Long networkId = cmd.getNetworkId();

        User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
        Account callerAccount = _accountMgr.getActiveAccountById(callerUser.getAccountId());

        // Check if network exists
        NetworkVO network = _networksDao.findById(networkId);
        if (network == null) {
            InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id doesn't exist");
View Full Code Here

        if (networks != null && !networks.isEmpty()) {
            throw new CloudRuntimeException(
                    "Provider is not deletable because there are active networks using this provider, please upgrade these networks to new network offerings");
        }

        User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
        Account callerAccount = _accountMgr.getActiveAccountById(callerUser.getAccountId());
        // shutdown the provider instances
        ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount);
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Shutting down the service provider id=" + id + " on physical network: " + provider.getPhysicalNetworkId());
        }
View Full Code Here

TOP

Related Classes of com.cloud.user.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.