Repository navigation
Expand file tree
/
Copy pathnode.py
More file actions
135 lines (122 loc) · 5.85 KB
/
Copy pathnode.py
File metadata and controls
135 lines (122 loc) · 5.85 KB
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
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from openstack.bare_metal import bare_metal_service
from openstack import resource2 as resource
class Node(resource.Resource):
resources_key = 'nodes'
base_path = '/nodes'
service = bare_metal_service.BareMetalService()
# capabilities
allow_create = True
allow_get = True
allow_update = True
allow_delete = True
allow_list = True
patch_update = True
_query_mapping = resource.QueryParameters(
'associated', 'driver', 'fields', 'provision_state', 'resource_class',
instance_id='instance_uuid',
is_maintenance='maintenance',
)
# Properties
#: The UUID of the chassis associated wit this node. Can be empty or None.
chassis_id = resource.Body("chassis_uuid")
#: The current clean step.
clean_step = resource.Body("clean_step")
#: Timestamp at which the node was last updated.
created_at = resource.Body("created_at")
#: The name of the driver.
driver = resource.Body("driver")
#: All the metadata required by the driver to manage this node. List of
#: fields varies between drivers, and can be retrieved from the
#: :class:`openstack.bare_metal.v1.driver.Driver` resource.
driver_info = resource.Body("driver_info", type=dict)
#: Internal metadata set and stored by node's driver. This is read-only.
driver_internal_info = resource.Body("driver_internal_info", type=dict)
#: A set of one or more arbitrary metadata key and value pairs.
extra = resource.Body("extra")
#: The UUID of the node resource.
id = resource.Body("uuid", alternate_id=True)
#: Information used to customize the deployed image, e.g. size of root
#: partition, config drive in the form of base64 encoded string and other
#: metadata.
instance_info = resource.Body("instance_info")
#: UUID of the nova instance associated with this node.
instance_id = resource.Body("instance_uuid")
#: Whether console access is enabled on this node.
is_console_enabled = resource.Body("console_enabled", type=bool)
#: Whether node is currently in "maintenance mode". Nodes put into
#: maintenance mode are removed from the available resource pool.
is_maintenance = resource.Body("maintenance", type=bool)
#: Any error from the most recent transaction that started but failed to
#: finish.
last_error = resource.Body("last_error")
#: A list of relative links, including self and bookmark links.
links = resource.Body("links", type=list)
#: user settable description of the reason why the node was placed into
#: maintenance mode.
maintenance_reason = resource.Body("maintenance_reason")
#: Human readable identifier for the node. May be undefined. Certain words
#: are reserved. Added in API microversion 1.5
name = resource.Body("name")
#: Network interface provider to use when plumbing the network connections
#: for this node. Introduced in API microversion 1.20.
network_interface = resource.Body("network_interface")
#: Links to the collection of ports on this node.
ports = resource.Body("ports", type=list)
#: Links to the collection of portgroups on this node. Available since
#: API microversion 1.24.
port_groups = resource.Body("portgroups", type=list)
#: The current power state. Usually "power on" or "power off", but may be
#: "None" if service is unable to determine the power state.
power_state = resource.Body("power_state")
#: Physical characteristics of the node. Content populated by the service
#: during inspection.
properties = resource.Body("properties", type=dict)
#: The current provisioning state of the node.
provision_state = resource.Body("provision_state")
#: The current RAID configuration of the node.
raid_config = resource.Body("raid_config")
#: The name of an service conductor host which is holding a lock on this
#: node, if a lock is held.
reservation = resource.Body("reservation")
#: A string to be used by external schedulers to identify this node as a
#: unit of a specific type of resource. Added in API microversion 1.21.
resource_class = resource.Body("resource_class")
#: Links to the collection of states.
states = resource.Body("states", type=list)
#: The requested state if a provisioning action has been requested. For
#: example, ``AVAILABLE``, ``DEPLOYING``, ``DEPLOYWAIT``, ``DEPLOYING``,
#: ``ACTIVE`` etc.
target_provision_state = resource.Body("target_provision_state")
#: The requested state during a state transition.
target_power_state = resource.Body("target_power_state")
#: The requested RAID configration of the node which will be applied when
#: the node next transitions through the CLEANING state.
target_raid_config = resource.Body("target_raid_config")
#: Timestamp at which the node was last updated.
updated_at = resource.Body("updated_at")
class NodeDetail(Node):
base_path = '/nodes/detail'
# capabilities
allow_create = False
allow_get = False
allow_update = False
allow_delete = False
allow_list = True
_query_mapping = resource.QueryParameters(
'associated', 'driver', 'fields', 'provision_state', 'resource_class',
instance_id='instance_uuid',
is_maintenance='maintenance',
)
#: The UUID of the node resource.
id = resource.Body("uuid", alternate_id=True)