3 # Copyright 2016 RIFT.IO Inc
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from . import exceptions
25 def impl(*args
, **kwargs
):
26 msg
= '{} not supported'.format(f
.__name
__)
27 raise exceptions
.RWErrorNotSupported(msg
)
34 Cloud defines a base class for cloud driver implementations. Note that
35 not all drivers will support the complete set of functionality presented
40 def get_management_network(self
, account
):
42 Returns the management network associated with the specified account.
44 @param account - a cloud account
46 @return a management network
51 def create_tenant(self
, account
, name
):
55 @param account - a cloud account
56 @param name - name to assign to the tenant.
61 def delete_tenant(self
, account
, tenant_id
):
65 @param account - a cloud account
66 @param tenant_id - id of tenant to be deleted.
71 def get_tenant_list(self
, account
):
75 @param account - a cloud account
80 def create_role(self
, account
, name
):
84 @param account - a cloud account
85 @param name - name to assign to the role.
90 def delete_role(self
, account
, role_id
):
94 @param account - a cloud account
95 @param role_id - id of role to be deleted.
100 def get_role_list(self
, account
):
104 @param account - a cloud account
109 def create_image(self
, account
, image
):
113 @param account - a cloud account
114 @param image - a description of the image to create
119 def delete_image(self
, account
, image_id
):
123 @param account - a cloud account
124 @param image_id - Instance id of VM image to be deleted.
129 def get_image_list(self
, account
):
131 Return a list of the names of all available images.
133 @param account - a cloud account
138 def get_image(self
, account
, image_id
):
140 Returns image information.
142 @param account - a cloud account
147 def create_vm(self
, account
, vm
):
149 Create a new virtual machine.
151 @param account - a cloud account
152 @param vm - The info required to create a VM
157 def start_vm(self
, account
, vm_id
):
159 start an existing virtual machine.
161 @param account - a cloud account
162 @param vm_id - The id of the VM to start
167 def stop_vm(self
, account
, vm_id
):
169 Stop a running virtual machine.
171 @param account - a cloud account
172 @param vm_id - The id of the VM to stop
177 def delete_vm(self
, account
, vm_id
):
179 delete a virtual machine.
181 @param account - a cloud account
182 @param vm_id - Instance id of VM to be deleted.
187 def reboot_vm(self
, account
, vm_id
):
189 reboot a virtual machine.
191 @param account - a cloud account
192 @param vm_id - Instance id of VM to be deleted.
197 def get_vm_list(self
, account
):
199 Return a list of vms.
201 @param account - a cloud account
206 def get_vm(self
, account
):
208 Return vm information.
210 @param account - a cloud account
215 def create_flavor(self
, account
, flavor
):
219 @param account - a cloud account
220 @param flavor - Flavor object
225 def delete_flavor(self
, account
, flavor_id
):
229 @param account - a cloud account
230 @param flavor_id - Flavor id to be deleted.
235 def get_flavor_list(self
, account
):
237 Return a list of flavors.
239 @param account - a cloud account
244 def get_flavor(self
, account
):
246 Return flavor information.
248 @param account - a cloud account
253 def get_network(self
, account
, network_id
):
257 @param account - a cloud account
258 @param network_id - unique network identifier
263 def get_network_list(self
, account
):
265 Return a list of networks
267 @param account - a cloud account
272 def create_network(self
, account
, network
):
276 @param account - a cloud account
277 @param network - Network object
282 def delete_network(self
, account
, network_id
):
286 @param account - a cloud account
287 @param network_id - unique network identifier
292 def get_port(self
, account
, port_id
):
296 @param account - a cloud account
297 @param port_id - unique port identifier
302 def get_port_list(self
, account
):
304 Return a list of ports
306 @param account - a cloud account
311 def create_port(self
, account
, port
):
315 @param account - a cloud account
316 @param port - port object
321 def delete_port(self
, account
, port_id
):
325 @param account - a cloud account
326 @param port_id - unique port identifier
331 def add_host(self
, account
, host
):
335 @param account - a cloud account
336 @param host - a host object
341 def remove_host(self
, account
, host_id
):
345 @param account - a cloud account
346 @param host_id - unique host identifier
351 def get_host(self
, account
, host_id
):
355 @param account - a cloud account
356 @param host_id - unique host identifier
361 def get_host_list(self
, account
):
363 Return a list of hosts
365 @param account - a cloud account