Package org.apache.cloudstack.storage.command

Examples of org.apache.cloudstack.storage.command.CreateObjectAnswer


            if (data.getObjectType() == DataObjectType.VOLUME) {
                return processor.createVolume(cmd);
            } else if (data.getObjectType() == DataObjectType.SNAPSHOT) {
                return processor.createSnapshot(cmd);
            }
            return new CreateObjectAnswer("not supported type");
        } catch (Exception e) {
            s_logger.debug("Failed to create object: " + data.getObjectType() + ": " + e.toString());
            return new CreateObjectAnswer(e.toString());
        }
    }
View Full Code Here


                        vol.setFormat(newVol.getFormat());
                    }
                    vol.setPoolId(this.getDataStore().getId());
                    volumeDao.update(vol.getId(), vol);
                } else if (answer instanceof CreateObjectAnswer) {
                    CreateObjectAnswer createAnswer = (CreateObjectAnswer) answer;
                    VolumeObjectTO newVol = (VolumeObjectTO) createAnswer.getData();
                    VolumeVO vol = this.volumeDao.findById(this.getId());
                    vol.setPath(newVol.getPath());
                    if (newVol.getSize() != null) {
                        vol.setSize(newVol.getSize());
                    }
View Full Code Here

                        vol.setSize(newVol.getSize());
                    }
                    vol.setPoolId(this.getDataStore().getId());
                    volumeDao.update(vol.getId(), vol);
                } else if (answer instanceof CreateObjectAnswer) {
                    CreateObjectAnswer createAnswer = (CreateObjectAnswer) answer;
                    VolumeObjectTO newVol = (VolumeObjectTO) createAnswer.getData();
                    VolumeVO vol = this.volumeDao.findById(this.getId());
                    vol.setPath(newVol.getPath());
                    if (newVol.getSize() != null) {
                        vol.setSize(newVol.getSize());
                    }
View Full Code Here

                snapshotOnImageStore.processEvent(Event.CreateOnlyRequested);

                SnapshotObjectTO snapTO = new SnapshotObjectTO();
                snapTO.setPath(parentSnapshotOnBackupStore.getInstallPath());

                CreateObjectAnswer createSnapshotAnswer = new CreateObjectAnswer(snapTO);

                snapshotOnImageStore.processEvent(Event.OperationSuccessed, createSnapshotAnswer);
                SnapshotObject snapObj = (SnapshotObject) snapshot;
                try {
                    snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
View Full Code Here

       
    }
   
    public Void createAsyncCallback(AsyncCallbackDispatcher<DefaultPrimaryDataStoreDriverImpl, Answer> callback, CreateVolumeContext<CreateCmdResult> context) {
        CreateCmdResult result = null;
        CreateObjectAnswer volAnswer = (CreateObjectAnswer) callback.getResult();
        if (volAnswer.getResult()) {
            result = new CreateCmdResult(volAnswer.getPath(), volAnswer.getSize());
        } else {
            result = new CreateCmdResult("", null);
            result.setResult(volAnswer.getDetails());
        }
       
        context.getParentCallback().complete(result);
        return null;
    }
View Full Code Here

            DecodedDataObject obj = Decoder.decode(uri);
            if (obj.getPath() == null) {
                //create an obj
                EndPoint newEp = selector.select(object);
                CreateObjectCommand createCmd = new CreateObjectCommand(uri);
                CreateObjectAnswer answer = (CreateObjectAnswer)ep.sendMessage(createCmd);
                if (answer.getResult()) {
                    dataObjMgr.update(object, answer.getPath(), answer.getSize());
                } else {
                    s_logger.debug("failed to create object" + answer.getDetails());
                    throw new CloudRuntimeException("failed to create object" + answer.getDetails());
                }
            }
           
            return object.getUri();
        } catch (URISyntaxException e) {
View Full Code Here

                result.setResult("can't find storage client for:" + data.getId() + "," + data.getType());
                callback.complete(result);
                return;
            }
            CreateObjectCommand createCmd = new CreateObjectCommand(data.getUri());
            CreateObjectAnswer answer = (CreateObjectAnswer)ep.sendMessage(createCmd);
            if (answer.getResult()) {
                //update imagestorevo
              
                result = new CreateCmdResult(answer.getPath(), answer.getSize());
            } else {
                result.setResult(answer.getDetails());
            }
           
        }
       
        callback.complete(result);
View Full Code Here

    @Override
    public Answer createVolume(CreateObjectCommand cmd) {
        VolumeObjectTO volume = (VolumeObjectTO) cmd.getData();
        VolumeObjectTO newVol = new VolumeObjectTO();
        newVol.setPath(volume.getName());
        return new CreateObjectAnswer(newVol);
    }
View Full Code Here

    @Override
    public Answer createSnapshot(CreateObjectCommand cmd) {
        String snapshotName = UUID.randomUUID().toString();
        SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
        newSnapshot.setPath(snapshotName);
        return new CreateObjectAnswer(newSnapshot);
    }
View Full Code Here

             */
            if (primaryPool.getType() == StoragePoolType.RBD) {
                newVol.setFormat(ImageFormat.RAW);
            }

            return new CreateObjectAnswer(newVol);
        } catch (Exception e) {
            s_logger.debug("Failed to create volume: " + e.toString());
            return new CreateObjectAnswer(e.toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.storage.command.CreateObjectAnswer

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.