cloudmesh_client.cloud package¶
Subpackages¶
- cloudmesh_client.cloud.hpc package
- cloudmesh_client.cloud.iaas package
- Subpackages
- cloudmesh_client.cloud.iaas.provider package
- Submodules
- cloudmesh_client.cloud.iaas.CloudProvider module
- cloudmesh_client.cloud.iaas.CloudProviderBase module
- Module contents
- Subpackages
Submodules¶
cloudmesh_client.cloud.ListResource module¶
-
class
cloudmesh_client.cloud.ListResource.
ListResource
[source]¶ Bases:
object
-
classmethod
get
(key, category='general')[source]¶ returns the value of the first objects matching the key with the given category.
Parameters: - key – The dictionary key
- category – The category
Returns:
-
classmethod
get_object
(key, category='general')[source]¶ returns the first object that matches the key in the Default database.
Parameters: - key – The dictionary key
- category – The category
Returns:
-
classmethod
list
(category=None, order=None, output='table')[source]¶ lists the default values in the specified format. TODO: This method has a bug as it uses format and output, only one should be used.
Parameters: - category – the category of the default value. If general is used it is a special category that is used for global values.
- order – The order in which the attributes are returned
- output – The output format. json, table, yaml, dict, csv
Returns:
-
classmethod
cloudmesh_client.cloud.attributes module¶
-
class
cloudmesh_client.cloud.attributes.
Attributes
[source]¶
cloudmesh_client.cloud.counter module¶
-
class
cloudmesh_client.cloud.counter.
Counter
[source]¶ Bases:
object
A counter is used to keep track of some value that can be increased and is associated with a user. Typically it is used to increment the vm id or the job id.
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
get
(name='counter', user=None)[source]¶ returns the value of the counter
Parameters: - name – name of the counter
- user – username associated with the counter
Returns: the value of the counter
-
cloudmesh_client.cloud.experiment module¶
cloudmesh_client.cloud.flavor module¶
-
class
cloudmesh_client.cloud.flavor.
Flavor
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
cloudmesh_client.cloud.group module¶
-
class
cloudmesh_client.cloud.group.
Group
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
classmethod
add
(name=None, species='vm', member=None, category=None)[source]¶ - Add an instance to a new group
- or add it to an existing one
Parameters: - name –
- species –
- member –
- cloud –
Returns:
-
classmethod
check
(name, cloud)[source]¶ checks if the group with the given name exists and raises exception
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
copy
(_fromName, _toName)[source]¶ Method to make copy of a group :param _fromName: :param _toName: :return:
-
classmethod
delete
(name=None)[source]¶ - Method to delete a group from
- the cloudmesh database
Parameters: - name –
- cloud –
Returns:
-
classmethod
get
(**kwargs)[source]¶ This method queries the database to fetch group(s) with given name filtered by cloud. :param name: :param cloud: :return:
-
classmethod
get_info
(category='general', name=None, output='table')[source]¶ Method to get info about a group :param cloud: :param name: :param output: :return:
-
classmethod
list
(name=None, order=None, header=None, output='table')[source]¶ lists the default values in the specified format. TODO: This method has a bug as it uses format and output, only one should be used.
Parameters: - category – the category of the default value. If general is used it is a special category that is used for global values.
- format – json, table, yaml, dict, csv
- order – The order in which the attributes are returned
- output – The output format.
Returns:
-
classmethod
merge
(group_a, group_b, merged_group)[source]¶ - Method to merge two groups into
- one group
Parameters: - group_a –
- group_b –
- merged_group –
Returns:
-
order
= ['name', 'member', 'user', 'category', 'type', 'species']¶
-
classmethod
cloudmesh_client.cloud.hpc module¶
This module is used to interface with classical HPC queuing systems.
cloudmesh_client.cloud.image module¶
-
class
cloudmesh_client.cloud.image.
Image
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
list
(cloud, format='table')[source]¶ This method lists all images of the cloud :param cloud: the cloud name
-
cloudmesh_client.cloud.ip module¶
cloudmesh_client.cloud.key module¶
-
class
cloudmesh_client.cloud.key.
Key
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
classmethod
add_azure_key_to_db
(key_name, key_path, certificate_path, pfx_path)[source]¶ - Adds the public key to the existing database model and adds the certificate, key and fingerprint into the azure key database model.
Parameters: - key_name – Key name to be added
- key_path – Public key path
- certificate_path – Certificate file path(PEM file)
- pfx_path – PKCS encoded certificate path
Returns:
-
classmethod
add_from_path
(path, keyname=None, user=None, source=None, uri=None, store=True)[source]¶ Adds the key to the database based on the path
Parameters: keyname – name of the key or path to the key Returns:
-
classmethod
add_key_to_cloud
(user, keyname, cloud)[source]¶ Parameters: - user –
- keyname –
- cloud –
- name_on_cloud –
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
get
(name=None, output='dict')[source]¶ Finds the key on the database by name
Parameters: name – name of the key to be found Returns: Query object of the search
-
classmethod
get_from_cloud
(cloud, live=False, format='table')[source]¶ This method lists all keys of the cloud :param cloud: the cloud name :return: a SSHKeyManager (dict of keys)
-
classmethod
get_from_git
(username, store=True)[source]¶ Parameters: username – the github username Returns: an array of public keys Return type: list
-
classmethod
get_from_yaml
(filename=None, load_order=None, store=True)[source]¶ Parameters: filename – name of the yaml file Returns: a SSHKeyManager (dict of keys)
-
classmethod
list
(category=None, live=False, output='table')[source]¶ this does not work only returns all ceys in the db
-
classmethod
cloudmesh_client.cloud.launcher module¶
-
class
cloudmesh_client.cloud.launcher.
Launcher
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
cloudmesh_client.cloud.list module¶
-
class
cloudmesh_client.cloud.list.
List
[source]¶ Bases:
object
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
cloudmesh_client.cloud.network module¶
-
class
cloudmesh_client.cloud.network.
Network
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
classmethod
associate_floating_ip
(cloudname, instance_name, floating_ip)[source]¶ Method to associate floating ip to an instance :param cloudname: :param instance_name: :param floating_ip: :return:
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
create_assign_floating_ip
(cloudname, instance_name)[source]¶ Method to create a new floating-ip and associate it with the instance :param cloudname: cloud :param instance_name: name of instance :return: floating_ip
-
classmethod
create_floating_ip
(cloudname, floating_pool=None)[source]¶ Method to create a floating ip address under a pool :param cloudname: :param floating_pool: :return: floating ip addr
-
classmethod
delete_floating_ip
(cloudname, floating_ip_or_id)[source]¶ Method to delete a floating ip address :param cloudname: :param floating_ip_or_id: :return:
-
classmethod
disassociate_floating_ip
(cloudname, instance_name, floating_ip)[source]¶ Disassociates a floating ip from an instance :param cloudname: :param instance_name: :param floating_ip: :return:
-
classmethod
find_instance_name
(**kwargs)[source]¶ Method to find instance name :param kwargs: :return: instance_name
-
classmethod
get_fixed_ip
(cloudname, fixed_ip_addr, output='table')[source]¶ Method retrieves fixed ip info :param cloudname: :param fixed_ip_addr: :return: fixed_ip_info
-
classmethod
get_floating_ip
(cloudname, floating_ip_or_id, output='table')[source]¶ Method to get floating ip info :param cloudname: :param floating_ip_or_id: :return: floating ip info
-
classmethod
get_floating_ip_list
(cloudname)[source]¶ Method to get the floating IP list :param cloudname: :return: floating_ips
-
classmethod
get_instance_dict
(**kwargs)[source]¶ Method to get instance dict :param kwargs: :return: instance dict
-
classmethod
get_unused_floating_ip_list
(cloudname)[source]¶ Method to get the unused floating IP list :param cloudname: :return: floating_ips
-
classmethod
isIPAddr
(ip_or_id)[source]¶ Method to check if argument is IP address or notS :param ip_or_id: :return:
-
classmethod
list_floating_ip
(cloudname, output='table')[source]¶ Method to list floating ips :param cloudname: :return: floating ip list
-
classmethod
list_floating_ip_pool
(cloudname)[source]¶ Method to list floating ip pool :param cloudname: :return:
-
classmethod
list_unused_floating_ip
(cloudname, output='table')[source]¶ Method to list unused floating ips These floating ips are not associated with any instance :param cloudname: :return: floating ip list
-
classmethod
cloudmesh_client.cloud.nova module¶
cloudmesh_client.cloud.register module¶
-
class
cloudmesh_client.cloud.register.
CloudRegister
[source]¶ Bases:
object
-
classmethod
check_yaml_for_completeness
(filename)[source]¶ outputs how many values has to be fixed in cloudmesh.yaml file
Parameters: filename (string) – the file name Returns:
-
classmethod
fill_out_form
(filename)[source]¶ edits profile and clouds from cloudmesh.yaml :param filename: :type filename: string :return:
-
classmethod
from_environ
(provider)[source]¶ Reads env OS_* variables and registers a new cloud in yaml, interactively. :return:
-
classmethod
from_file
(filename)[source]¶ Replaces the TBD in cloudmesh.yaml with the contents present in FILEPATH’s FILE :param filename: :return:
-
classmethod
list
(filename, cloud, info=False, output='table')[source]¶ lists clouds from cloudmesh.yaml file
Parameters: filename (string) – Returns:
-
classmethod
read_env_config
()[source]¶ Function that will read OS_* vairables from environment and populate dict env_config_data. :return: env_config_data dict
-
classmethod
read_rc_file
(host, openrc, force=False)[source]¶ Parameters: - host (string) – the host name
- openrc (string) – the file name
Returns:
-
classmethod
remote
(host, force=False)[source]¶ TODO: there is a bug in the instalation of kilo the openrc file on the remote machine is not called openrc.sh but contains username and project number.
Parameters: - host – the remote host
- force –
Returns:
-
classmethod
cloudmesh_client.cloud.reservation module¶
-
class
cloudmesh_client.cloud.reservation.
Reservation
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
classmethod
add
(name, start, end, user=None, project=None, hosts=None, description=None, category=None)[source]¶ Parameters: - name – Name of reservation
- start – Start time of reservation
- end – End time of reservation
- user – Reserved by this user
- project – Reservation project
- hosts – Reserved hosts
- description – Description
- cloud – Cloud into which reservation done
Returns:
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
delete
(name=None, start=None, end=None, user=None, project=None, hosts=None)[source]¶ Parameters: - name – Name of reservation
- start – Start time of reservation
- end – End time of reservation
- user – Reserved by this user
- project – Reservation project
- hosts – Hosts reserved
Returns:
-
info
(user=None, project=None)[source]¶ prints if the user has access to the reservation an on which host.
Parameters: - user –
- project –
Returns:
-
classmethod
cloudmesh_client.cloud.secgroup module¶
-
class
cloudmesh_client.cloud.secgroup.
SecGroup
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
classmethod
add_rule_to_db
(group=None, name=None, from_port=None, to_port=None, protocol=None, cidr=None)[source]¶
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶ NOT USED @classmethod def convert_list_to_dict(cls, os_result):
d = {} for i, obj in enumerate(os_result):
d[i] = {} d[i][“Id”] = obj.id d[i][“Name”] = obj.name d[i][“Description”] = obj.descriptionreturn d
-
classmethod
create
(group=None, category=None)[source]¶ Method creates a new security group in database & returns the uuid of the created group :param group: :param category: :return:
-
classmethod
get
(name=None, cloud='general')[source]¶ This method queries the database to fetch secgroup with given name filtered by cloud. :param name: :param cloud: :return:
-
classmethod
list
(group=None, name=None, category='general', output='table', scope='all')[source]¶ This method queries the database to fetch list of secgroups filtered by cloud. :param cloud: :return:
-
classmethod
list_rules
(group=None, output='table')[source]¶ This method gets the security group rules from the cloudmesh database :param uuid: :return:
-
classmethod
cloudmesh_client.cloud.stack module¶
-
class
cloudmesh_client.cloud.stack.
BigDataStack
(dest, repo='git://github.com/futuresystems/big-data-stack.git', branch='master', **kwargs)[source]¶ Bases:
object
-
deploy
(ips=None, name=None, user=None, playbooks=None, defines=None)[source]¶ Deploy the big-data-stack to a previously stood up cluster located at ips with login user user.
Parameters: - ips (
list
ofstr
IP addresses) – the ip addresses of the cluster to deploy to - name (
str
) – the name of the cluster - user (
str
) – the login username of the cluster - playbooks (
list
ofstr
) – the list of playbooks to deploy. These are paths relative to the root directory of the BDS repository. - defines (
dict
from playbook name todict
of variable name to value) – the overridden variables defined for each playbook - ping_max (
int
) – the maximum number of time to attempt to ping the cluster during the verification step. - ping_sleep (
int
) – the number of seconds to wait between each attempt to ping
- ips (
-
-
class
cloudmesh_client.cloud.stack.
Project
(name, stack, deployparams=None)[source]¶ Bases:
object
Captures the parameters and stack for a deployment. Note: this is a lower-level API that should be predominantly be constructed using the
ProjectFactory
.-
filename
= '.cloudmesh_project.yml'¶
-
metadata
¶
-
-
class
cloudmesh_client.cloud.stack.
ProjectDB
(prefix='~/.cloudmesh/projects')[source]¶ Bases:
object
-
activate
(project)[source]¶ Activate the given project
Parameters: project ( Project
) – the project to make active
-
add
(project, force=False, update=False)[source]¶ Add a project to the database
Parameters: - project (
Project
) – the project to add_from_path - force (
bool
) – whether or not to force initialiation - update (
bool
) – whether or not to update a previous initialied project
- project (
-
default_name
= 'p-'¶
-
filename
= '.cloudmesh_projectdb.yml'¶
-
getactive
()[source]¶ Returns the currently active project.
Returns: the currently active project Return type: subclass of Project
Raises: KeyError
if no project is currently active
-
isactive
(project)[source]¶ Predicate indicating activation status of the project
Parameters: project ( Project
) – the project to checkReturn type: bool
-
lookup
(projname)[source]¶ Lookup the project with the given name.
If projname is None, this returns the currently active project.
Parameters: projname – Project name Returns: the project Return type: Project
-
new_project_name
()[source]¶ Automatically generate a new project name
Returns: a project name Return type: str
-
projectdir
(name)[source]¶ Get the project directory.
Parameters: name ( str
) – the name of a projectReturns: the path to the project Return type: str
-
-
class
cloudmesh_client.cloud.stack.
ProjectFactory
(prefix='~/.cloudmesh/projects')[source]¶ Bases:
object
Outer API used to create projects.
This factory should be used rather than directly constructing
Project
instances.
-
exception
cloudmesh_client.cloud.stack.
SanityCheckError
(message, reason)[source]¶ Bases:
exceptions.Exception
-
class
cloudmesh_client.cloud.stack.
SanityChecker
[source]¶ Bases:
object
-
check_github
()[source]¶ Ensure that the default ssh key has been uploaded to github.com
Returns: None Raises: SanityCheckError
on failure
-
check_program
(program)[source]¶ Verify that the named program is available and executable by the user.
Parameters: program – commands that must be present by checking in the PATH Returns: None Raises: SanityCheckError
on failure
-
check_sshkey
()[source]¶ Ensure that the default ssh key exists with correct permissions
Returns: None Raises: SanityCheckError
-
-
cloudmesh_client.cloud.stack.
get_virtualenv_environment
(venvpath)[source]¶ Figures out the environment variables that are set when activating a virtualenv
Example: >>> os.system(‘virtualenv /tmp/venv’) >>> get_virtualenv_environment(‘/tmp/venv’)
Parameters: venvpath – path to the virtual environment Returns: dictionary of environment variables Return type: dict
cloudmesh_client.cloud.sync module¶
-
class
cloudmesh_client.cloud.sync.
Sync
[source]¶ Bases:
object
-
classmethod
get_host
(cloudname)[source]¶ Method to get host for cloud from the cloudmesh.yaml file :param cloudname: :return:
-
classmethod
get_hostname
(host)[source]¶ Method to return hostname for a host in ssh config :param host: :return:
-
classmethod
cloudmesh_client.cloud.vc module¶
-
class
cloudmesh_client.cloud.vc.
Vc
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶ vc key list NAMES [–usort]
-
cloudmesh_client.cloud.vm module¶
-
class
cloudmesh_client.cloud.vm.
Vm
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
get
(key, category=None)[source]¶ returns the value of the first objects matching the key with the given category.
Parameters: - key – The dictionary key
- category – The category
Returns:
-
cloudmesh_client.cloud.workflow module¶
-
class
cloudmesh_client.cloud.workflow.
Workflow
[source]¶ Bases:
cloudmesh_client.cloud.ListResource.ListResource
-
cm
= <cloudmesh_client.db.CloudmeshDatabase.CloudmeshDatabase object>¶
-
classmethod
list
(name, live=False, format='table')[source]¶ This method lists all workflows of the cloud :param cloud: the cloud name
-