cloudmesh-cloud.cloudmesh.compute.libcloud.Provider

Module Contents

Classes

Provider

class cloudmesh-cloud.cloudmesh.compute.libcloud.Provider.Provider(name=None, configuration='~/.cloudmesh/cloudmesh.yaml')

Bases: cloudmesh.abstract.ComputeNodeABC.ComputeNodeABC

ProviderMapper

this may be buggy as the fields could be differentbased on the provider TODO: fix output base on provider so we may need to do

output = {“aws”: {“vm”: ….,,

“image”: ….,, “flavor”: ….,,

“google”: {“vm”: ….,,

“image”: ….,, “flavor”: ….,,

output
update_dict(self, elements, kind=None)

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 elements

  • kind – Kind is image, flavor, or node

Returns

find(self, elements, name=None, raw=False)

finds an element in elements with the specified name :param elements: The elements :param name: The name to be found :param: If raw is True, elements is a libcloud object.

Otherwise elements is a dict

Parameters

raw – if raw is used the return from the driver is used and not a cleaned dict, not implemented

Returns

keys(self, raw=False)

Lists the keys on the cloud :param raw: If raw is set to True the lib cloud object is returned

otherwise a dict is returened.

Returns

dict or libcloud object

key_upload(self, key)

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

list_secgroups(self, raw=False)

List the named security group

Parameters

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

Returns

list_secgroup_rules(self, secgroup='default', raw=False)

List the named security group

Parameters

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

Returns

add_secgroup(self, secgroupname, description='')
remove_secgroup(self, secgroupname)
add_rules_to_secgroup(self, secgroupname, newrules)
remove_rules_from_secgroup(self, secgroupname, rules)
images(self, raw=False, **kwargs)

Lists the images on the cloud :param raw: If raw is set to True the lib cloud object is returned

otherwise a dict is returened.

Returns

dict or libcloud object

image(self, name=None, **kwargs)

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

flavors(self, raw=False)

Lists the flavors on the cloud :param raw: If raw is set to True the lib cloud object is returned

otherwise a dict is returened.

Returns

dict or libcloud object

flavor(self, name=None)

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

apply(self, fname, names)

apply a function to a given list of nodes

Parameters
  • fname – Name of the function to be applied to the given nodes

  • names – A list of node names

Returns

A list of dict representing the nodes

start(self, names=None)

Start a list of nodes with the given names

Parameters

names – A list of node names

Returns

A list of dict representing the nodes

stop(self, names=None)

Stop a list of nodes with the given names

Parameters

names – A list of node names

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

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, raw=False)

Lists the vms on the cloud :param raw: If raw is set to True the lib cloud object is returned

otherwise a dict is returened.

Returns

dict or libcloud object

destroy(self, names=None)

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

reboot(self, names=None)

Reboot a list of nodes with the given names

Parameters

names – A list of node names

Returns

A list of dict representing the nodes

create(self, name=None, image=None, size=None, location=None, timeout=360, **kwargs)

creates a named node

Parameters
  • name – the name of the node

  • image – the image used

  • size – the size of the image

  • location – the location 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

get_public_ip(self)

ex_attach_floating_ip_to_node(node, ip) ex_detach_floating_ip_from_node(node, ip) ex_delete_floating_ip(ip)

attach_public_ip(self, node, ip)

adds a public ip to the named vm

Parameters
  • name – Name of the vm

  • ip – The ip address

Returns

detach_public_ip(self, node, ip)

adds a public ip to the named vm

Parameters
  • name – Name of the vm

  • ip – The ip address

Returns

rename(self, name=None, destination=None)

rename a node. NOT YET IMPLEMENTED.

Parameters
  • destination

  • name – the current name

Returns

the dict with the new name

ssh(self, name=None, command=None)