Package org.apache.cloudstack.engine.subsystem.api.storage

Examples of org.apache.cloudstack.engine.subsystem.api.storage.CommandResult


        dataObjectMgr.deleteAsync(volume, caller);
        return future;
    }
   
    public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CommandResult> callback, DeleteVolumeContext<VolumeApiResult> context) {
        CommandResult result = callback.getResult();
        VolumeObject vo = context.getVolume();
        VolumeApiResult apiResult = new VolumeApiResult(vo);
        if (result.isSuccess()) {
            vo.stateTransit(Volume.Event.OperationSucceeded);
            volDao.remove(vo.getId());
        } else {
            vo.stateTransit(Volume.Event.OperationFailed);
            apiResult.setResult(result.getResult());
        }
        context.getFuture().complete(apiResult);
        return null;
    }
View Full Code Here


            .setContext(context);
        ep.sendMessageAsync(cmd, caller);
    }
   
    public Void deleteCallback(AsyncCallbackDispatcher<DefaultPrimaryDataStoreDriverImpl, Answer> callback, AsyncRpcConext<CommandResult> context) {
        CommandResult result = new CommandResult();
        Answer answer = callback.getResult();
        if (!answer.getResult()) {
            result.setResult(answer.getDetails());
        }
        context.getParentCallback().complete(result);
        return null;
    }
View Full Code Here

        AsyncCallFuture<CommandResult> future = new AsyncCallFuture<CommandResult>();
        try {
            to.stateTransit(TemplateEvent.CreateRequested);
        } catch (NoTransitionException e) {
            s_logger.debug("Failed to transit state:", e);
            CommandResult result = new CommandResult();
            result.setResult(e.toString());
            future.complete(result);
            return future;
        }
       
        ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(template.getId(), template.getType(), store.getId(), store.getRole());
        TemplateInfo templateOnStore = null;
        if (obj == null) {
            templateOnStore = (TemplateInfo)objectInDataStoreMgr.create(template, store);
            obj = objectInDataStoreMgr.findObject(template.getId(), template.getType(), store.getId(), store.getRole());
        } else {
            CommandResult result = new CommandResult();
            result.setResult("duplicate template on the storage");
            future.complete(result);
            return future;
        }
       
        try {
            objectInDataStoreMgr.update(obj, Event.CreateOnlyRequested);
        } catch (NoTransitionException e) {
            s_logger.debug("failed to transit", e);
            CommandResult result = new CommandResult();
            result.setResult(e.toString());
            future.complete(result);
            return future;
        }
        CreateTemplateContext<CommandResult> context = new CreateTemplateContext<CommandResult>(null,
                template, templateOnStore,
View Full Code Here

            CreateTemplateContext<CreateCmdResult> context) {
       
        TemplateInfo templateOnStore = context.templateOnStore;
        TemplateObject template = (TemplateObject)context.srcTemplate;
        AsyncCallFuture<CommandResult> future = context.future;
        CommandResult result = new CommandResult();
       
        CreateCmdResult callbackResult = callback.getResult();
        if (callbackResult.isFailed()) {
            try {
                objectInDataStoreMgr.update(templateOnStore, Event.OperationFailed);
            } catch (NoTransitionException e) {
                s_logger.debug("failed to transit state", e);
            }
            result.setResult(callbackResult.getResult());
            future.complete(result);
            return null;
        }
        ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(templateOnStore.getId(), templateOnStore.getType(), templateOnStore.getDataStore().getId(), templateOnStore.getDataStore().getRole());
        obj.setInstallPath(callbackResult.getPath());
       
        if (callbackResult.getSize() != null) {
            obj.setSize(callbackResult.getSize());
        }
       
        try {
            objectInDataStoreMgr.update(obj, Event.OperationSuccessed);
        } catch (NoTransitionException e) {
            s_logger.debug("Failed to transit state", e);
            result.setResult(e.toString());
            future.complete(result);
            return null;
        }
       
        template.setImageStoreId(templateOnStore.getDataStore().getId());
        template.setSize(callbackResult.getSize());
        try {
            template.stateTransit(TemplateEvent.OperationSucceeded);
        } catch (NoTransitionException e) {
            s_logger.debug("Failed to transit state", e);
            result.setResult(e.toString());
            future.complete(result);
            return null;
        }
       
        future.complete(result);
View Full Code Here

    }

    @Override
    public void deleteAsync(DataObject data,
            AsyncCompletionCallback<CommandResult> callback) {
        CommandResult result = new CommandResult();
        callback.complete(result);
    }
View Full Code Here

                destObj.getId(), destObj
                        .getType(), destObj.getDataStore()
                        .getId(), destObj.getDataStore()
                        .getRole());
       
        CommandResult res = callback.getResult();
        if (res.isFailed()) {
            try {
                objectInDataStoreMgr.update(obj, Event.OperationFailed);
            } catch (NoTransitionException e) {
               s_logger.debug("delete failed", e);
            }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.engine.subsystem.api.storage.CommandResult

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.