Cloud Storage Inventory for OpenStack in ManageIQ

ManageIQ now collects cloud storage inventory for OpenStack providers. Currently, cloud storage is divided into two categories: block storage and object storage.

###Block Storage
The OpenStack block storage system (Cinder) provides persistent block storage resources that can be consumed by OpenStack compute instances. This storage is exposed through volumes. Volumes can be attached to compute instances as secondary storage (disks) or primary, bootable storage (boot disk).

The point in time state of a given volume can be saved in one or more volume snapshots. In turn, new volumes can be created based on existing snapshots.

Two new models, and their associated tables, have been added to ManageIQ to support the collection of block storage inventory: CloudVolume and CloudVolumeSnapshot.

The CloudVolume model is defined as follows:

class CloudVolume < ActiveRecord::Base
  include NewWithTypeStiMixin
  belongs_to :ext_management_system, :foreign_key => :ems_id
  belongs_to :availability_zone
  belongs_to :cloud_tenant
  belongs_to :base_snapshot, :class_name => 'CloudVolumeSnapshot'
  has_many   :cloud_volume_snapshots
  has_many   :attachments, :class_name => 'Disk', :as => :backing

  def self.available
    joins("LEFT OUTER JOIN disks ON disks.backing_id =")
      .where("disks.backing_id" => nil)

Here, cloud_volume_snapshots are all the snapshots taken of the volume in question, and base_snapshot is the snapshot on which the volume is based, if any.

If the volume is attached to an OpenStack instance, it will be associated through the backing of one of the instance’s virtual disks. This relationship is exposed through the attachments association.

The Disk model has been modified accordingly:

class Disk < ActiveRecord::Base
  belongs_to :hardware
  belongs_to :storage
  belongs_to :backing, :polymorphic => true

Where backing points to the attached volume, if any.

The CloudVolumeSnapshot model is as follows:

class CloudVolumeSnapshot < ActiveRecord::Base
  include NewWithTypeStiMixin

  belongs_to :ext_management_system, :foreign_key => :ems_id
  belongs_to :cloud_tenant
  belongs_to :cloud_volume
  has_many   :based_volumes, :class_name => 'CloudVolume'

Here, cloud_volume is the volume from which the snapshot was taken, and based_volumes are all of the volumes that were created based on the snapshot.

###Object Storage
The OpenStack object storage system (Swift) is a distributed object storage susyem, accessible through a simple container/object paradigm. Here, containers are like directories, containing zero or more objects (files). Unlike directories, containers only contain objects, and do not contain other containers.

This inventory relationship is implemented through the new CloudObjectStoreContainer and CloudObjectStoreObject models.

The CloudObjectStoreContainer model definition:

class CloudObjectStoreContainer < ActiveRecord::Base
  belongs_to :ext_management_system, :foreign_key => :ems_id
  belongs_to :cloud_tenant
  has_many   :cloud_object_store_objects

Here, simply, cloud_object_store_objects are the objects the container contains.

The CloudObjectStoreObject definition:

class CloudObjectStoreObject < ActiveRecord::Base
  belongs_to :ext_management_system, :foreign_key => :ems_id
  belongs_to :cloud_tenant
  belongs_to :cloud_object_store_container

Where cloud_object_store_container is the object’s parent container.

Note: Model definitions are presented here only to describe associations. The attributes of given model instances can be determined by examining their respective tables.