Skip to content

xgu1-ds/cloudmesh-volume

 
 

Repository files navigation

Cloudmesh Volume Management

Note: The README.md page is outomatically generated, do not edit it. To modify change the content in https://github.com/cloudmesh/cloudmesh-volume/blob/master/README-source.md Curley brackets must use two in README-source.md

image Python License Format Status Travis

Abstract

A simple abstraction layer to manage Cloud Volumes for AWS, Azure, Google, Openstack, Oracle and Multipass

In this project we will be developing features related to completing and simplifying the volume management interface to an existing cloud. We will also benchmark the clouds while comparing the volume management functions that are deployed on different clouds.

Manual

Usage:
  volume list [NAMES]
              [--vm=VM]
              [--region=REGION]
              [--cloud=CLOUD]
              [--refresh]
              [--dryrun]
              [--output=FORMAT]
  volume create [NAME]
              [--size=SIZE]
              [--volume_type=TYPE]
              [--description=DESCRIPTION]
              [--dryrun]
              [--region=REGION]
              [--path=PATH]
  volume attach [NAMES] [--vm=VM]
  volume detach [NAMES]
  volume delete [NAMES]
  volume add_tag [NAME]
              [--key=KEY]
              [--value=VALUE]
  volume status [NAME]
  volume migrate [NAME]
              [--vm=VM]
              [--cloud=CLOUD]
  volume sync [NAMES]
              [--cloud=CLOUD]
  volume purge [--cloud=CLOUD]

This command manages volumes across different clouds

Arguments:
    NAME   the name of the volume
    NAMES  the names of multiple volumes

Options:
    --vm=VM              The name of the virtual machine
    --region=REGION      The name of the region
    --cloud=CLOUD        The name of the cloud
    --refresh            If refresh the info is taken from the cloud
    --volume_type=TYPE   The type of the volume
    --output=FORMAT      Output format [default: table]
    --key=KEY            The tag key
    --value=VALUE        The value of tag key
    --snapshot           The snapshot of volume
    --path=PATH          The path of local volume

Description:

  volume list [NAMES]
              [--vm=VM]
              [--region=REGION]
              [--cloud=CLOUD]
              [--refresh]
              [--dryrun]
              [--output=FORMAT]
      List all the volumes for certain vm, region, or cloud.

  volume create [NAME]
                [--size=SIZE]
                [--volume_type=TYPE]
                [--description=DESCRIPTION]
                [--dryrun]
                [--snapshot=SNAPSHOT]
                [--region=REGION]
      Creates a volume

  volume status [NAMES]
                [--cloud=CLOUD]
      Get the status (e.g. 'available', 'READY', 'in-use') of a volume

  volume attach [NAMES]
                [--vm=VM]
      Attach volume to a vm

  volume detach [NAMES]
      Detach volume from a vm

  volume delete [NAMES]
      Delete the named volumes

  volume migrate [NAME]
                 [--vm=VM]
                 [--cloud=CLOUD]
       Migrate volume from one vm to another vm in the same provider.

  volume sync [NAMES]
              [--cloud=CLOUD]
      Volume sync allows for data to be shared between two volumes.

  volume purge [--cloud=CLOUD]
      Volume purge delete all the "deleted" volumes in MongoDB
      database

See also: Volume man page

API documentation

The complete documentation of volume API is available at

Github Code Repo

Installation

Users

The user can install cloudmesh volume with

pip install cloudmesh-volume

Developers

Developers want the source code and do the development in the directory. We use the cloudmesh-installer to do this. Make sure you use a virtual environment such as ~/ENV3. We recommend using python 3.8.2

mkdir cm
cd cm
pip install cloudmesh-installer -U
cloudmesh-installer get volume

In case you need to reinstall the venv you can use

cloudmesh-installer new ~/ENV3 storage --python=python3.8

PLease note to use the python program for your system. This may be different.

Users Guide

  • Create Volume

To create a new volume. For multipass, creates a directory, volume region means path of the directory, i.e. "/Users/username/multipass" For aws, creates EBS volume in EC2 service, volume region means availability zone. For azure, creates disk, volume region means location. For google, creates zonal disks, volume region means zone of volume. For oracle, creates volume in block-storage service, volume region means availability_domain. For openstack, creates volume, volume region means zone.

Example 1: To create a volume with default parameters and generated name:

cms volume create

Example 2: To create a test_volume of 100 GB in us-east-2a:

cms volume create test_volume --size=100 --region=us-east-2a
  • List Volume

To list volumes.

If volume name or names are not given and refresh is True, return the information of volume through the cloud. If volume name or names are not given and refresh is False, return the information of volume through database. If volume name or names are given, return the information of volume through the cloud. If vm is specified, it will print out all the volumes attached to vm. If region(zone) is specified, it will print out all the volumes in that zone.

Please check following table about available functions for each cloud service:

List with Refresh List without Refresh List One Volume List Multiple Volumes List by Region List by vm
AWS * * * * * *
Azure * * *
Google * * * * * *
Multipass * * * * *
Openstack * * * *
Oracle * * * *

Example 1: To return the information of volume through current cloud provider.

cms volume list --refresh

Example 2: To return the information of test_volume1 and test_volume2 through openstack cloud provider.

cms volume list test_volume1,test_volume2 --cloud=openstack
  • Delete Volume

To delete volume or volumes from multiple cloud providers permanently and is irreversible. Make sure volume is not attached to any vm before running delete command. The volume will be updated in the database with status set to 'deleted'. All data on the volume will be permanently lost when the volume is deleted. (Use purge to remove deleted volumes from database)

Example 1: To delete current volume

cms volume delete

Example 2: To delete test_volume1,test_volume2

cms volume delete test_volume1,test_volume2
  • Attach Volume

To attach one or more volumes to a vm. The volume being attached needs to be located in the same zone as the vm. For aws, a vm can have multiple attached volumes. GCP (google) requires that the instance be stopped when attaching a disk. If the instance is running when the attach function is called, the function will stop the instance and then restart the instance after attaching the disk.

Please check following table for available functions for each cloud service:

Attach One Volume Attach Multiple Volumes
AWS * *
Azure *
Google * *
Multipass * *
Openstack *
Oracle *

Example 1: To attach test_volume1 to test_vm

cms volume attach test_volume1 --vm=test_vm
  • Detach Volume

To detach volume or volumes from all vm. GCP (google) requires that the instance be stopped when detaching a disk.
If the instance is running when the detach function is called, the function will stop the instance and then restart the instance after detaching the disk.

Example 1: To detach current volume from vm

cms volume detach
  • Volume Status

To return status of volume, such as "available", "in-use" and etc.

Example 1: To return test_volume information with status.

cms volume status test_volume
  • Migrate Volume

To migrate volume to vm in the same cloud service, if no given volume, migrate the current volume. Implemented for aws and multipass provider.

Example 1: To migrate test_volume volume to test_vm in the aws cloud service

cms volume migrate test_volume --vm=test_vm --cloud=aws
  • Sync Volume

To sync first volume with second volume in the same cloud service. When len(NAMES)==2, sync volume (NAMES[0]) with volume (NAMES[1]) When len(NAMES)==1, sync current volume with volume(NAMES[0]) Implemented for aws and multipass provider.

Example 1: To sync test_volume1 with test_volume2 in aws cloud provider.

cms volume sync test_volume1,test_volume2 --cloud=aws
  • Add Tags to Volume

Add tag to a volume. If name is not specified, then tag will be added to the current volume. For aws, can use add_tag command to rename a volume.

Example 1: To add tag {key:value} to test_volume.

cms volume add_tag test_volume --key=key --value=value

Example 2: To rename aws test_volume into new_name.

cms volume add_tag test_volume --key=Name --value=new_name

Volume Providers

Multipass

AWS

In AWS, volume is EBS volume in EC2 services.

Google

In Google Cloud Platform (GCP), volumes are referred to as 'disks'. There are regional disks, which replicate data between two zones in the same region, and zonal disks, which only store data in a single zone. Currently, only management functions for zonal disks are supported.

Also, the GCP project ID is required to be set in the configuration file. In order to use multiple projects, copy the google section in the configuration file under each of the cloud, storage, and volume sections and create additional google sections named google2, google3, ... for each of the additional GCP projects.

Azure

Similar to Google, in Azure, volumes are referred to as 'disks'.

OpenStack

Oracle

Documentation about migration between cloud providers

Test cases

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.6%
  • Makefile 1.8%
  • Shell 1.6%