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 "Fedcloud-tf:WorkGroups:Scenario8:Configuration"

From EGIWiki
Jump to navigation Jump to search
(Redirected page to MAN10)
 
Line 1: Line 1:
== Register an image with the EGI.eu Marketplace  ==
#REDIRECT[[MAN10]]
 
(''Modified version of instructions compiled by Boris Parak. The original version can be found [http://meta.cesnet.cz/wiki/FedCloudDocumentation:How_to_upload_images_to_the_EGI.eu_Marketplace here]'')
 
=== Install and configure stratuslab-cli-tools  ===
 
This part is very straight-forward, we need ''stratuslab-cli-tools''. So
 
cd ~
mkdir stratuslab
cd stratuslab
wget http://repo.stratuslab.eu:8081/content/repositories/centos-6.2-releases/eu/stratuslab/pkgs/stratuslab-cli-user-pkg/2.2/stratuslab-cli-user-pkg-2.2.tar.gz
tar xvf stratuslab-cli-user-pkg-2.2.tar.gz
 
and then conclude the installation process by appending the following to ''~/.bashrc''
 
# STRATUSLAB-CLI-TOOLS
export PATH=$PATH:~/stratuslab/bin
export PYTHONPATH=$PYTHONPATH:~/stratuslab/lib/stratuslab/python
 
RPMs for the client are also available from the StratusLab yum repositories, see http://yum.stratuslab.eu/. Packages are provided for CentOS 6.2, OpenSuse 12.1 and Fedora 16.
 
=== Get demo images  ===
 
There are two images required for the demo. Each resource provider should upload a metadata entry for each. The first is the BNCweb image, which is available from https://appliance-repo.egi.eu/images/base/egi-bncweb/1.0/egi-bncweb.img. The second is a plain Debian 6 image (https://appliance-repo.egi.eu/images/base/Debian-6.0.5-x86_64-base/1.0/debian-6.0.5-x86_64-base.img).
 
=== Upload the image into your cloud  ===
 
==== appliance Repo  ====
 
Here are the steps for uploading an image to the appliance repo, which you can register to the EGI Marketplace as described below (ref?): The server uses the fedloud.egi.eu voms for authentication. You can register here (https://perun.metacentrum.cz/perun-registrar-cert/?vo=fedcloud.egi.eu). You will also need the hellasgrid-ca-chain.pem file so that curl can verify the server's certificate.
 
1. Create the directory where you want to place your image:
 
  curl --cacert ~/path/to/hellasgrid-ca-chain.pem --cert client.pem -X MKCOL https://appliance-repo.egi.eu/images/base/SL-5.7-x86_64-base
curl --cacert ~/path/to/hellasgrid-ca-chain.pem --cert client.pem -X MKCOL https://appliance-repo.egi.eu/images/base/SL-5.7-x86_64-base/1.0
 
2. upload the image:
 
  curl --cacert /path/to/hellasgrid-ca-chain.pem -T /path/to/image --cert client.pem https://appliance-repo.egi.eu/images/base/SL-5.5-x86_64-base/1.0/
 
NOTES:
 
Curl assumes that your cert.pem file contains your private key and certificate concatenated, if that not the case you will get a ""curl: (58) unable to set private key file: /file" error. A workaround is to create separate files for the private key and certificate. For example you can create the files using your pkcs12 certificate using openssl:
 
  openssl pkcs12 -in MULTICERT.p12 -out client.pem -clcerts -nokeys
openssl pkcs12 -in MULTICERT.p12 -out key.pem -nocerts
 
and issue the curl commands by:
 
  curl --cacert ~/path/to/hellasgrid-ca-chain.pem --key key.pem --cert client.pem
 
e.g.
 
  curl --cacert ~/path/to/hellasgrid-ca-chain.pem --key key.pem --cert client.pem -X MKCOL https://appliance-repo.egi.eu/images/base/SL-5.7-x86_64-base
 
You can generate the hellasgrid-ca-chain.pem file by:
 
#wget http://repository.egi.eu/sw/production/cas/1/current/repo-files/EGI-trustanchors.repo | mv EGI-trustanchors.repo /etc/yum.repos/
#yum install  yum install ca_HellasGrid-CA-2006 ca_HellasGrid-Root
#cat /etc/grid-security/certificates/HellasGrid-Root.pem /etc/grid-security/certificates/HellasGrid-CA-2006.pem > /path/to/new/hellasgrid-ca-chain.pem
 
==== Other  ====
 
This step is different for every cloud platform. For instance, in OpenNebula v3.4+ you can use Sunstone GUI to upload images directly, in previous versions you have to upload the image to the frontend and then register it.
 
Sice FedCloud-TF will be using OCCI to access the cloud, you must provide a location of the image that is OCCI-compatible. To find the right link you can browse through all the storage elements registered in your OCCI server
 
https://occi.host:port/storage/
 
checking the ''occi.core.title'' attribute for the right name. You should end up with something like
 
https://occi.host:port/storage/a39a1d08-bff8-5a62-ba68-a1cd76bb4511
 
=== Build the metadata  ===
 
The EGI.eu Marketplace stores only metadata which points to the image, provide basic information and integrity verification. Since RDF is not the most user-friendly format, we can use ''stratus-build-metadata'' to generate a template
 
stratus-build-metadata --author='##YOUR_NAME##' --type=base --os=Ubuntu --os-version=11.04 --os-arch=x86_64 \
--image-version=1.0 --hypervisor=xen --format=raw --comment='BNCWeb appliance for the OGF35 demo available at ##YOUR_SITE##' \
--compression=none --location='https://occi.host:port/storage/a39a1d08-bff8-5a62-ba68-a1cd76bb4511' egi-bncweb.img
 
'''Note:''' stratus-build-metadata needs the image to compute checksums, you can download it here [https://appliance-repo.egi.eu/images/base/egi-bncweb/1.0/egi-bncweb.img egi-bncweb.img]
 
=== Modify the metadata  ===
 
Now we can check/modify the metadata, the most important elements are ''dcterms:valid'' and ''dcterms:title''.
 
The correct format for ''dcterms:title'' is ''EGI-##IMAGE_NAME##-##SITE_NAME##''. This field will need to be manually added to the metadata file. You can also modify the validity date as required.
 
'''Metadata from the EGI.eu Marketplace cannot be removed, it can only expire.''' It is also possible to ''deprecate'' an entry. This might be necessary, if for example, a security issue is detected with the image, or if you simply wish to no longer endorse the image. Instructions for the stratus-deprecate-image command can be found [http://stratuslab.eu/doku.php/ref-doc:user-cli#stratus-deprecate-metadata here].
<pre>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
&lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:slterms="http://mp.stratuslab.eu/slterms#"
    xmlns:slreq="http://mp.stratuslab.eu/slreq#"
    xml:base="http://mp.stratuslab.eu/"&gt;
 
    &lt;rdf:Description rdf:about="#DtRwHZzoo1xFKtk-iL51t6RNQ9Q"&gt;
 
        &lt;dcterms:identifier&gt;DtRwHZzoo1xFKtk-iL51t6RNQ9Q&lt;/dcterms:identifier&gt;
 
        &lt;slreq:bytes&gt;14680064000&lt;/slreq:bytes&gt;
 
        &lt;slreq:checksum rdf:parseType="Resource"&gt;
            &lt;slreq:algorithm&gt;MD5&lt;/slreq:algorithm&gt;
            &lt;slreq:value&gt;144fff2477673aa1d883f0a3ba89f273&lt;/slreq:value&gt;
        &lt;/slreq:checksum&gt;
        &lt;slreq:checksum rdf:parseType="Resource"&gt;
            &lt;slreq:algorithm&gt;SHA-1&lt;/slreq:algorithm&gt;
            &lt;slreq:value&gt;3b51c07673a28d7114ab64fa22f9d6de91350f50&lt;/slreq:value&gt;
        &lt;/slreq:checksum&gt;
        &lt;slreq:checksum rdf:parseType="Resource"&gt;
            &lt;slreq:algorithm&gt;SHA-256&lt;/slreq:algorithm&gt;
            &lt;slreq:value&gt;8bde348c81e5a2aa5aa51b8d39a30ad137d0482decd5960cd95594d224a45bdd&lt;/slreq:value&gt;
        &lt;/slreq:checksum&gt;
        &lt;slreq:checksum rdf:parseType="Resource"&gt;
            &lt;slreq:algorithm&gt;SHA-512&lt;/slreq:algorithm&gt;
            &lt;slreq:value&gt;e780f2aa6922bc7cfdaae4a5e410f6b499bef5c83314bcd760b082b625860834c4942de9d096c7aa83cdad0411c47686f2e7d0fcc65f816475f6525db28b236d&lt;/slreq:value&gt;
        &lt;/slreq:checksum&gt;
 
        &lt;slreq:endorsement rdf:parseType="Resource"/&gt;
 
        &lt;dcterms:title&gt;EGI-BNCweb-##YOUR_SITE##&lt;/dcterms:title&gt;
        &lt;dcterms:type&gt;base&lt;/dcterms:type&gt;
        &lt;slterms:kind&gt;machine&lt;/slterms:kind&gt;
 
        &lt;slterms:os&gt;Ubuntu&lt;/slterms:os&gt;
        &lt;slterms:os-version&gt;11.04&lt;/slterms:os-version&gt;
        &lt;slterms:os-arch&gt;x86_64&lt;/slterms:os-arch&gt;
        &lt;slterms:version&gt;1.0&lt;/slterms:version&gt;
        &lt;dcterms:compression&gt;none&lt;/dcterms:compression&gt;
        &lt;slterms:location&gt;https://occi.host:port/storage/a39a1d08-bff8-5a62-ba68-a1cd76bb4511&lt;/slterms:location&gt;
 
        &lt;dcterms:format&gt;raw&lt;/dcterms:format&gt;
 
        &lt;dcterms:creator&gt;##YOUR_NAME##&lt;/dcterms:creator&gt;
 
        &lt;dcterms:created&gt;2012-06-12T12:36:25Z&lt;/dcterms:created&gt;
        &lt;dcterms:valid&gt;2012-06-14T12:36:25Z&lt;/dcterms:valid&gt;
 
        &lt;dcterms:description&gt;BNCWeb appliance for the OGF35 demo available at ##YOUR_SITE##&lt;/dcterms:description&gt;
 
        &lt;slterms:hypervisor&gt;xen&lt;/slterms:hypervisor&gt;
 
        &lt;dcterms:publisher&gt;##YOUR_SITE##&lt;/dcterms:publisher&gt;
       
    &lt;/rdf:Description&gt;
&lt;/rdf:RDF&gt;
</pre>
{{Template:Block-comment
| name=Notice
| text=These fields should be checked: ''&lt;dcterms:title&gt;EGI-BNCweb-##YOUR_SITE##&lt;/dcterms:title&gt;'' ''&lt;dcterms:creator&gt;##YOUR_NAME##&lt;/dcterms:creator&gt;'' ''&lt;dcterms:description&gt;BNCWeb appliance for the OGF35 demo available at ##YOUR_SITE##&lt;/dcterms:description&gt;'' and ''&lt;dcterms:publisher&gt;##YOUR_SITE##&lt;/dcterms:publisher&gt;''
}}
 
<br>
 
==== Modify Metadata (OCCI 1.1 servers)  ====
 
{{Template:Block-comment
| name=Warning
| text=These changes are required for TF2012 demo.
}}
 
&lt;slterms:location&gt;https://occi.host:port/storage/##STORAGE ID##&lt;/slterms:location&gt;
&lt;dcterms:requires&gt;https://occi.host:port/network/##NETWORK ID##&lt;/dcterms:requires&gt;
 
*'''Optional:'''
 
Set &lt;dcterms:valid&gt; field to be used until TF demo:
 
&lt;dcterms:valid&gt;2012-10-02T09:55:00Z&lt;/dcterms:valid&gt;
 
==== Modify Metadata (rOCCI or OCCI OpenStack servers)  ====
 
{{Template:Block-comment
| name=Warning
| text=These changes are required for TF2012 demo
}}
 
<br>
 
&lt;dcterms:requires&gt;https://rocci.host:port&lt;/dcterms:requires&gt;
 
*'''Optional:'''
 
Set &lt;dcterms:valid&gt; field to be used until TF demo:
 
&lt;dcterms:valid&gt;2012-10-02T09:55:00Z&lt;/dcterms:valid&gt;
 
<br>
 
=== Sign the metadata  ===
 
To establish the origin of the image, we have to sign the metadata with a personal certificate (ideally the one registered with EGI.eu). '''Before''' doing this you should familiarise yourself with the [https://documents.egi.eu/public/ShowDocument?docid=771 EGI Security Policy for the Endorsement and Operation of Virtual Machine Images].
 
stratus-sign-metadata --p12-cert=##FULL_PATH_TO_usercred.p12## egi-bncweb.xml
 
=== Register the metadata with the EGI.eu Marketplace  ===
 
And to complete the process, we have to upload the metadata to the EGI.eu Marketplace with ''stratus-upload-metadata''
 
stratus-upload-metadata --marketplace-endpoint=marketplace.egi.eu egi-bncweb.xml
 
or manually at
 
http://marketplace.egi.eu/upload
 
=== Howto update and change old metadata  ===
 
To update uploaded metadata just modify the metadata file, sign it again, and then upload. It is basically the same procedure as uploading new metadata. Only the most recent entry for a particular image identifier/email address is displayed.
 
== [https://github.com/hepix-virtualisation/vmcatcher VMcatcher]  ==
 
VMcatcher allows users to subscribe to virtual machine Virtual Machine image lists, cache the images referenced to in the Virtual Machine Image List, validate the images list with x509 based public key cryptography, and validate the images against sha512 hashes in the images lists and provide events for further applications to process updates or expiries of virtual machine images without having to further validate the images.
 
=== Installation & Usage  ===
Please refer to vmcatcher documentation [https://github.com/hepix-virtualisation/vmcatcher here]
 
=== Event Handlers  ===
 
==== OpenNebula  ====
 
[https://github.com/grid-admin/vmcatcher_eventHndlExpl_ON vmcatcher_eventHndlExpl_ON] is a VMcatcher event handler for OpenNebula to store or disable images based on VMcatcher response. The followign guide will show how to install and configure vmCatcher handler as oneadmin user, directly from github. The configuration will automatically syncronize OpenNebula Image datastore with the registered vmcatcher images.
 
* Install pre-requisites for VMCatcher handler
[oneadmin@one-sandbox] sudo yum install -y qemu-img
 
* Install VMcatcher handler from github
[oneadmin@one-sandbox]$ mkdir $HOME/vmcatcher_eventHndlExpl_ON
[oneadmin@one-sandbox]$ cd $HOME/vmcatcher_eventHndlExpl_ON
[oneadmin@one-sandbox]$ wget http://github.com/grid-admin/vmcatcher_eventHndlExpl_ON/archive/v0.0.8.zip -O vmcatcher_eventHndlExpl_ON.zip
[oneadmin@one-sandbox]$ unzip vmcatcher_eventHndlExpl_ON.zip
[oneadmin@one-sandbox]$ mv vmcatcher_eventHndlExpl_ON*/* ./
[oneadmin@one-sandbox]$ rmdir vmcatcher_eventHndlExpl_ON-*
 
* Create the vmcatcher folders for ON (do not use /var/lib/one/ or other OpenNebula default directories for the vmcatcher cache, since you cannot import images into OpenNebula from these directories. Also, since this directory will host a copy of all the images downloaded via vmcatcher, it is suggested to place the directory into a separate disk)
[oneadmin@one-sandbox]$ sudo mkdir -p /opt/vmcatcher-ON/cache /opt/vmcatcher-ON/cache/partial /opt/vmcatcher-ON/cache/expired /opt/vmcatcher-ON/cache/templates
[oneadmin@one-sandbox]$ sudo chown oneadmin:oneadmin -R /opt/vmcatcher-ON
 
* Check that vmcatcher is running properly by listing and subscribing to an image list
[oneadmin@one-sandbox]$ export VMCATCHER_RDBMS="sqlite:////opt/vmcatcher-ON/vmcatcher.db"
[oneadmin@one-sandbox]$ vmcatcher_subscribe -l
[oneadmin@one-sandbox]$ vmcatcher_subscribe -e -s https://vmcaster.appdb.egi.eu/store/vappliance/tinycorelinux/image.list
[oneadmin@one-sandbox]$ vmcatcher_subscribe -l
8ddbd4f6-fb95-4917-b105-c89b5df99dda    True    None    https://vmcaster.appdb.egi.eu/store/vappliance/tinycorelinux/image.list
 
* Create a CRON wrapper for vmcatcher, named <code>/var/lib/one/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON_cron.sh</code>, using the following code
 
#!/bin/bash
#Cron handler for VMCatcher image syncronization script for OpenNebula
#Vmcatcher configuration variables
export VMCATCHER_RDBMS="sqlite:////opt/vmcatcher-ON/vmcatcher.db"
export VMCATCHER_CACHE_DIR_CACHE="/opt/vmcatcher-ON/cache"
export VMCATCHER_CACHE_DIR_DOWNLOAD="/opt/vmcatcher-ON/cache/partial"
export VMCATCHER_CACHE_DIR_EXPIRE="/opt/vmcatcher-ON/cache/expired"
export VMCATCHER_CACHE_EVENT="python $HOME/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON"
#Update vmcatcher image lists
vmcatcher_subscribe -U
#Add all the new images to the cache
for a in `vmcatcher_image -l | awk '{if ($2==2) print $1}'`; do
  vmcatcher_image -a -u $a
done
#Update the cache
vmcatcher_cache -v -v
 
* Test that the vmcatcher handler is working correctly by running
[oneadmin@one-sandbox]$ chmod +x $HOME/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON_cron.sh
[oneadmin@one-sandbox]$ $HOME/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON_cron.sh
INFO:main:Defaulting actions as 'expire', and 'download'.
DEBUG:Events:event 'ProcessPrefix' executed 'python /var/lib/one/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON'
DEBUG:Events:stdout=
DEBUG:Events:stderr=2014-07-16 12:25:49,586;  DEBUG; vmcatcher_eventHndl_ON; main -- Processing event 'ProcessPrefix'
2014-07-16 12:25:49,586; WARNING; vmcatcher_eventHndl_ON; main -- Ignoring event 'ProcessPrefix'
INFO:DownloadDir:Downloading '541b01a8-94bd-4545-83a8-6ea07209b440'.
DEBUG:Events:event 'AvailablePrefix' executed 'python /var/lib/one/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON'
DEBUG:Events:stdout=
DEBUG:Events:stderr=2014-07-16 12:26:00,522;  DEBUG; vmcatcher_eventHndl_ON; main -- Processing event 'AvailablePrefix'
2014-07-16 12:26:00,522; WARNING; vmcatcher_eventHndl_ON; main -- Ignoring event 'AvailablePrefix'
INFO:CacheMan:moved file 541b01a8-94bd-4545-83a8-6ea07209b440
DEBUG:Events:event 'AvailablePostfix' executed 'python /var/lib/one/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON'
DEBUG:Events:stdout=
DEBUG:Events:stderr=2014-07-16 12:26:00,567;  DEBUG; vmcatcher_eventHndl_ON; main -- Processing event 'AvailablePostfix'
2014-07-16 12:26:00,567;  DEBUG; vmcatcher_eventHndl_ON; HandleAvailablePostfix -- Starting HandleAvailablePostfix for '541b01a8-94bd-4545-83a8-6ea07209b440'
2014-07-16 12:26:00,571;    INFO; vmcatcher_eventHndl_ON; UntarFile -- /opt/vmcatcher-ON/cache/541b01a8-94bd-4545-83a8-6ea07209b440 is an OVA file. Extracting files...
2014-07-16 12:26:00,599;    INFO; vmcatcher_eventHndl_ON; UntarFile -- Converting /opt/vmcatcher-ON/cache/templates/541b01a8-94bd-4545-83a8-6ea07209b440/CoreLinux-disk1.vmdk to raw format.
2014-07-16 12:26:00,641;    INFO; vmcatcher_eventHndl_ON; UntarFile -- New RAW image created: /opt/vmcatcher-ON/cache/templates/541b01a8-94bd-4545-83a8-6ea07209b440/CoreLinux-disk1.vmdk.raw
2014-07-16 12:26:00,642;    INFO; vmcatcher_eventHndl_ON; HandleAvailablePostfix -- Creating template file /opt/vmcatcher-ON/cache/templates/541b01a8-94bd-4545-83a8-6ea07209b440.one
2014-07-16 12:26:00,780;    INFO; vmcatcher_eventHndl_ON; getImageListXML -- Getting image list: oneimage list --xml
2014-07-16 12:26:00,784;    INFO; vmcatcher_eventHndl_ON; HandleAvailablePostfix -- There is not a previous image with the same UUID in the OpenNebula infrastructure
2014-07-16 12:26:00,785;    INFO; vmcatcher_eventHndl_ON; HandleAvailablePostfix -- Instantiating template: oneimage create -d default /opt/vmcatcher-ON/cache/templates/541b01a8-94bd-4545-83a8-6ea07209b440.one | cut -d ':' -f 2
DEBUG:Events:event 'ProcessPostfix' executed 'python /var/lib/one/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON'
DEBUG:Events:stdout=
DEBUG:Events:stderr=2014-07-16 12:26:01,077;  DEBUG; vmcatcher_eventHndl_ON; main -- Processing event 'ProcessPostfix'
2014-07-16 12:26:01,077; WARNING; vmcatcher_eventHndl_ON; main -- Ignoring event 'ProcessPostfix'
 
* Add the following line to the oneadmin user crontab:
50 */6 * * * $HOME/vmcatcher_eventHndlExpl_ON/vmcatcher_eventHndl_ON_cron.sh >> /var/log/vmcatcher.log 2>&1
 
''NOTES:''
 
*vmcatcher_cache must be executed as oneadmin user.
*Environment variables can be used to set default values but the command line options will override any set environment options. Set these env variables for oneadmin user: VMCATCHER_RDBMS, VMCATCHER_CACHE_DIR_CACHE, VMCATCHER_CACHE_DIR_DOWNLOAD, VMCATCHER_CACHE_DIR_EXPIRE and VMCATCHER_CACHE_EVENT.
*vmcatcher_eventHndlExpl_ON generates ON image templates. These templates are available from $VMCATCHER_CACHE_DIR_CACHE/templates (templates nomenclature $VMCATCHER_EVENT_DC_IDENTIFIER.one)
*The new ON images include ''VMCATCHER_EVENT_DC_IDENTIFIER = &lt;VMCATCHER_UUID&gt;'' tag. This tag is used to identify Fedcloud VM images.
*VMcatcher expired images are set as disabled by ON. It is up to the RP to remove disabled images or assign the new ones to a specific ON group or user.
 
==== OpenStack  ====
 
Vmcatcher may be branched to Openstack Glance catalog using [https://appdb.egi.eu/store/software/python.glancepush python-glancepush] tool and [https://appdb.egi.eu/store/software/openstack.handler.for.vmcatcher Openstack Handler for Vmcatcher] event handler. To install and configure glancepush and the handler, you can refer to the following instructions:
 
* Install the latest release of glancepush via the [https://appdb.egi.eu/store/software/python.glancepush/releases/0.0.x AppDB repository]. For debian based systems, just download the tarball, extract it, and execute python setup.py install
[stack@ubuntu]$ wget http://repository.egi.eu/community/software/python.glancepush/0.0.X/releases/generic/0.0.6/python-glancepush-0.0.6.tar.gz
[stack@ubuntu]$ tar -zxvf python-glancepush-0.0.6.tar.gz
[stack@ubuntu]$ python setup.py install
while for RHEL6 you can run:
[stack@rhel]$ yum localinstall http://repository.egi.eu/community/software/python.glancepush/0.0.X/releases/sl/6/x86_64/RPMS/python-glancepush-0.0.6-1.noarch.rpm
 
* Then, configure glancepush directories
[stack@ubuntu]$ sudo mkdir -p /var/spool/glancepush /etc/glancepush/log /etc/glancepush/transform/ /etc/glancepush/clouds
[stack@ubuntu]$ sudo chown stack:stack -R /var/spool/glancepush /etc/glancepush /var/log/glancepush/
 
* Copy the file /etc/keystone/voms.json to /etc/glancepush/voms.json. Then create a file in clouds file for every VO to which you are subscribed. For example, if you're subscribed to fedcloud, atlas and lhcb, you'll need 3 files in the /etc/glancepush/clouds directory with the credentials for this VO/tenants, for example:
[general]
# Tenant for this VO. Must match the tenant defined in voms.json file
testing_tenant=egi
# Identity service endpoint (Keystone)
endpoint_url=https://server4-eupt.unizar.es:5000/v2.0
# User Password
password=123456
# User
username=John
# Set this to true if you're NOT using self-signed certificates
is_secure=True
# SSH private key that will be used to perform policy checks (to be done)
ssh_key=Carlos_lxbifi81
# WARNING: Only define the next variable if you're going to need it. Otherwise you may encounter problems
cacert=path_to_your_cert
 
* Install [https://appdb.egi.eu/store/software/openstack.handler.for.vmcatcher Openstack handler for vmcatcher]. For debian based systems, just download the tarball, extract it and execute python setup.py install
[stack@ubuntu]$ wget http://repository.egi.eu/community/software/openstack.handler.for.vmcatcher/0.0.X/releases/generic/0.0.7/gpvcmupdate-0.0.7.tar.gz
[stack@ubuntu]$ tar -zxvf gpvcmupdate-0.0.7.tar.gz
[stack@ubuntu]$ python setup.py install
while for RHEL6 you can run:
[stack@rhel]$ yum localinstall http://repository.egi.eu/community/software/openstack.handler.for.vmcatcher/0.0.X/releases/generic/0.0.7/gpvcmupdate-0.0.7.tar.gz
 
* Create the vmcatcher folders for OpenStack
[stack@ubuntu]$ mkdir -p /opt/stack/vmcatcher/cache /opt/stack/vmcatcher/cache/partial /opt/stack/vmcatcher/cache/expired
 
* Check that vmcatcher is running properly by listing and subscribing to an image list
[stack@ubuntu]$ export VMCATCHER_RDBMS="sqlite:////opt/stack/vmcatcher/vmcatcher.db"
[stack@ubuntu]$ vmcatcher_subscribe -l
[stack@ubuntu]$ vmcatcher_subscribe -e -s https://vmcaster.appdb.egi.eu/store/vappliance/tinycorelinux/image.list
[stack@ubuntu]$ vmcatcher_subscribe -l
8ddbd4f6-fb95-4917-b105-c89b5df99dda    True    None    https://vmcaster.appdb.egi.eu/store/vappliance/tinycorelinux/image.list
 
* Create a CRON wrapper for vmcatcher, named <code>$HOME/gpvcmupdate/vmcatcher_eventHndl_OS_cron.sh</code>, using the following code
 
#!/bin/bash
#Cron handler for VMCatcher image syncronization script for OpenStack
#Vmcatcher configuration variables
export VMCATCHER_RDBMS="sqlite:////opt/stack/vmcatcher/vmcatcher.db"
export VMCATCHER_CACHE_DIR_CACHE="/opt/stack/vmcatcher/cache"
export VMCATCHER_CACHE_DIR_DOWNLOAD="/opt/stack/vmcatcher/cache/partial"
export VMCATCHER_CACHE_DIR_EXPIRE="/opt/stack/vmcatcher/cache/expired"
export VMCATCHER_CACHE_EVENT="python $HOME/gpvcmupdate/gpvcmupdate.py -D"
#Update vmcatcher image lists
vmcatcher_subscribe -U
#Add all the new images to the cache
for a in `vmcatcher_image -l | awk '{if ($2==2) print $1}'`; do
  vmcatcher_image -a -u $a
done
#Update the cache
vmcatcher_cache -v -v
#Run glancepush
/usr/bin/glancepush.py
 
* Set the newly created file as executable
[stack@ubuntu]$ chmod +x $HOME/gpvcmupdate/vmcatcher_eventHndl_OS_cron.sh
 
* Test that the vmcatcher handler is working correctly by running
 
[stack@ubuntu]$ $HOME/gpvcmupdate/vmcatcher_eventHndl_OS_cron.sh
INFO:main:Defaulting actions as 'expire', and 'download'.
DEBUG:Events:event 'ProcessPrefix' executed 'python /opt/stack/gpvcmupdate/gpvcmupdate.py'
DEBUG:Events:stdout=
DEBUG:Events:stderr=Ignoring ProcessPrefix event.
INFO:DownloadDir:Downloading '541b01a8-94bd-4545-83a8-6ea07209b440'.
DEBUG:Events:event 'AvailablePrefix' executed 'python /opt/stack/gpvcmupdate/gpvcmupdate.py'
DEBUG:Events:stdout=AvailablePrefix
DEBUG:Events:stderr=
INFO:CacheMan:moved file 541b01a8-94bd-4545-83a8-6ea07209b440
DEBUG:Events:event 'AvailablePostfix' executed 'python /opt/stack/gpvcmupdate/gpvcmupdate.py'
DEBUG:Events:stdout=AvailablePostfixCreating Metadata Files
DEBUG:Events:stderr=
DEBUG:Events:event 'ProcessPostfix' executed 'python /opt/stack/gpvcmupdate/gpvcmupdate.py'
DEBUG:Events:stdout=
DEBUG:Events:stderr=Ignoring ProcessPostfix event.
 
 
* Add the following line to the stack user crontab:
50 */6 * * * $HOME/gpvcmupdate/vmcatcher_eventHndl_OS_cron.sh >> /var/log/glancepush/vmcatcher.log 2>&1
 
''NOTES:''
 
*It is recommended to execute glancepush and vmcatcher_cache as stack or other non-root user.
*VMcatcher expired images are removed from OS.
 
=== Links  ===
 
[https://github.com/hepix-virtualisation/vmcatcher VMcatcher]
 
[https://github.com/cgimeno/Openstack-handler-for-vmcatcher Openstach Handler for vmcatcher repository]
 
[https://github.com/cgimeno/python-glancepush Python-glancepush repository]
 
[http://grid.desy.de/vm/hepix/vwg/doc/html/index.shtml HEPIX Virtualisation Working Group]
 
[http://grid.desy.de/vm/hepix/vwg/doc/html/imagetransfer/imagetransfer.shtml Part&nbsp;IV.&nbsp;Virtual Machine Image Transfer]
 
[https://github.com/robertord/Fedcloud/blob/master/vmcatcher_eventHndlExpl_ON github OpenNebula VMcatcher event handler]

Latest revision as of 15:18, 11 May 2015

Redirect to: