Package org.apache.cloudstack.storage.command

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


                }

                VolumeObjectTO newVol = new VolumeObjectTO();
                newVol.setPath(volumeUuid);
                newVol.setSize(volume.getSize());
                return new CreateObjectAnswer(newVol);
            } finally {
                s_logger.info("Destroy dummy VM after volume creation");
                if(vmMo != null) {
                    vmMo.detachAllDisks();
                    vmMo.destroy();
                }
            }
        } catch (Throwable e) {
            if (e instanceof RemoteException) {
                s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
                hostService.invalidateServiceContext(null);
            }

            String msg = "create volume failed due to " + VmwareHelper.getExceptionMessage(e);
            s_logger.error(msg, e);
            return new CreateObjectAnswer(e.toString());
        }
    }
View Full Code Here


        // snapshot operation (create or destroy) is handled inside BackupSnapshotCommand(), we just fake
        // a success return here
        String snapshotUUID = UUID.randomUUID().toString();
        SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
        newSnapshot.setPath(snapshotUUID);
        return new CreateObjectAnswer(newSnapshot);
    }
View Full Code Here

            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

                    snapshotUUID = preSnapshotUUID;
                }
            }
            SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
            newSnapshot.setPath(snapshotUUID);
            return new CreateObjectAnswer(newSnapshot);
        } catch (XenAPIException e) {
            details += ", reason: " + e.toString();
            s_logger.warn(details, e);
        } catch (Exception e) {
            details += ", reason: " + e.toString();
            s_logger.warn(details, e);
        }

        return new CreateObjectAnswer(details);
    }
View Full Code Here

            VolumeObjectTO newVol = new VolumeObjectTO();
            newVol.setName(vdir.nameLabel);
            newVol.setSize(vdir.virtualSize);
            newVol.setPath(vdir.uuid);

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

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

                        vol.setSize(newVol.getSize());
                    }
                    vol.setPoolId(getDataStore().getId());
                    volumeDao.update(vol.getId(), vol);
                } else if (answer instanceof CreateObjectAnswer) {
                    CreateObjectAnswer createAnswer = (CreateObjectAnswer)answer;
                    VolumeObjectTO newVol = (VolumeObjectTO)createAnswer.getData();
                    VolumeVO vol = volumeDao.findById(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

        CreateCmdResult result = new CreateCmdResult(null, null);
        if (snapshotResult) {
            SnapshotObjectTO newSnap = new SnapshotObjectTO();
            newSnap.setPath(UUID.randomUUID().toString());

            CreateObjectAnswer answer = new CreateObjectAnswer(newSnap);
            result.setAnswer(answer);
        } else {
            result.setResult("Failed to create snapshot");
        }
        callback.complete(result);
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.