Package com.cloud.stack.models

Examples of com.cloud.stack.models.CloudStackVolume


     * @param request
     * @return
     */
    public EC2Volume detachVolume(EC2Volume request) {
        try {
            CloudStackVolume vol = getApi().detachVolume(null, request.getId(), null);
            EC2Volume resp = new EC2Volume();

            if(vol != null) {
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
                resp.setDevice(request.getDevice());
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setZoneName(vol.getZoneName());
                return resp;
            }

            throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
        } catch( Exception e ) {
View Full Code Here


                }
                if (diskOfferingId == null) throw new EC2ServiceException(ServerError.InternalError, "No Customize Disk Offering Found");
            }

//      // -> no volume name is given in the Amazon request but is required in the cloud API
            CloudStackVolume vol = getApi().createVolume(UUID.randomUUID().toString(), null, diskOfferingId, null, size, snapshotId, toZoneId(request.getZoneName(), null));
            if (vol != null) {
                EC2Volume resp = new EC2Volume();
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
//        resp.setDevice();
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setAttachmentState("detached");
                resp.setZoneName(vol.getZoneName());
                return resp;
            }
            return null;
        } catch( Exception e ) {
            logger.error( "EC2 CreateVolume - ", e);
View Full Code Here

  public EC2Volume attachVolume( EC2Volume request ) {
    try {  
      request.setDeviceId(mapDeviceToCloudDeviceId(request.getDevice()));
      EC2Volume resp = new EC2Volume();
     
      CloudStackVolume vol = getApi().attachVolume(request.getId(), request.getInstanceId(), request.getDeviceId());
      if(vol != null) {
        resp.setAttached(vol.getAttached());
        resp.setCreated(vol.getCreated());
        resp.setDevice(request.getDevice());
        resp.setDeviceId(vol.getDeviceId());
        resp.setHypervisor(vol.getHypervisor());
        resp.setId(vol.getId());
        resp.setInstanceId(vol.getVirtualMachineId());
        resp.setSize(vol.getSize());
        resp.setSnapshotId(vol.getSnapshotId());
        resp.setState(vol.getState());
        resp.setType(vol.getVolumeType());
        resp.setVMState(vol.getVirtualMachineState());
        resp.setZoneName(vol.getZoneName());
        return resp;
      }
      throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
    } catch( Exception e ) {
      logger.error( "EC2 AttachVolume 2 - ", e);
View Full Code Here

   * @param request
   * @return
   */
  public EC2Volume detachVolume(EC2Volume request) {
    try {
      CloudStackVolume vol = getApi().detachVolume(null, request.getId(), null);
      EC2Volume resp = new EC2Volume();
           
      if(vol != null) {
        resp.setAttached(vol.getAttached());
        resp.setCreated(vol.getCreated());
        resp.setDevice(request.getDevice());
        resp.setDeviceId(vol.getDeviceId());
        resp.setHypervisor(vol.getHypervisor());
        resp.setId(vol.getId());
        resp.setInstanceId(vol.getVirtualMachineId());
        resp.setSize(vol.getSize());
        resp.setSnapshotId(vol.getSnapshotId());
        resp.setState(vol.getState());
        resp.setType(vol.getVolumeType());
        resp.setVMState(vol.getVirtualMachineState());
        resp.setZoneName(vol.getZoneName());
        return resp;
      }

      throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
    } catch( Exception e ) {
View Full Code Here

        }
        if (diskOfferingId == null) throw new EC2ServiceException(ServerError.InternalError, "No Customize Disk Offering Found");
      }

//      // -> no volume name is given in the Amazon request but is required in the cloud API
      CloudStackVolume vol = getApi().createVolume(UUID.randomUUID().toString(), null, diskOfferingId, null, size, snapshotId, toZoneId(request.getZoneName(), null));
      if (vol != null) {
        EC2Volume resp = new EC2Volume();
        resp.setAttached(vol.getAttached());
        resp.setCreated(vol.getCreated());
//        resp.setDevice();
        resp.setDeviceId(vol.getDeviceId());
        resp.setHypervisor(vol.getHypervisor());
        resp.setId(vol.getId());
        resp.setInstanceId(vol.getVirtualMachineId());
        resp.setSize(vol.getSize());
        resp.setSnapshotId(vol.getSnapshotId());
        resp.setState(vol.getState());
        resp.setType(vol.getVolumeType());
        resp.setVMState(vol.getVirtualMachineState());
        resp.setZoneName(vol.getZoneName());
        return resp;
      }
      return null;
    } catch( Exception e ) {
      logger.error( "EC2 CreateVolume - ", e);
View Full Code Here

     */
    public EC2Volume attachVolume( EC2Volume request ) {
        EC2Volume resp = new EC2Volume();
        try {
            request.setDeviceId(mapDeviceToCloudDeviceId(request.getDevice()));
            CloudStackVolume vol = getApi().attachVolume(request.getId(), request.getInstanceId(), request.getDeviceId());
            if(vol != null) {
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
                resp.setDevice(request.getDevice());
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setAttachmentState(mapToAmazonVolumeAttachmentState(vol.getVirtualMachineState()));
                resp.setZoneName(vol.getZoneName());
            }
        } catch( Exception e ) {
            logger.error( "EC2 AttachVolume - ", e);
            handleException(e);
        }
View Full Code Here

                    if ( !request.getDevice().equalsIgnoreCase(devicePath) )
                        throw new Exception("Volume is not attached to the Device");
                }
            }

            CloudStackVolume vol = getApi().detachVolume(null , request.getId(), null);
            if(vol != null) {
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
                resp.setDevice(request.getDevice());
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setZoneName(vol.getZoneName());
            }
        } catch( Exception e ) {
            logger.error( "EC2 DetachVolume - ", e);
            handleException(e);
        }
View Full Code Here

                }
                if (diskOfferingId == null) throw new EC2ServiceException(ServerError.InternalError, "No Customize Disk Offering Found");
            }

//      // -> no volume name is given in the Amazon request but is required in the cloud API
            CloudStackVolume vol = getApi().createVolume(UUID.randomUUID().toString(), null, diskOfferingId, null, size, snapshotId, toZoneId(request.getZoneName(), null));
            if (vol != null) {
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
//        resp.setDevice();
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setAttachmentState("detached");
                resp.setZoneName(vol.getZoneName());
            }
        } catch( Exception e ) {
            logger.error( "EC2 CreateVolume - ", e);
            handleException(e);
        }
View Full Code Here

    public EC2Volume attachVolume( EC2Volume request ) {
        try {  
            request.setDeviceId(mapDeviceToCloudDeviceId(request.getDevice()));
            EC2Volume resp = new EC2Volume();

            CloudStackVolume vol = getApi().attachVolume(request.getId(), request.getInstanceId(), request.getDeviceId());
            if(vol != null) {
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
                resp.setDevice(request.getDevice());
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setAttachmentState(mapToAmazonVolumeAttachmentState(vol.getVirtualMachineState()));
                resp.setZoneName(vol.getZoneName());
                return resp;
            }
            throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
        } catch( Exception e ) {
            logger.error( "EC2 AttachVolume 2 - ", e);
View Full Code Here

     * @param request
     * @return
     */
    public EC2Volume detachVolume(EC2Volume request) {
        try {
            CloudStackVolume vol = getApi().detachVolume(null, request.getId(), null);
            EC2Volume resp = new EC2Volume();

            if(vol != null) {
                resp.setAttached(vol.getAttached());
                resp.setCreated(vol.getCreated());
                resp.setDevice(request.getDevice());
                resp.setDeviceId(vol.getDeviceId());
                resp.setHypervisor(vol.getHypervisor());
                resp.setId(vol.getId());
                resp.setInstanceId(vol.getVirtualMachineId());
                resp.setSize(vol.getSize());
                resp.setSnapshotId(vol.getSnapshotId());
                resp.setState(vol.getState());
                resp.setType(vol.getVolumeType());
                resp.setVMState(vol.getVirtualMachineState());
                resp.setZoneName(vol.getZoneName());
                return resp;
            }

            throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
        } catch( Exception e ) {
View Full Code Here

TOP

Related Classes of com.cloud.stack.models.CloudStackVolume

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.