Skip to content

Latest commit

 

History

History
412 lines (277 loc) · 12.1 KB

command_register.rst

File metadata and controls

412 lines (277 loc) · 12.1 KB

Register Command

Registering different clouds with the cloudmesh register command is easy. We have a number of predefined templates that are stored in the ~/.cloudmesh .yaml file that you can use and modify. However for some clouds such as the once at IU an easy registration exists if you have appropriate access.

The manual page of the register command can be found at: register

Note

in some of our examples we will be using the user name albert

Quickstart for registration of some clouds

Please only use the quickstart if you know hat you are doing, otherwise, read the manual. We assume you have access to the specific clouds that you like to access. On a terminal say:

.. prompt:: bash, cm>

    register remote kilo


to register the FutureSystems kilo cloud

More information about the cloud can be found at

To register an openstack cloud for which you have an existing openrc.sh file, you can simply source the rc file first and than use the register env command:

.. prompt:: bash

    $ source openrc.sh
    $ register openrc.sh

Top obtain such an openrc.sh file you can typically use the horizon GUI and download it via the security panel of the project. If you have multiple project you can donwload them one by one and repeat that process. The command will use the defaults created by the openrc.sh file and than integrate them into the cloudmesh.yaml file. You can arbitrarily name the cloud/project but it must not yet have been used otherwise you are overwriting an existing cloud. Register commands such as list and backup will help you with the management

On chameleoncloud.org you can for example go to the horizon web interface and download the credentials in the security panel.

Introduction

As we are managing multiple clouds with cloudmesh we need to register them first. To make it easy for you cloudmesh reads the registered clouds from an easy to manage yaml file. This yam file is installed by:: default into the file:

~/.cloudmesh/cloudmesh.yaml

A number of templates in that file exist that refer to commonly used clouds. YOu can fill out the yaml file with your information, add new clouds, or delete templates of clouds that you do not use. We have several different types of clouds that we support. This includes OpenStack, AWS, and Azure clouds.

Warning

at this time we have not integrated our AWS and Azure IaaS abstractions in the new cloudmesh client. We will make them available in future.

As it may be inconvenient to edit this file and look at the yaml format, we provide several administrative commands. The command:

.. prompt:: bash, cm>

  register info

File /Users/albert/.cloudmesh/cloudmesh.yaml exists. ok.

identifies if the cloudmesh.yaml file exists. The register info command is very similar to the register list command but does not have as many options and is introduced for convenience.

To view the contents of that file, you can cat it or use the command:

.. prompt:: bash, cm>

  register cat

To edit the file you must have set the operating system variable EDITOR. This is ofeten done in Linux as part of the .bashrc file or explicitly with:

.. prompt:: bash

            export EDITOR=emacs

Once the EDITOR is set, you can use it with the the command:

.. prompt:: bash, cm>

  register edit


register list

To list the clouds that are defined in the cloudmesh.yaml file, you can use the command:

.. prompt:: bash, cm>

  register list


which will print a table with elementary information defined for the clouds.:

.. prompt:: bash, cm>

    register list

Clouds specified in the configuration file ~/.cloudmesh/cloudmesh.yaml

+----+---------+---------------+-----------+---------+--------+
| id | default | cloud         | iaas      | version | active |
+----+---------+---------------+-----------+---------+--------+
| 0  |         | cm            | openstack | kilo    | 2      |
| 1  | *       | kilo          | openstack | kilo    | 1      |
| 2  |         | chameleon     | openstack | kilo    |        |
| 3  |         | cybera-c      | openstack | kilo    |        |
| 4  |         | cybera-e      | openstack | kilo    |        |
| 5  |         | aws           | ec2       |         |        |
| 6  |         | chameleon-ec2 | ec2       | ec2     |        |
| 7  |         | azure         | azure     |         |        |
+----+---------+---------------+-----------+---------+--------+

See also: register info.

register ssh

As we also have to sometimes login to some remote hosts it is convenient to reuse the ssh command for that. ssh has the advantage of being able to use a config file in $HOME/.ssh/config. MOre information about ssh config files and their format can be found in the many web pages if you google for ssh config. In case you have defined a host india in ~/.ssh/config in the following way:

Host india
    Hostname india.futuresystems.org
    User yourusername

The list command followed by ssh will give you a list of hosts defined in that file:

.. prompt:: bash, cm>

    register list ssh

india

register remote

In case you already use an openstack cloud you may have come across an openrc.sh file. We are providing some very special helper functions, like for example obtain the openrc files from the FutureSystems cloud.

The command:

.. prompt:: bash, cm>

  register remote

will copy and register a machine on which an openrc.sh file is located into the cloudmesh.yaml file. With cloudmesh we provide some default host, thus they are very easy to configure. This includes kilo our current clouds in our lab.

These commands will only work if you have an account on this india and it is integrated into the ssh config file as discussed previously.

register export

To view the data associated with a particular cloud you can just use the command export:

$cm register export kilo --format=table

Which will look like this:

+-----------------------+------------------------------------------+
| Attribute             | Value                                    |
+-----------------------+------------------------------------------+
| OS_PASSWORD           | ********                                 |
| OS_VOLUME_API_VERSION | 2                                        |
| OS_IMAGE_API_VERSION  | 2                                        |
| OS_PROJECT_DOMAIN_ID  | default                                  |
| OS_USER_DOMAIN_ID     | default                                  |
| OS_TENANT_NAME        | fg1234                                   |
| OS_PROJECT_NAME       | fg1234                                   |
| OS_USERNAME           | albert                                   |
| OS_AUTH_URL           | https://kilo.futuresystems.org:5000/v3   |
| OS_VERSION            | kilo                                     |
| OS_OPENRC             | ~/.cloudmesh/clouds/india/kilo/openrc.sh |
+-----------------------+------------------------------------------+

Warning

ERROR

The default view returns a openrc.sh file:

.. prompt:: bash, cm>

   register export kilo

The output contains an rc file example:

export OS_PROJECT_DOMAIN_ID=default
export OS_USERNAME=albert
export OS_OPENRC=~/.cloudmesh/clouds/india/kilo/openrc.sh
export OS_AUTH_URL=https://kilo.futuresystems.org:5000/v3
export OS_TENANT_NAME=1234
export OS_USER_DOMAIN_ID=default
export OS_VERSION=kilo
export OS_VOLUME_API_VERSION=2
export OS_IMAGE_API_VERSION=2
export OS_PASSWORD=********
export OS_PROJECT_NAME=fg1234

The passwords will be masked with eight stars: ********. In case you like also to see the password you can use the --password flag.

.. comment::

    register merge
    ----------------

    .. todo:: the description of what this is doing was ambigous, we need
              to clarify if it only replaces to do or actually add things
              that do not exist, or just overwrites.

    In case you have already a yaml file, form another project
    you can merge two of them into the same cloudmesh yaml file. You
    simply have to specify the location of the file that you like to merge
    into the existing yaml file. However, please be careful, as it will
    overwrite the contents in ~/.cloudmesh/cloudmesh.yaml

    .. warning:: the description of what this is doing was ambigous, we need
          to clarify if it only replaces to do or actually add things
          that do not exist, or just overwrites.

    .. warning:: We used to have a .bak.# when we modified the yaml file, do
          you still have this

    Hence the command

    .. prompt:: bash, cm>

        register merge my_cloudmesh.yaml

    This command allows the content from another yaml file to be merged into the
    regular cloudmesh.yaml file. A backup of the old cloudmesh.yaml file is
    created with an increased number.

    .. note: The merge command is not tested



register CLOUD

In some cases it is nice to have an interactive mechanism to fill out the missing yaml file information that is indicated with TBD. This is useful, if you do not have an editor at hand. Thus you can use the command:

.. prompt:: bash, cm>

  register CLOUD

where cloud is the name of the cloud. Default names for the clouds can be found with the register list command.

The register CLOUD command will interactively ask for the values and add them into your yaml file:

.. prompt:: bash, cm>

    register kilo

Please enter email[TBD]:
Editing the credentials for cloud kilo
Please enter OS_TENANT_NAME[TBD]:
...
.. comment::

    register check
    ----------------------------------------------------------------------

    To find any not filled out values, you can use the command:

    .. prompt:: bash, cm>

      register check


    which hecks the yaml file for completness and list all fields that
    have the value TBD:

    .. prompt:: bash, cm>

        register check

    ::

          ERROR: The file has 11 values to be fixed

          email: TBD
          username: TBD
          flavor: TBD
          EC2_ACCESS_KEY: TBD
          EC2_SECRET_KEY: TBD
          keyname: TBD
          userid: TBD
          managementcertfile: TBD
          servicecertfile: TBD
          subscriptionid: TBD
          thumbprint: TBD

register json HOST

Instead of using the cat command and listing the contents of a cloud registration in yaml format you can also explicitly obtain a jason representation by issueing the command:

$ register json

It will return output in json format:

.. prompt:: bash, cm>

    register json azure

{
     "cm_heading": "Microsoft Azure Virtual Machines",
     "cm_label": "waz",
     "cm_host": "windowsazure.com",
     "default": {
         "flavor": "ExtraSmall",
         "image": "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2-LTS-amd64-server-20150610-en-us-30GB",
         "location": "East US"
     },
     "credentials": {
         "managementcertfile": "TBD",
         "servicecertfile": "TBD",
         "subscriptionid": "TBD",
         "thumbprint": "TBD"
     },
     "cm_type": "azure",
     "cm_type_version": null
 }

register profile

Instead of modifying the profile username in the cloudmesh yaml file manually, this command provides a convenient way of setting the username through cm shell:

.. prompt:: bash, cm>

   register profile

# ######################################################################
# Register profile
# ######################################################################
Enter firstname (TBD): Gregor
Enter lastname (TBD): von Laszewski
Enter email (TBD): laszewski@gmail.com
Enter user (TBD): gregor