File: model.rst

package info (click to toggle)
python-openstacksdk 0.50.0-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,632 kB
  • sloc: python: 83,132; sh: 194; makefile: 21
file content (540 lines) | stat: -rw-r--r-- 12,435 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
==========
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

.. code-block:: python

  Location = dict(
    cloud=str(),
    region_name=str(),
    zone=str() or None,
    project=dict(
      id=str() or None,
      name=str() or None,
      domain_id=str() or None,
      domain_name=str() or None))


Resources
=========

Flavor
------

A flavor for a Nova Server.

.. code-block:: python

  Flavor = dict(
    location=Location(),
    id=str(),
    name=str(),
    is_public=bool(),
    is_disabled=bool(),
    ram=int(),
    vcpus=int(),
    disk=int(),
    ephemeral=int(),
    swap=int(),
    rxtx_factor=float(),
    extra_specs=dict(),
    properties=dict())


Flavor Access
-------------

An access entry for a Nova Flavor.

.. code-block:: python

  FlavorAccess = dict(
    flavor_id=str(),
    project_id=str())


Image
-----

A Glance Image.

.. code-block:: python

  Image = dict(
    location=Location(),
    id=str(),
    name=str(),
    min_ram=int(),
    min_disk=int(),
    size=int(),
    virtual_size=int(),
    container_format=str(),
    disk_format=str(),
    checksum=str(),
    created_at=str(),
    updated_at=str(),
    owner=str(),
    is_public=bool(),
    is_protected=bool(),
    visibility=str(),
    status=str(),
    locations=list(),
    direct_url=str() or None,
    tags=list(),
    properties=dict())


Keypair
-------

A keypair for a Nova Server.

.. code-block:: python

  Keypair = dict(
    location=Location(),
    name=str(),
    id=str(),
    public_key=str(),
    fingerprint=str(),
    type=str(),
    user_id=str(),
    private_key=str() or None
    properties=dict())


Security Group
--------------

A Security Group from either Nova or Neutron

.. code-block:: python

  SecurityGroup = dict(
    location=Location(),
    id=str(),
    name=str(),
    description=str(),
    security_group_rules=list(),
    properties=dict())

Security Group Rule
-------------------

A Security Group Rule from either Nova or Neutron

.. code-block:: python

  SecurityGroupRule = dict(
    location=Location(),
    id=str(),
    direction=str(),  # oneof('ingress', 'egress')
    ethertype=str(),
    port_range_min=int() or None,
    port_range_max=int() or None,
    protocol=str() or None,
    remote_ip_prefix=str() or None,
    security_group_id=str() or None,
    remote_group_id=str() or None
    properties=dict())

Server
------

A Server from Nova

.. code-block:: python

  Server = dict(
    location=Location(),
    id=str(),
    name=str(),
    image=dict() or str(),
    flavor=dict(),
    volumes=list(),  # Volume
    interface_ip=str(),
    has_config_drive=bool(),
    accessIPv4=str(),
    accessIPv6=str(),
    addresses=dict(),  # string, list(Address)
    created=str(),
    created_at=str(),
    key_name=str(),
    metadata=dict(),  # string, string
    private_v4=str(),
    progress=int(),
    public_v4=str(),
    public_v6=str(),
    security_groups=list(),  # SecurityGroup
    status=str(),
    updated=str(),
    user_id=str(),
    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=str() or None,
    block_device_mapping=dict() or None,
    instance_name=str() or None,
    hypervisor_name=str() or None,
    tags=list(),
    personality=str() or None,
    scheduler_hints=str() or None,
    user_data=str() or None,
    properties=dict())

ComputeLimits
-------------

Limits and current usage for a project in Nova

.. code-block:: python

  ComputeLimits = dict(
    location=Location(),
    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=int(),
    properties=dict())

ComputeUsage
------------

Current usage for a project in Nova

.. code-block:: python

  ComputeUsage = dict(
    location=Location(),
    started_at=str(),
    stopped_at=str(),
    server_usages=list(),
    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=int(),
    properties=dict())

ServerUsage
-----------

Current usage for a server in Nova

.. code-block:: python

  ComputeUsage = dict(
    started_at=str(),
    ended_at=str(),
    flavor=str(),
    hours=int(),
    instance_id=str(),
    local_gb=int(),
    memory_mb=int(),
    name=str(),
    state=str(),
    uptime=int(),
    vcpus=int(),
    properties=dict())

Floating IP
-----------

A Floating IP from Neutron or Nova


.. code-block:: python

  FloatingIP = dict(
    location=Location(),
    id=str(),
    description=str(),
    attached=bool(),
    fixed_ip_address=str() or None,
    floating_ip_address=str() or None,
    network=str() or None,
    port=str() or None,
    router=str(),
    status=str(),
    created_at=str() or None,
    updated_at=str() or None,
    revision_number=int() or None,
    properties=dict())

Volume
------

A volume from cinder.

.. code-block:: python

  Volume = dict(
    location=Location(),
    id=str(),
    name=str(),
    description=str(),
    size=int(),
    attachments=list(),
    status=str(),
    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() or None,
    created_at=str(),
    updated_at=str() or None,
    source_volume_id=str() or None,
    consistencygroup_id=str() or None,
    volume_type=str() or None,
    metadata=dict(),
    is_bootable=bool(),
    is_encrypted=bool(),
    can_multiattach=bool(),
    properties=dict())


VolumeType
----------

A volume type from cinder.

.. code-block:: python

  VolumeType = dict(
    location=Location(),
    id=str(),
    name=str(),
    description=str() or None,
    is_public=bool(),
    qos_specs_id=str() or None,
    extra_specs=dict(),
    properties=dict())


VolumeTypeAccess
----------------

A volume type access from cinder.

.. code-block:: python

  VolumeTypeAccess = dict(
    location=Location(),
    volume_type_id=str(),
    project_id=str(),
    properties=dict())


ClusterTemplate
---------------

A Cluster Template from magnum.

.. code-block:: python

  ClusterTemplate = dict(
    location=Location(),
    apiserver_port=int(),
    cluster_distro=str(),
    coe=str(),
    created_at=str(),
    dns_nameserver=str(),
    docker_volume_size=int(),
    external_network_id=str(),
    fixed_network=str() or None,
    flavor_id=str(),
    http_proxy=str() or None,
    https_proxy=str() or None,
    id=str(),
    image_id=str(),
    insecure_registry=str(),
    is_public=bool(),
    is_registry_enabled=bool(),
    is_tls_disabled=bool(),
    keypair_id=str(),
    labels=dict(),
    master_flavor_id=str() or None,
    name=str(),
    network_driver=str(),
    no_proxy=str() or None,
    server_type=str(),
    updated_at=str() or None,
    volume_driver=str(),
    properties=dict())

MagnumService
-------------

A Magnum Service from magnum

.. code-block:: python

  MagnumService = dict(
    location=Location(),
    binary=str(),
    created_at=str(),
    disabled_reason=str() or None,
    host=str(),
    id=str(),
    report_count=int(),
    state=str(),
    properties=dict())

Stack
-----

A Stack from Heat

.. code-block:: python

  Stack = dict(
    location=Location(),
    id=str(),
    name=str(),
    created_at=str(),
    deleted_at=str(),
    updated_at=str(),
    description=str(),
    action=str(),
    identifier=str(),
    is_rollback_enabled=bool(),
    notification_topics=list(),
    outputs=list(),
    owner=str(),
    parameters=dict(),
    parent=str(),
    stack_user_project_id=str(),
    status=str(),
    status_reason=str(),
    tags=dict(),
    tempate_description=str(),
    timeout_mins=int(),
    properties=dict())

Identity Resources
==================

Identity Resources are slightly different.

They are global to a cloud, so location.availability_zone and
location.region_name and will always be None. 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.

The Identity Resources that are not Project do not exist within a Project,
so all of the values in ``location.project`` will be None.

Project
-------

A Project from Keystone (or a tenant if Keystone v2)

Location information for Project has some additional 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`` in addition to the normal ``domain_id``
regardless of the current user's token scope.

.. code-block:: python

  Project = dict(
    location=Location(),
    id=str(),
    name=str(),
    description=str(),
    is_enabled=bool(),
    is_domain=bool(),
    domain_id=str(),
    properties=dict())

Role
----

A Role from Keystone

.. code-block:: python

  Project = dict(
    location=Location(),
    id=str(),
    name=str(),
    domain_id=str(),
    properties=dict())