Update the version.properties
[so.git] / aria / multivim-plugin / src / main / python / multivim-plugin / docs / types.rst
1
2 .. highlight:: yaml
3
4 Types
5 ^^^^^
6
7 Node Types
8 ==========
9
10 .. cfy:node:: cloudify.openstack.nodes.Server
11
12     An OpenStack server.
13
14
15 .. cfy:node:: cloudify.openstack.nodes.WindowsServer
16
17     This type has the same properties and operations-mapping as the type above (as it derives from it), yet it overrides some of the agent and plugin installations operations-mapping derived from the built-in cloudify.nodes.Compute type. Use this type when working with a Windows server.
18
19     Additionally, the default value for the use_password property is overridden for this type, and is set to true. When using an image with a preset password, it should be modified to false.
20
21
22 .. cfy:node:: cloudify.openstack.nodes.KeyPair
23
24
25 .. cfy:node:: cloudify.openstack.nodes.Image
26
27
28 .. cfy:node:: cloudify.openstack.nodes.SecurityGroup
29
30
31 .. cfy:node:: cloudify.openstack.nodes.Router
32
33
34 .. cfy:node:: cloudify.openstack.nodes.Port
35
36
37 .. cfy:node:: cloudify.openstack.nodes.Network
38
39
40 .. cfy:node:: cloudify.openstack.nodes.Subnet
41
42
43 .. cfy:node:: cloudify.openstack.nodes.FloatingIP
44
45
46 .. cfy:node:: cloudify.openstack.nodes.Volume
47
48
49 .. cfy:node:: cloudify.openstack.nodes.Project
50
51
52 Types' Common Behaviors
53 =======================
54
55 Validations
56 -----------
57
58 All types offer the same base functionality for the ``cloudify.interfaces.validation.creation`` interface operation:
59
60   * If it's a new resource (``use_external_resource`` is set to ``false``), the basic validation is to verify there's enough quota to allocate a new resource of the given type.
61
62   * When [using an existing resource](#using-existing-resources), the validation ensures the resource indeed exists.
63
64
65 Runtime Properties
66 ------------------
67
68 Node instances of any of the types defined in this plugin get set with the following runtime properties during the ``cloudify.interfaces.lifecycle.create`` operation:
69
70   * ``external_id`` the Openstack ID of the resource
71   * ``external_type`` the Openstack type of the resource
72   * ``external_name`` the Openstack name of the resource
73
74 The only exceptions are the two *floating-ip* types - Since floating-ip objects on Openstack don't have a name, the ``external_name`` runtime property is replaced with the ``floating_ip_address`` one, which holds the object's actual IP address.
75
76
77 Default Resource Naming Convention
78 ----------------------------------
79
80 When creating a new resource (i.e. ``use_external_resource`` is set to ``false``), its name on Openstack will be the value of its ``resource_id`` property. However, if this value is not provided, the name will default to the following schema:
81
82 ``<openstack-resource-type>_<deployment-id>_<node-instance-id>``
83
84 For example, if a server node is defined as so::
85
86     node_templates:
87       myserver:
88         type: cloudify.openstack.nodes.Server
89         ...
90
91 Yet without setting the ``resource_id`` property, then the server's name on Openstack will be ``server_my-deployment_myserver_XXXXX`` (where the XXXXX is the autogenerated part of the node instance's ID).
92
93
94
95 Using Existing Resources
96 ------------------------
97
98 It is possible to use existing resources on Openstack - whether these have been created by a different Cloudify deployment or not via Cloudify at all.
99
100 All Cloudify Openstack types have a property named ``use_external_resource``, whose default value is ``false``. When set to ``true``, the plugin will apply different semantics for each of the operations executed on the relevant node's instances. Specifically, in the case of the ``cloudify.interfaces.lifecycle.create`` operation, rather than creating a new resource on Openstack of the given type, the plugin will behave as follows:
101
102 1. Try to find an existing resource on Openstack whose name (or IP, in the case of one of the **floating-ip** types) is the value specified for the ``resource_id`` property. If more than one is found, an error is raised.
103
104 2. If no resource was found, the plugin will use the value of the ``resource_id`` property to look for the resource by ID instead. If a resource still isn't found, an error is raised.
105
106 3. If a single resource was found, the plugin will use that resource, and set the node instance with the appropriate runtime properties according to the resource's data.
107
108
109 The semantics of other operations are affected as well:
110
111 * The ``cloudify.interfaces.lifecycle.start`` operation, where applicable, will only validate that the resource is indeed started, raising an error if it isn't.
112
113 * The ``cloudify.interfaces.lifecycle.stop`` operation, where applicable, won't have any effect.
114
115 * The ``cloudify.interfaces.lifecycle.delete`` operation will not actually delete the resource from Openstack (but will clear the runtime properties from the node instance).
116
117 * The ``cloudify.interfaces.validation.creation`` operation will verify that a resource with the given name or ID indeed exists, or otherwise print a list of all available resources of the given type.
118
119 * The ``cloudify.interfaces.relationship_lifecycle.establish`` operation will behave as normal if the related node is not set with ``use_external_resource`` as ``true``; However if both nodes have this property set to ``true``, the operation will only attempt to verify that they're indeed "connected" on Openstack as well ("connected" in this case also refers to a security-group imposed on a server, floating-ip associated with a server, etc.).
120
121
122 Notes
123 -----
124
125 * As mentioned in the [Relationships section](#relationships), some relationships take effect in non-relationship operations. When ``use_external_resource`` is set to ``true``, the existence of such connections is validated as well.
126
127 * Using an existing resource only makes sense for single-instance nodes.
128
129
130
131
132 Relationships
133 =============
134
135     Not all relationships have built-in types
136     (i.e., some types may simply get connected using standard Cloudify relationships such as ``cloudify.relationships.connected_to``).
137
138     Some relationships take effect in non-relationship operations,
139     e.g. a subnet which is connected to a network actually gets connected on subnet's creation
140     (in the ``cloudify.interfaces.lifecycle.create`` operation)
141     and not in a ``cloudify.interfaces.relationship_lifecycle.establish`` operation - this occurs whenever the connection information is required on resource creation.
142
143
144 .. cfy:rel:: cloudify.openstack.server_connected_to_port
145
146     A relationship for connecting a server to a port. The server will use this relationship to automatically connect to the port upon server creation.
147
148
149 .. cfy:rel:: cloudify.openstack.port_connected_to_security_group
150
151     A relationship for a port to a security group.
152
153
154 .. cfy:rel:: cloudify.openstack.server_connected_to_keypair
155
156
157 .. cfy:rel:: cloudify.openstack.port_connected_to_subnet
158
159     A relationship for connecting a port to a subnet. This is useful when a network has multiple subnets, and a port should belong to a specific subnet on that network. The port will then receive some IP from that given subnet.
160
161     Note that when using this relationship in combination with the port type's property `fixed_ip`, the IP given should be on the CIDR of the subnet connected to the port.
162
163     *Note*: This relationship has no operations associated with it; The port will use this relationship to automatically connect to the subnet upon port creation.
164
165
166 .. cfy:rel:: cloudify.openstack.server_connected_to_security_group
167
168     A relationship for setting a security group on a server.
169
170
171 .. cfy:rel:: cloudify.openstack.subnet_connected_to_router
172
173     A relationship for connecting a subnet to a router.
174
175
176 .. cfy:rel:: cloudify.openstack.port_connected_to_floating_ip
177
178     A relationship for associating a floating ip with a port. If that port is later connected to a server, the server will be accessible via the floating IP.
179
180
181 .. cfy:rel:: cloudify.openstack.server_connected_to_floating_ip
182
183     A relationship for associating a floating ip with a server.
184
185
186 .. cfy:rel:: cloudify.openstack.volume_attached_to_server
187
188     A relationship for attaching a volume to a server.