Also add documentation and normalization, of which there was previously not. Change-Id: Ib4ba4fc748117ae4339683ae9fd4f9f958c3cc0e
11 KiB
Data Model
shade has a very strict policy on not breaking backwards compatability ever. However, with the data structures returned from OpenStack, there are places where the resource structures from OpenStack are returned to the user somewhat directly, leaving a shade user open to changes/differences in result content.
To combat that, shade 'normalizes' the return structure from OpenStack in many places, and the results of that normalization are listed below. Where shade performs normalization, a user can count on any fields declared in the docs as being completely safe to use - they are as much a part of shade's API contract as any other Python method.
Some OpenStack objects allow for arbitrary attributes at the root of the object. shade will pass those through so as not to break anyone who may be counting on them, but as they are arbitrary shade can make no guarantees as to their existence. As part of normalization, shade will put any attribute from an OpenStack resource that is not in its data model contract into an attribute called 'properties'. The contents of properties are defined to be an arbitrary collection of key value pairs with no promises as to any particular key ever existing.
If a user passes strict=True to the shade constructor, shade will not pass through arbitrary objects to the root of the resource, and will instead only put them in the properties dict. If a user is worried about accidentally writing code that depends on an attribute that is not part of the API contract, this can be a useful tool. Keep in mind all data can still be accessed via the properties dict, but any code touching anything in the properties dict should be aware that the keys found there are highly user/cloud specific. Any key that is transformed as part of the shade data model contract will not wind up with an entry in properties - only keys that are unknown.
Location
A Location defines where a resource lives. It includes a cloud name and a region name, an availability zone as well as information about the project that owns the resource.
The project information may contain a project id, or a combination of one or more of a project name with a domain name or id. If a project id is present, it should be considered correct.
Some resources do not carry ownership information with them. For those, the project information will be filled in from the project the user currently has a token for.
Some resources do not have information about availability zones, or may exist region wide. Those resources will have None as their availability zone.
If all of the project information is None, then
= dict(
Location =str(),
cloud=str(),
region=str() or None,
zone=dict(
projectid=str() or None,
=str() or None,
name=str() or None,
domain_id=str() or None)) domain_name
Flavor
A flavor for a Nova Server.
= dict(
Flavor =Location(),
locationid=str(),
=str(),
name=bool(),
is_public=bool(),
is_disabled=int(),
ram=int(),
vcpus=int(),
disk=int(),
ephemeral=int(),
swap=float(),
rxtx_factor=dict(),
extra_specs=dict()) properties
Flavor Access
An access entry for a Nova Flavor.
= dict(
FlavorAccess =str(),
flavor_id=str()) project_id
Image
A Glance Image.
= dict(
Image =Location(),
locationid=str(),
=str(),
name=int(),
min_ram=int(),
min_disk=int(),
size=int(),
virtual_size=str(),
container_format=str(),
disk_format=str(),
checksum=str(),
created_at=str(),
updated_at=str(),
owner=bool(),
is_public=bool(),
is_protected=str(),
visibility=str(),
status=list(),
locations=str() or None,
direct_url=list(),
tags=dict()) properties
Security Group
A Security Group from either Nova or Neutron
= dict(
SecurityGroup =Location(),
locationid=str(),
=str(),
name=str(),
description=list(),
security_group_rules=dict()) properties
Security Group Rule
A Security Group Rule from either Nova or Neutron
= dict(
SecurityGroupRule =Location(),
locationid=str(),
=str(), # oneof('ingress', 'egress')
direction=str(),
ethertype=int() or None,
port_range_min=int() or None,
port_range_max=str() or None,
protocol=str() or None,
remote_ip_prefix=str() or None,
security_group_id=str() or None
remote_group_id=dict()) properties
Server
A Server from Nova
= dict(
Server =Location(),
locationid=str(),
=str(),
name=dict() or str(),
image=dict(),
flavor=list(), # Volume
volumes=str(),
interface_ip=bool(),
has_config_drive=str(),
accessIPv4=str(),
accessIPv6=dict(), # string, list(Address)
addresses=str(),
created=str(),
key_name=dict(), # string, string
metadata=str(),
private_v4=int(),
progress=str(),
public_v4=str(),
public_v6=list(), # SecurityGroup
security_groups=str(),
status=str(),
updated=str(),
user_id=str() or None,
host_id=str() or None,
power_state=str() or None,
task_state=str() or None,
vm_state=str() or None,
launched_at=str() or None,
terminated_at=str() or None,
task_state=dict()) properties
ComputeLimits
Limits and current usage for a project in Nova
= dict(
ComputeLimits =Location(),
location=int(),
max_personality=int(),
max_personality_size=int(),
max_server_group_members=int(),
max_server_groups=int(),
max_server_meta=int(),
max_total_cores=int(),
max_total_instances=int(),
max_total_keypairs=int(),
max_total_ram_size=int(),
total_cores_used=int(),
total_instances_used=int(),
total_ram_used=int(),
total_server_groups_used=dict()) properties
ComputeUsage
Current usage for a project in Nova
= dict(
ComputeUsage =Location(),
location=str(),
started_at=str(),
stopped_at=list(),
server_usages=int(),
max_personality=int(),
max_personality_size=int(),
max_server_group_members=int(),
max_server_groups=int(),
max_server_meta=int(),
max_total_cores=int(),
max_total_instances=int(),
max_total_keypairs=int(),
max_total_ram_size=int(),
total_cores_used=int(),
total_hours=int(),
total_instances_used=int(),
total_local_gb_usage=int(),
total_memory_mb_usage=int(),
total_ram_used=int(),
total_server_groups_used=int(),
total_vcpus_usage=dict()) properties
ServerUsage
Current usage for a server in Nova
= dict(
ComputeUsage =str(),
started_at=str(),
ended_at=str(),
flavor=int(),
hours=str(),
instance_id=int(),
local_gb=int(),
memory_mb=str(),
name=str(),
state=int(),
uptime=int(),
vcpus=dict()) properties
Floating IP
A Floating IP from Neutron or Nova
= dict(
FloatingIP =Location(),
locationid=str(),
=str(),
description=bool(),
attached=str() or None,
fixed_ip_address=str() or None,
floating_ip_address=str() or None,
network=str() or None,
port=str(),
router=str(),
status=str() or None,
created_at=str() or None,
updated_at=int() or None,
revision_number=dict()) properties
Project
A Project from Keystone (or a tenant if Keystone v2)
Location information for Project has some specific semantics.
If the project has a parent project, that will be in location.project.id, and if it doesn't that should be None. If the Project is associated with a domain that will be in location.project.domain_id regardless of the current user's token scope. location.project.name and location.project.domain_name will always be None. Finally, location.region_name will always be None as Projects are global to a cloud. If a deployer happens to deploy OpenStack in such a way that users and projects are not shared amongst regions, that necessitates treating each of those regions as separate clouds from shade's POV.
= dict(
Project =Location(),
locationid=str(),
=str(),
name=str(),
description=bool(),
is_enabled=bool(),
is_domain=dict()) properties
Volume
A volume from cinder.
= dict(
Volume =Location(),
locationid=str(),
=str(),
name=str(),
description=int(),
size=list(),
attachments=str(),
status=str() or None,
migration_status=str() or None,
host=str() or None,
replication_driver=str() or None,
replication_status=str() or None,
replication_extended_status=str() or None,
snapshot_id=str(),
created_at=str() or None,
updated_at=str() or None,
source_volume_id=str() or None,
consistencygroup_id=str() or None,
volume_type=dict(),
metadata=bool(),
is_bootable=bool(),
is_encrypted=bool(),
can_multiattach=dict()) properties
VolumeType
A volume type from cinder.
= dict(
VolumeType =Location(),
locationid=str(),
=str(),
name=str() or None,
description=bool(),
is_public=str() or None,
qos_specs_id=dict(),
extra_specs=dict()) properties
VolumeTypeAccess
A volume type access from cinder.
= dict(
VolumeTypeAccess =Location(),
location=str(),
volume_type_id=str(),
project_id=dict()) properties
ClusterTemplate
A Cluster Template from magnum.
= dict(
ClusterTemplate =Location(),
location=int(),
apiserver_port=str(),
cluster_distro=str(),
coe=str(),
created_at=str(),
dns_nameserver=int(),
docker_volume_size=str(),
external_network_id=str() or None,
fixed_network=str(),
flavor_id=str() or None,
http_proxy=str() or None,
https_proxyid=str(),
=str(),
image_id=str(),
insecure_registry=bool(),
is_public=bool(),
is_registry_enabled=bool(),
is_tls_disabled=str(),
keypair_id=dict(),
labels=str() or None,
master_flavor_id=str(),
name=str(),
network_driver=str() or None,
no_proxy=str(),
server_type=str() or None,
updated_at=str(),
volume_driver=dict()) properties
MagnumService
A Magnum Service from magnum
= dict(
MagnumService =Location(),
location=str(),
binary=str(),
created_at=str() or None,
disabled_reason=str(),
hostid=str(),
=int(),
report_count=str(),
state=dict()) properties