Add attribute type for openstack resources

Add type field to the schema of the openstack resources.

Implements: blueprint add-type-in-attributes-schema

Change-Id: I214b44095f0d79c4a1f80dee0219a8c68a534f0a
This commit is contained in:
tyagi 2015-05-12 04:54:14 -07:00
parent c38bee4977
commit d901500fd4
7 changed files with 58 additions and 28 deletions

View File

@ -141,46 +141,60 @@ class CinderVolume(vb.BaseVolume):
attributes_schema = {
AVAILABILITY_ZONE_ATTR: attributes.Schema(
_('The availability zone in which the volume is located.')
_('The availability zone in which the volume is located.'),
type=attributes.Schema.STRING
),
SIZE_ATTR: attributes.Schema(
_('The size of the volume in GB.')
_('The size of the volume in GB.'),
type=attributes.Schema.STRING
),
SNAPSHOT_ID_ATTR: attributes.Schema(
_('The snapshot the volume was created from, if any.')
_('The snapshot the volume was created from, if any.'),
type=attributes.Schema.STRING
),
DISPLAY_NAME_ATTR: attributes.Schema(
_('Name of the volume.')
_('Name of the volume.'),
type=attributes.Schema.STRING
),
DISPLAY_DESCRIPTION_ATTR: attributes.Schema(
_('Description of the volume.')
_('Description of the volume.'),
type=attributes.Schema.STRING
),
VOLUME_TYPE_ATTR: attributes.Schema(
_('The type of the volume mapping to a backend, if any.')
_('The type of the volume mapping to a backend, if any.'),
type=attributes.Schema.STRING
),
METADATA_ATTR: attributes.Schema(
_('Key/value pairs associated with the volume.')
_('Key/value pairs associated with the volume.'),
type=attributes.Schema.STRING
),
SOURCE_VOLID_ATTR: attributes.Schema(
_('The volume used as source, if any.')
_('The volume used as source, if any.'),
type=attributes.Schema.STRING
),
STATUS: attributes.Schema(
_('The current status of the volume.')
_('The current status of the volume.'),
type=attributes.Schema.STRING
),
CREATED_AT: attributes.Schema(
_('The timestamp indicating volume creation.')
_('The timestamp indicating volume creation.'),
type=attributes.Schema.STRING
),
BOOTABLE: attributes.Schema(
_('Boolean indicating if the volume can be booted or not.')
_('Boolean indicating if the volume can be booted or not.'),
type=attributes.Schema.STRING
),
METADATA_VALUES_ATTR: attributes.Schema(
_('Key/value pairs associated with the volume in raw dict form.')
_('Key/value pairs associated with the volume in raw dict form.'),
type=attributes.Schema.MAP
),
ENCRYPTED_ATTR: attributes.Schema(
_('Boolean indicating if the volume is encrypted or not.')
_('Boolean indicating if the volume is encrypted or not.'),
type=attributes.Schema.STRING
),
ATTACHMENTS: attributes.Schema(
_('The list of attachments of the volume.')
_('The list of attachments of the volume.'),
type=attributes.Schema.STRING
),
}

View File

@ -47,10 +47,12 @@ class NovaFloatingIp(resource.Resource):
attributes_schema = {
POOL_ATTR: attributes.Schema(
_('Pool from which floating IP is allocated.')
_('Pool from which floating IP is allocated.'),
type=attributes.Schema.STRING
),
IP: attributes.Schema(
_('Allocated floating IP address.')
_('Allocated floating IP address.'),
type=attributes.Schema.STRING
),
}

View File

@ -73,11 +73,13 @@ class KeyPair(resource.Resource):
attributes_schema = {
PUBLIC_KEY_ATTR: attributes.Schema(
_('The public key.')
_('The public key.'),
type=attributes.Schema.STRING
),
PRIVATE_KEY_ATTR: attributes.Schema(
_('The private key if it has been saved.'),
cache_mode=attributes.Schema.CACHE_NONE
cache_mode=attributes.Schema.CACHE_NONE,
type=attributes.Schema.STRING
),
}

View File

@ -107,9 +107,11 @@ class SaharaCluster(resource.Resource):
attributes_schema = {
STATUS: attributes.Schema(
_("Cluster status."),
type=attributes.Schema.STRING
),
INFO: attributes.Schema(
_("Cluster information."),
type=attributes.Schema.MAP
),
}

View File

@ -87,22 +87,28 @@ class SwiftContainer(resource.Resource):
attributes_schema = {
DOMAIN_NAME: attributes.Schema(
_('The host from the container URL.')
_('The host from the container URL.'),
type=attributes.Schema.STRING
),
WEBSITE_URL: attributes.Schema(
_('The URL of the container.')
_('The URL of the container.'),
type=attributes.Schema.STRING
),
ROOT_URL: attributes.Schema(
_('The parent URL of the container.')
_('The parent URL of the container.'),
type=attributes.Schema.STRING
),
OBJECT_COUNT: attributes.Schema(
_('The number of objects stored in the container.')
_('The number of objects stored in the container.'),
type=attributes.Schema.INTEGER
),
BYTES_USED: attributes.Schema(
_('The number of bytes stored in the container.')
_('The number of bytes stored in the container.'),
type=attributes.Schema.INTEGER
),
HEAD_CONTAINER: attributes.Schema(
_('A map containing all headers for the container.')
_('A map containing all headers for the container.'),
type=attributes.Schema.MAP
),
}

View File

@ -265,10 +265,12 @@ class OSDBInstance(resource.Resource):
attributes_schema = {
HOSTNAME: attributes.Schema(
_("Hostname of the instance.")
_("Hostname of the instance."),
type=attributes.Schema.STRING
),
HREF: attributes.Schema(
_("Api endpoint reference of the instance.")
_("Api endpoint reference of the instance."),
type=attributes.Schema.STRING
),
}

View File

@ -120,10 +120,12 @@ class TroveCluster(resource.Resource):
attributes_schema = {
INSTANCES: attributes.Schema(
_("A list of instances ids.")
_("A list of instances ids."),
type=attributes.Schema.LIST
),
IP: attributes.Schema(
_("IP of the cluster.")
_("IP of the cluster."),
type=attributes.Schema.LIST
)
}