cloudmesh.openstack.compute.Provider

Module Contents

Classes

Provider

class cloudmesh.openstack.compute.Provider.Provider(name=None)

Bases: cloudmesh.abstract.ComputeNodeABC.ComputeNodeABC, cloudmesh.provider.ComputeProviderPlugin

kind = openstack
sample = cloudmesh:   cloud:     {name}:       cm:         active: true         heading: {name}         host: TBD         label: {name}         kind: openstack         version: TBD         service: compute       credentials:         auth:           auth_url: "https://kvm.tacc.chameleoncloud.org:5000/v3"           username: TBD           project_id: {project_id}           project_name: {project_name}           user_domain_name: "Default"           password: TBD         region_name: {region}         interface: "public"         identity_api_version: "3"         key_path: ~/.ssh/id_rsa.pub       default:         size: m1.medium         image: CC-Ubuntu18.04         username: TBD         network: {network_id}
vm_state = ['ACTIVE', 'BUILDING', 'DELETED', 'ERROR', 'HARD_REBOOT', 'PASSWORD', 'PAUSED', 'REBOOT', 'REBUILD', 'RESCUED', 'RESIZED', 'REVERT_RESIZE', 'SHUTOFF', 'SOFT_DELETED', 'STOPPED', 'SUSPENDED', 'UNKNOWN', 'VERIFY_RESIZE']
output
Print(self, data, output=None, kind=None)
update_dict(self, elements, kind=None)

This function adds a cloudmesh cm dict to each dict in the list elements. Libcloud returns an object or list of objects With the dict method this object is converted to a dict. Typically this method is used internally.

Parameters
  • elements – the list of original dicts. If elements is a single dict a list with a single element is returned.

  • kind – for some kinds special attributes are added. This includes key, vm, image, flavor.

Returns

The list with the modified dicts

find(self, elements, name=None)

Finds an element in elements with the specified name.

Parameters
  • elements – The elements

  • name – The name to be found

Returns

keys(self)

Lists the keys on the cloud

Returns

dict

key_upload(self, key=None)

uploads the key specified in the yaml configuration to the cloud :param key: :return:

key_delete(self, name=None)

deletes the key with the given name :param name: The name of the key :return:

list_secgroups(self, name=None)

List the named security group

Parameters

name – The name of the group, if None all will be returned

Returns

list_secgroup_rules(self, name='default')

List the named security group

Parameters

name – The name of the group, if None all will be returned

Returns

add_secgroup(self, name=None, description=None)

Adds the security group with the given name :param name: Name of the group :param description: The description :return:

add_secgroup_rule(self, name=None, port=None, protocol=None, ip_range=None)

Adds the :param name: Name of the group :param port: The port number :param description: The description :return:

remove_secgroup(self, name=None)

Delete the names security group

Parameters

name – The name

Returns

upload_secgroup(self, name=None)

upload or update the security group with the given name The group will have a number of rules.

Parameters

name – name of the security group

Returns

add_rules_to_secgroup(self, name=None, rules=None)
remove_rules_from_secgroup(self, name=None, rules=None)
get_list(self, d, kind=None, debug=False, **kwargs)

Lists the dict d on the cloud :return: dict or libcloud object

images(self, **kwargs)

Lists the images on the cloud :return: dict or libcloud object

image(self, name=None)

Gets the image with a given name :param name: The name of the image :return: the dict of the image

flavors(self, **kwargs)

Lists the flavors on the cloud

Returns

dict of flavors

flavor(self, name=None)

Gets the flavor with a given name :param name: The name of the flavor :return: The dict of the flavor

start(self, name=None)

Start a server with the given name

Parameters

name – A list of node name

Returns

A list of dict representing the nodes

stop(self, name=None)

Stop a list of nodes with the given name

Parameters

name – A list of node name

Returns

A list of dict representing the nodes

pause(self, name=None)

Start a server with the given name

Parameters

name – A list of node name

Returns

A list of dict representing the nodes

unpause(self, name=None)

Stop a list of nodes with the given name

Parameters

name – A list of node name

Returns

A list of dict representing the nodes

info(self, name=None)

Gets the information of a node with a given name

Parameters

name – The name of teh virtual machine

Returns

The dict representing the node including updated status

status(self, name=None)
suspend(self, name=None)

NOT YET IMPLEMENTED.

suspends the node with the given name.

Parameters

name – the name of the node

Returns

The dict representing the node

resume(self, name=None)

resume a stopped node.

Parameters

name – the name of the node

Returns

the dict of the node

list(self)

Lists the vms on the cloud

Returns

dict of vms

destroy(self, name=None)

Destroys the node :param name: the name of the node :return: the dict of the node

reboot(self, name=None)

Reboot a list of nodes with the given name

Parameters

name – A list of node name

Returns

A list of dict representing the nodes

set_server_metadata(self, name, **metadata)

Sets the server metadata from the cm dict

Parameters
  • name – The name of the vm

  • metadata – The cm dict

Returns

get_server_metadata(self, name)

gets the metadata for the server

Parameters

name – name of the fm

Returns

delete_server_metadata(self, name, key)

gets the metadata for the server

Parameters

name – name of the fm

Returns

create(self, name=None, image=None, network=None, size=None, location=None, timeout=360, key=None, secgroup=None, ip=None, user=None, public=True, group=None, metadata=None, cloud=None, label=None, **kwargs)

creates a named node

Parameters
  • group – the list of groups the vm belongs to

  • name – the name of the node

  • image – the image used

  • size – the size of the image

  • timeout – a timeout in seconds that is invoked in case the image does not boot. The default is set to 3 minutes.

  • kwargs – additional arguments HEADING(c=”.”)ed along at time of boot

Returns

list_public_ips(self, ip=None, available=False)

Lists the public ip addresses.

Parameters

available – if True only those that are not allocated will be returned.

Returns

delete_public_ip(self, ip=None)

Deletes the ip address

Parameters

ip – the ip address, if None than all will be deleted

Returns

create_public_ip(self)

Creates a new public IP address to use

Returns

The ip address information

find_available_public_ip(self)

Returns a single public available ip address.

Returns

The ip

attach_public_ip(self, name=None, ip=None)

adds a public ip to the named vm

Parameters
  • name – Name of the vm

  • ip – The ip address

Returns

detach_public_ip(self, name=None, ip=None)

adds a public ip to the named vm

Parameters
  • name – Name of the vm

  • ip – The ip address

Returns

get_public_ip(self, server=None, name=None)

returns the public ip

Parameters

name – name of the server

Returns

get_private_ip(self, server=None, name=None)
console(self, vm=None)

gets the output from the console

Parameters

vm – name of the VM

Returns

log(self, vm=None)
abstract rename(self, name=None, destination=None)

rename a node. NOT YET IMPLEMENTED.

:param destination :param name: the current name :return: the dict with the new name

ssh(self, vm=None, command=None)
wait(self, vm=None, interval=None, timeout=None)

wais till the given VM can be logged into

Parameters
  • vm – name of the vm

  • interval – interval for checking

  • timeout – timeout

Returns