cookbook 'rightscale_volume', '= 1.2.9'
rightscale_volume (16) Versions 1.2.9 Follow0
Provides a resource to manage volumes on any cloud RightScale supports.
cookbook 'rightscale_volume', '= 1.2.9', :supermarket
knife supermarket install rightscale_volume
knife supermarket download rightscale_volume
rightscale_volume cookbook
Description
This cookbook provides a rightscale_volume resource that can create, attach and manage a single
block level storage "volume" on numerous public and private IaaS clouds.
A volume provides a highly reliable, efficient storage solution that can be mounted to a
cloud server (within the same datacenter / zone) and persists independently from the life of the instance.
By using the RightScale API, this resource gives your recipes cloud portability without the need
to store your cloud credentials on each server.
Github Repository: https://github.com/rightscale-cookbooks/rightscale_volume
Requirements
- The system being configured must be a RightScale managed VM to have the required access to the RightScale API.
- Chef 11 or higher.
- Also requires a RightScale account that is registered with all the cloud vendors you expect to provision on (e.g. AWS, Rackspace, Openstack, CloudStack, GCE, and Azure).
Usage
The resource only handles manipulating the volume. Additional resources need to be created in
the recipe to manage the attached volume as a filesystem or logical volume.
The following example will create a 10 GB volume, attach it to the instance, formats the device as ext4
and mounts it to '/mnt/storage'.
# Creates a 10 GB volume rightscale_volume "db_data_volume" do size 10 action :create end # Attaches the volume to the instance rightscale_volume "db_data_volume" do action :attach end execute "format volume as ext4" do command lazy { "mkfs.ext4 #{node['rightscale_volume']['db_data_volume']['device']}" } action :run end execute "mount volume to /mnt/storage" do command lazy { "mkdir -p /mnt/storage; mount #{node['rightscale_volume']['db_data_volume']['device']} /mnt/storage" } action :run end
The following example will create a new volume from a snapshot.
rightscale_volume "db_data_volume_from_snapshot" do size 10 snapshot_id "my-snaphot-id" action [ :create, :attach ] end
The size
may or may not be honored depending on hypervisor used by the cloud vendor.
If the cloud does not support resize when creating a volume from a snapshot, then the size will be
the same as the volume from which the snapshot was taken. If resize is supported, additional
resources will be required to resize the filesystem on the volume.
Recipes
default
The default recipe installs the right_api_client
RubyGem, which this cookbook requires in
order to work with the RightScale API.
Resource/Providers
rightscale_volume
A resource to create, attach, and manage a single "volume" on public and private IaaS clouds.
Actions
Name | Description | Default |
---|---|---|
:create |
Creates a new volume in the cloud | yes |
:attach |
Attaches a volume to a RightScale server | |
:snapshot |
Takes a snapshot of a volume | |
:detach |
Detaches a volume from a RightScale server | |
:delete |
Deletes a volume from the cloud | |
:cleanup |
Cleans up old snapshots of a volume |
Attributes
Name | Description | Default | Required |
---|---|---|---|
nickname |
Name of the volume to be created | No | |
size |
Volume size in gigabytes | 1 |
No |
description |
Description for the volume | No | |
snapshot_id |
Snapshot ID to create the volume from | No | |
options |
Optional parameters hash for volume creation. For example, :volume_type on Rackspace Open Clouds and :iops on AWS clouds |
{} |
No |
timeout |
Throws an error if an action could not be completed within this timeout (in minutes) | 15 |
No |
max_snapshots |
The number of snapshots of a volume to retain when running the :cleanup action |
60 |
No |
Cloud Specific Notes
AWS EC2
- For this resource to work on a EC2 cloud, the RightScale account must be on a UCP cluster.
- This cloud supports creating volumes with provisioned IOPS. To create a volume with IOPS on EC2
pass the
:iops
option to theoptions
hash as shown below
rightscale_volume "volume_with_iops" do size 10 options {:iops => 100} action :create end
Rackspace Open Cloud
- The minimum volume size offered by this cloud is 100 GB. The
:create
volume action throws an error if the requested volume size is lesser than the minimum size offered. - This cloud supports two types of volume - SATA and SSD. The type of volume to be created can be
passed to the
options
parameter as below (defaults to SATA if none specified)
rightscale_volume "open_cloud_volume" do size 100 options {:volume_type => 'SSD'} action :create end
- A volume cannot be deleted from this cloud if at least one snapshot created from this volume
exists. To delete such a volume, all dependent snapshots must be cleaned up first. The
:delete
action does not delete such a volume and throws a warning message in the logs.
CloudStack Clouds
- CloudStack has the concept of a "custom" disk offering. If a "custom volume type" is supported in the cloud,
then the
:create
action creates a volume with the requested size. If "custom volume type" is not supported then this action will use the "closest volume type" with size greater than or equal to the requested size. If there are multiple custom volume types or multiple volume types with the closest size, the one with the greatest resource UID will be used.
Author
Author:: RightScale, Inc. (cookbooks@rightscale.com)
rightscale_volume Cookbook CHANGELOG
This file is used to list changes made in each version of the rightscale_volume cookbook.
v1.2.9
- Verify from OS perspective that volume has been attached.
v1.2.8
- Use correct Rackspace cloud name.
v1.2.7
- Include 'build-essentials' which installs packages required for compiling and installing right_api_client.
v1.2.6
- On AWS, determine next volume device name based on AWS UserGuide.
v1.2.5
- Don't pass volume type when restoring with snapshot ID on Cloudstack.
v1.2.4
- Scanning of volume changes to be done on VMware; previously only done on vSphere.
v1.2.3
- Support volume types on all clouds instead of just those that require it (#16).
v1.2.2
- Add 20 minute timeout for right_api_client calls.
v1.2.1
-
controller_type
can be passed in as an option.
v1.2.0
- Add shields.io badges to README.
- Add VMware vSphere support.
v1.1.1
- #9: Do not raise from load_current_resource when a volume that previously existed has been removed.
v1.1.0
- A
nickname
attribute is added which defaults to the value given in name attribute. This is useful if there are multiple resource actions on the same resource and the name needs to be unique. - The
:detach
action will not raise an exception if the volume is not found. - Fixed a bug where the volume was not created from the snapshot properly.
- The exception raised when a volume is deleted on OpenStack where it has dependent snapshots is rescued and logged.
- AWS Provisioned IOPS is supported on volume creation.
- Removed unused
delayed_evaluator
cookbook now that thelazy
evaluator is included in Chef 11.
v1.0.1
- Pull Request #6: Also check for 'gce' cloud type for google
- Added ChefSpec matchers
v1.0.0
- Initial release
Foodcritic Metric
1.2.9 passed this metric
1.2.9 passed this metric