Alert.png The wiki is deprecated and due to be decommissioned by the end of September 2022.
The content is being migrated to other supports, new updates will be ignored and lost.
If needed you can get in touch with EGI SDIS team using operations @ egi.eu.

Difference between revisions of "Federated Cloud OCCI to IM Migration"

From EGIWiki
Jump to navigation Jump to search
Line 111: Line 111:
  deploy vm 1;
  deploy vm 1;
|}
|}
== Contextualisation ==
OCCI allows two different contextualisation options:
* public key: this is added to the default user in the image by cloud init
* user data: blob interpreted by cloud-init to perform contextualisation actions
These are specified during creation of the VM with the <code>--context</code> option to the rOCCI client.
With IM you can have two contextualisation methods, cloud-init and ansible, both options are described with the <code>configure</code> section of your RADL. In any case IM creates a default user and a ssh-key pair for it. You can get the ssh-key with:
The following example uses cloud-init:
<pre>
network private ()
system node (
  cpu.count>=1 and
  ...
)
configure node (
@begin
  runcmd:
    - [ wget, "http://slashdot.org", -O, /tmp/index.html ]
@end
)
deploy node 1
contextualize (
  system node configure node with cloud_init
)
</pre>


= Command Line Interface =
= Command Line Interface =

Revision as of 06:56, 21 June 2018

Overview For users For resource providers Infrastructure status Site-specific configuration Architecture



This page gives instructions on how to migrate from OCCI to IM for using EGI FedCloud resources

Setup of IM

UPV offers a public instance of IM, you can register a new account. Documentation is available at [1]

Once you have an account, you can either interact with IM via the web GUI or using the command line tool. Installation of the command line can be easily done with pip, a virtualenv (and virtualenvwrapper is recommended for the installation):

# create a "im" virtualenv
$ mkvirtualenv im
# now we are already in the im virtualenv, install im
(im)$ pip install im_client

Whenever you want to use the client tool, just enter the virtualenv and it will be available on your path

$ workon im
(im) $ which im_client.py
/Users/enol/.virtualenvs/im/bin/im_client.py

Authentication

IM uses a file with the credentials used to access the IM server and the providers. See below an example with two OCCI providers:

$ cat ~/.im_client_auth
id = im; type = InfrastructureManager; username = <your_im_user>; password = <your_im_password>
id = occi_bari; type = OCCI; proxy = file(/tmp/x509up_u1000); host = http://cloud.recas.ba.infn.it:8787/occi/
id = occi_cesnet; type = OCCI; proxy = file(/tmp/x509up_u1000); host = https://carach5.ics.muni.cz:11443/

You can get the URLs for the OCCI endpoints at AppDB or GOCDB, check the Federated_Cloud_APIs_and_SDKs#Discovery_of_resources Discovery of Resources page for more information.

Commands issued need to have the URL of the server and the authentication file as parameters like this

(im) $ im_client.py -u http://servproject.i3m.upv.es:8899 -a ~/.im_client_auth <command> <command options>

For example, listing your deployed infrastructures

(im) $ im_client.py -u http://servproject.i3m.upv.es:8899 -a ~/.im_client_auth list
Connected with: http://servproject.i3m.upv.es:8899
Infrastructure IDs:
  e3a6f3ca-0965-11e7-a466-300000000002

RADL

IM native language for specifying the deployments is called RADL (Resource and Application Description Language), it has sections to specify the VMs to be deployed and the configuration to be applied on them with tight integration with Ansible. The following example creates a VM on RECAS-BARI resource provider (notice the disk.0.image.url, that contails the URL of the OCCI endpoint followed by the VM image id) of type 7 (these ids can be obtained via AppDB) using the grycap.swarm module from Ansible Galaxy.

network public (outbound = 'yes' )

system master (
instance_type = '7' and
net_interface.0.connection = 'public' and
net_interface.0.dns_name = 'master' and
disk.0.os.name = 'linux' and
disk.0.image.url= ['http://cloud.recas.ba.infn.it:8787/occi/43aa9fe8-0cde-4a35-87b8-eda324f8f1b8'] and
disk.0.os.credentials.username = 'cloudadm' and
disk.0.applications contains (name='ansible.modules.grycap.swarm')
)

configure master (
@begin
---
 - roles:
    - { role: 'grycap.swarm' }
@end
)

deploy master 1

For more information, check the RADL documentation

Getting information about available images/flavors

While OCCI had the possibility to query the mixins at the site, the returned information is limited and does not include the needed details to determine which mixing is relevant for a given application. IM does not provide a way to query the images or flavors at the site, instead you should use AppDB, either via the browser or using AppDB IS APIs, to discover site capabilities.

Creating a VM

Creation of a VM using OCCI requires a PUT request to the /compute URL of the service with the right templates as mixins and a title. With IM you need to define a RADL description of the VM that includes similar information. See the comparison below:


OCCI IM
 occi --endpoint <ENDPOINT> --auth x509 --user-cred $X509_USER_PROXY
      --voms \  --action create --resource compute 
      --attribute occi.core.title="<TITLE>" \
      --mixin <OS_TPL> --mixin <RES_TPL>
network public (outbound = 'yes' )
system vm (
  instance_type = '<RES_TPL>' and
  net_interface.0.connection = 'public' and
  net_interface.0.dns_name = '<TITLE>' and
  disk.0.os.name = 'linux' and
  disk.0.image.url= ['<ENDPOINT>/<OS_TPL>'] and
  disk.0.os.credentials.username = 'cloudadm'
)
deploy vm 1;

Contextualisation

OCCI allows two different contextualisation options:

  • public key: this is added to the default user in the image by cloud init
  • user data: blob interpreted by cloud-init to perform contextualisation actions

These are specified during creation of the VM with the --context option to the rOCCI client. With IM you can have two contextualisation methods, cloud-init and ansible, both options are described with the configure section of your RADL. In any case IM creates a default user and a ssh-key pair for it. You can get the ssh-key with:


The following example uses cloud-init:


network private ()

system node (
   cpu.count>=1 and
   ...
)

configure node (
@begin
  runcmd:
    - [ wget, "http://slashdot.org", -O, /tmp/index.html ]
@end
)

deploy node 1

contextualize (
   system node configure node with cloud_init
)

Command Line Interface