Commit c99f24db authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Merge branch 'develop' of https://code.grnet.gr/git/kamaki into develop

parents 96ffa3b8 abfaa6d9
......@@ -8,12 +8,12 @@ called kamaki.clients and servers as a lib.
A showcase of an application built on kamaki.clients is kamaki.cli, the command
line interface of kamaki.
Since synnefo services are build as OpenStack extensions, an inheritance
Since Synnefo services are build as OpenStack extensions, an inheritance
approach has been chosen for implementing clients for both. In specific,
the *compute*, *storage* and *image* modules are clients of the OS compute, OS
object-store, respectively. On the contrary, all the other modules are Synnefo
extensions (*cyclades* extents *compute*, *pithos* and *pithos_rest_api*
extent *storage*) or novel synnefo services (e.g. *astakos* for IM, *image*
extent *storage*) or novel Synnefo services (e.g., *astakos* for IM, *image*
for *plankton*).
Setup a client instance
......@@ -66,7 +66,7 @@ kamaki clients. Kamaki simplifies this process with the astakos client library.
Let's review the process with examples.
First, an astakos client must be initialized (Example 1.2). An
AUTHENTICATION_URL and a TOKEN can be acquired from the synnefo deployment UI.
AUTHENTICATION_URL and a TOKEN can be acquired from the Synnefo deployment UI.
.. code-block:: python
:emphasize-lines: 1
......
......@@ -124,7 +124,7 @@ The clients API
Modules list
^^^^^^^^^^^^
compute ReST API
compute REST API
^^^^^^^^^^^^^^^^
.. automodule:: kamaki.clients.compute.rest_api
......@@ -142,7 +142,7 @@ compute
:undoc-members:
cyclades ReST API
cyclades REST API
^^^^^^^^^^^^^^^^^
.. automodule:: kamaki.clients.cyclades.rest_api
......
Logging
=======
Kamaki uses the standard python logger package to log some of its
Kamaki uses the standard Python logger package to log some of its
functionality.
All kamaki loggers are named or prefixed after the package they log, e.g.
......@@ -29,7 +29,7 @@ Logger in external code
When a logger is known to be in kamaki code, the script developer may use this
logger to log some needed information. This can be happen either by directly
using the python `logger` package, or the corresponding kamaki wraper
using the Python `logger` package, or the corresponding kamaki wraper
`kamaki.cli.logger` which allows the definition, activation and deactivation
of stream (usually console) or file loggers.
......@@ -95,11 +95,11 @@ Logger in kamaki code
When implementing kamaki code, either as part of the main kamaki project or as
an extension, it is often useful to use loggers. The suggested strategy is to
use `kamaki.cli.logger` to create one logger per package, named after the
package itself. Developers may also directly use the python logger module, but
package itself. Developers may also directly use the Python logger module, but
they should respect the naming conventions.
In this example, we want to log the arguments of the `register` method found in
`kamaki/clients/image/__init__.py`. We will use the python logger module.
`kamaki/clients/image/__init__.py`. We will use the Python logger module.
First, we should add a logger initializer at the top of the file.
......
......@@ -5,10 +5,10 @@ Examples
:numbered:
:glob:
collection_of_examples/configuration
collection_of_examples/listing
collection_of_examples/updownload
collection_of_examples/sharing
collection_of_examples/imageregister
collection_of_examples/server
collection_of_examples/network
examplesdir/configuration
examplesdir/listing
examplesdir/updownload
examplesdir/sharing
examplesdir/imageregister
examplesdir/server
examplesdir/network
......@@ -126,10 +126,10 @@ Check that the file is created, everything is set up correctly and working
. cloud.mytest.token = myt35t70k3n==
$ kamaki -c nonexisting.cnf user autenticate
. ...
. user:
. user:
. id: s0me-3x4mp13-u53r-1d
. name: Some User
. roles:
. roles:
. id: 1
. name: default
. roles_links:
......
......@@ -41,14 +41,14 @@ Register the image object with the name 'Debian Base Alpha'
checksum: 3cb03556ec971f...e8dd6190443b560cb7
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: 7h1rd-1m4g3-1d
is-public: False
location: pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
name: Debian Base Alpha
owner: s0m3-u53r-1d
properties:
properties:
size: 903471104
status: available
updated-at: 2013-06-19 08:01:00
......@@ -81,19 +81,19 @@ Read the metafile
[kamaki]: file cat pithos:debian_base3.diskdump
{
"status": "available",
"name": "Debian Base Gama",
"checksum": "3cb03556ec971f...e8dd6190443b560cb7",
"id": "7h1rd-1m4g3-1d2",
"updated-at": "2013-06-19 08:01:00",
"created-at": "2013-06-19 08:00:22",
"properties": {},
"location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
"is-public": "False",
"owner": "s0m3-u53r-1d",
"disk-format": "diskdump",
"size": "903471104",
"deleted-at": "",
"status": "available",
"name": "Debian Base Gama",
"checksum": "3cb03556ec971f...e8dd6190443b560cb7",
"id": "7h1rd-1m4g3-1d2",
"updated-at": "2013-06-19 08:01:00",
"created-at": "2013-06-19 08:00:22",
"properties": {},
"location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
"is-public": "False",
"owner": "s0m3-u53r-1d",
"disk-format": "diskdump",
"size": "903471104",
"deleted-at": "",
"container-format": "bare"
}
[kamaki]:
......@@ -138,7 +138,7 @@ An image can be unregistered by its image id, but only if the current user is
also the image owner. In this example, there is only one image owned by current
user.
Unregister image owned by current user
Unregister image owned by current user
.. code-block:: console
......@@ -209,22 +209,22 @@ The resulting file will look like this:
.. code-block:: javascript
{
"status": "available",
"name": "Debian Base Gama",
"checksum": "3cb03556ec971f...e8dd6190443b560cb7",
"id": "7h1rd-1m4g3-1d2",
"updated-at": "2013-06-19 08:01:00",
"created-at": "2013-06-19 08:00:22",
"status": "available",
"name": "Debian Base Gama",
"checksum": "3cb03556ec971f...e8dd6190443b560cb7",
"id": "7h1rd-1m4g3-1d2",
"updated-at": "2013-06-19 08:01:00",
"created-at": "2013-06-19 08:00:22",
"properties": {
"OS": "Linux",
"USER": "root"
},
"location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
"is-public": "False",
"owner": "s0m3-u53r-1d",
"disk-format": "diskdump",
"size": "903471104",
"deleted-at": "",
},
"location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
"is-public": "False",
"owner": "s0m3-u53r-1d",
"disk-format": "diskdump",
"size": "903471104",
"deleted-at": "",
"container-format": "bare"
}
......@@ -241,14 +241,14 @@ Register the image (don't forget the -f parameter, to override the metafile).
checksum: 3cb03556ec971f...e8dd6190443b560cb7
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: 7h1rd-1m4g3-1d
is-public: False
location: pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
name: Debian Base Delta
owner: s0m3-u53r-1d
properties:
properties:
OS: Linux
USER: root
size: 903471104
......@@ -280,14 +280,14 @@ If we, now, get the image metadata, we will see that the name is changed:
checksum: 3cb03556ec971f...e8dd6190443b560cb7
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: 7h1rd-1m4g3-1d
is-public: False
location: pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
name: Changed Name
owner: s0m3-u53r-1d
properties:
properties:
OS: Linux
USER: root
size: 903471104
......@@ -392,14 +392,14 @@ Let's compine the metafile with a command line attribute `user: admin`
checksum: 3cb03556ec971f...e8dd6190443b560cb7
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: 7h1rd-1m4g3-1d
is-public: False
location: pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
name: Debian Base Delta
owner: s0m3-u53r-1d
properties:
properties:
OS: Linux
USER: root
size: 903471104
......@@ -446,14 +446,14 @@ Register the image without uploading a metafile
checksum: 3cb03556ec971f...e8dd6190443b560cb7
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: 7h1rd-1m4g3-1d
is-public: False
location: pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump
name: Debian Base Delta
owner: s0m3-u53r-1d
properties:
properties:
OS: Linux
USER: root
size: 903471104
......@@ -480,19 +480,19 @@ Consult the first version of the metafile
[kamaki]: file cat --object-version=1352 pithos:debian_base3.diskdump.meta
{
"status": "available",
"name": "Debian Base Gama",
"checksum": "3cb03556ec971f...e8dd6190443b560cb7",
"id": "7h1rd-1m4g3-1d2",
"updated-at": "2013-06-19 08:01:00",
"created-at": "2013-06-19 08:00:22",
"properties": {},
"location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
"is-public": "False",
"owner": "s0m3-u53r-1d",
"disk-format": "diskdump",
"size": "903471104",
"deleted-at": "",
"status": "available",
"name": "Debian Base Gama",
"checksum": "3cb03556ec971f...e8dd6190443b560cb7",
"id": "7h1rd-1m4g3-1d2",
"updated-at": "2013-06-19 08:01:00",
"created-at": "2013-06-19 08:00:22",
"properties": {},
"location": "pithos://s0m3-u53r-1d/pithos/debian_base3.diskdump",
"is-public": "False",
"owner": "s0m3-u53r-1d",
"disk-format": "diskdump",
"size": "903471104",
"deleted-at": "",
"container-format": "bare"
}
[kamaki]:
......@@ -573,7 +573,7 @@ VMs) by adding the **--public** flag argument when calling `image register`.
checksum: 3cb03556ec971f...e8dd6190443b560cb7
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: d3b14n-1m4g3-1d
is-public: False
......@@ -589,7 +589,7 @@ VMs) by adding the **--public** flag argument when calling `image register`.
checksum: 4cb03556ec971f...e8dd6190443b560cb6
container-format: bare
created-at: 2013-06-19 08:00:22
deleted-at:
deleted-at:
disk-format: diskdump
id: w1nd0w5-1m4g3-1d
is-public: False
......
......@@ -129,14 +129,14 @@ List pithos containers with details
bytes: 0 (0B)
count: 3
modified: 2013-06-17T12:35:11.613124+00:00
policy:
policy:
. quota: 0
. versioning: auto
trash
bytes: 0 (0B)
count: 0
modified: 2013-06-06T14:24:23.675891+00:00
policy:
policy:
. quota: 0
. versioning: auto
[file]:
......@@ -175,7 +175,7 @@ List only 3, then list three by three
cont4 (0B, 0 objects)
pithos (36B, 4 objects)
trash (0B, 0 objects)
[file]:
[file]:
List contents of container `pithos`
......@@ -315,31 +315,31 @@ Get json output returned by the compute API server (only first two VMs)
[server]: list -j -n 2
[
{
"name": "example server 1",
"name": "example server 1",
"links": [
{
"href": "https://example.com/compute/v2.0/servers/4201",
"rel": "self"
},
},
{
"href": "https://example.com/compute/v2.0/servers/4201",
"rel": "bookmark"
}
],
],
"id": 4201
},
{
"name": "example server 2",
"name": "example server 2",
"links": [
{
"href": "https://example.com/compute/v2.0/servers/4202",
"rel": "self"
},
},
{
"href": "https://example.com/compute/v2.0/servers/4202",
"rel": "bookmark"
}
],
],
"id": 4202
}
]
......@@ -351,9 +351,9 @@ Server details (first two only)
[server]: list -l -n 2
4201 my example server 1
accessIPv4:
accessIPv6:
addresses:
accessIPv4:
accessIPv6:
addresses:
42:
OS-EXT-IPS:type: fixed
addr: 192.168.12.4
......@@ -362,23 +362,23 @@ Server details (first two only)
OS-EXT-IPS:type: fixed
addr: 2001:648:2ffc:1222:a800:2ff:fee3:49f1
version: 6
attachments:
attachments:
firewallProfile: DISABLED
id: nic-37231-0
ipv4: 192.168.12.4
ipv6: 2001:648:2ffc:1222:a800:2ff:fee3:49f1
mac_address: aa:00:02:e3:49:f8
network_id: 4161
config_drive:
config_drive:
created: 2013-05-11T18:03:41.471605+00:00
diagnostics:
diagnostics:
created: 2013-05-11T18:04:23.298132+00:00
details: None
level: DEBUG
message: Image customization finished successfully.
source: image-info
source_date: 2013-05-11T18:04:23.286869+00:00
flavor:
flavor:
id: 1
links:
href: https://example.com/compute/v2.0/flavors/1
......@@ -386,8 +386,8 @@ Server details (first two only)
. . . . . . .
href: https://example.com/compute/v2.0/flavors/1
rel: self
hostId:
image:
hostId:
image:
id: f1r57-1m4g3-1d
links:
href: https://example.com/compute/v2.0/images/f1r57-1m4g3-1d
......@@ -399,13 +399,13 @@ Server details (first two only)
href: https:/example.com/image/v1.0/images/f1r57-1m4g3-1d
rel: alternate
key_name: None
links:
links:
href: https://example.com/compute/v2.0/servers/4201
rel: bookmark
. . . . . . .
href: https://example.com/compute/v2.0/servers/4201
rel: self
metadata:
metadata:
os: ubuntu
users: user
progress: 100
......@@ -417,9 +417,9 @@ Server details (first two only)
updated: 2013-06-17T07:57:50.054550+00:00
user_id: s0m3-u53r-1d
4202 my example server 2
accessIPv4:
accessIPv6:
addresses:
accessIPv4:
accessIPv6:
addresses:
42:
OS-EXT-IPS:type: fixed
addr: 192.168.12.4
......@@ -428,23 +428,23 @@ Server details (first two only)
OS-EXT-IPS:type: fixed
addr: 2002:648:2ffc:1222:a800:2ff:fee3:49f1
version: 6
attachments:
attachments:
firewallProfile: DISABLED
id: nic-37231-0
ipv4: 192.168.12.4
ipv6: 2002:648:2ffc:1222:a800:2ff:fee3:49f1
mac_address: aa:00:02:e3:49:f8
network_id: 42
config_drive:
config_drive:
created: 2013-05-11T18:03:41.471605+00:00
diagnostics:
diagnostics:
created: 2013-05-11T18:04:23.298132+00:00
details: None
level: DEBUG
message: Image customization finished successfully.
source: image-info
source_date: 2013-05-11T18:04:23.286869+00:00
flavor:
flavor:
id: 2
links:
href: https://example.com/compute/v2.0/flavors/2
......@@ -452,8 +452,8 @@ Server details (first two only)
. . . . . . .
href: https://example.com/compute/v2.0/flavors/2
rel: self
hostId:
image:
hostId:
image:
id: 53c0nd-1m4g3-1d
links:
href: https://example.com/compute/v2.0/images/53c0nd-1m4g3-1d
......@@ -465,13 +465,13 @@ Server details (first two only)
href: https:/example.com/image/v1.0/images/53c0nd-1m4g3-1d
rel: alternate
key_name: None
links:
links:
href: https://example.com/compute/v2.0/servers/4202
rel: bookmark
. . . . . . .
href: https://example.com/compute/v2.0/servers/4202
rel: self
metadata:
metadata:
os: ubuntu
users: user
progress: 100
......@@ -512,12 +512,12 @@ Detailed listing
checksum: 9344d77620cde1dd77da...7b70badda34b26d782
container_format: bare
created_at: 2013-06-03 16:44:16
deleted_at:
deleted_at:
disk_format: diskdump
is_public: True
location: pithos://s0m3-5up3r-u53r-1d/pithos/debian_base1.diskdump
owner: s0m3-5up3r-u53r-1d
properties:
properties:
description: Debian 6.0.6 (Squeeze) Base System
gui: No GUI
kernel: 2.6.32
......@@ -533,12 +533,12 @@ Detailed listing
checksum: 9344d77620cde1dd77da...7b70badda34b26d782
container_format: bare
created_at: 2013-06-03 16:44:16
deleted_at:
deleted_at:
disk_format: diskdump
is_public: True
location: pithos://s0m3-5up3r-u53r-1d/pithos/debian_base2.diskdump
owner: s0m3-5up3r-u53r-1d
properties:
properties:
description: Debian 6.0.6 (Squeeze) Base System
gui: No GUI
kernel: 2.6.32
......@@ -553,7 +553,7 @@ Detailed listing
[image]: compute list
f1r57-1m4g3-1d Debian Base Alpha
created: 2013-06-03T16:21:53+00:00
links:
links:
href: https://example.com/cyclades/compute/v2.0/images/f1r57-1m4g3-1d
rel: bookmark
. . . . . . .
......@@ -562,7 +562,7 @@ Detailed listing
. . . . . . .
href: https://example.com/cyclades/image/v1.0/images/f1r57-1m4g3-1d
rel: alternate
metadata:
metadata:
description: Debian 6.0.6 (Squeeze) Base System
gui: No GUI
kernel: 2.6.32
......@@ -578,7 +578,7 @@ Detailed listing
user_id: s0m3-5up3r-u53r-1d
53c0nd-1m4g3-1d Beta Debian Base
created: 2013-06-03T16:21:53+00:00
links:
links:
href: https://example.com/cyclades/compute/v2.0/images/53c0nd-1m4g3-1d
rel: bookmark
. . . . . . .
......@@ -587,7 +587,7 @@ Detailed listing
. . . . . . .
href: https://example.com/cyclades/image/v1.0/images/53c0nd-1m4g3-1d
rel: alternate
metadata:
metadata:
description: Debian 6.0.6 (Squeeze) Base System
gui: No GUI
kernel: 2.6.32
......
......@@ -16,7 +16,7 @@ List available flavors
SNF:disk_template: drbd
disk: 1
id: 1
links:
links:
href: https://example.com/cyclades/compute/v2.0/flavors/1
rel: bookmark
. . . . . . .
......@@ -29,7 +29,7 @@ List available flavors
SNF:disk_template: plain
disk: 1
id: 2
links:
links:
href: https://example.com/cyclades/compute/v2.0/flavors/2
rel: bookmark
. . . . . . .
......@@ -55,22 +55,22 @@ f1r57-1m4g3-1d) image to create a new VM called 'My First Server'
.. code-block:: console
[kamaki]: server create 'My First Server' 1 f1r57-1m4g3-1d
accessIPv4:
accessIPv6:
addresses:
accessIPv4:
accessIPv6:
addresses:
adminPass: Y0uW0nt5eeMeAg4in
attachments:
config_drive:
attachments:
config_drive:
created: 2013-06-19T12:34:47.362078+00:00
diagnostics:
flavor:
diagnostics:
flavor:
id: 1
hostId:
hostId:
id: 141
image:
image:
id: f1r57-1m4g3-1d
key_name: None
metadata:
metadata:
os: debian
users: root
name: My First Server
......@@ -119,7 +119,7 @@ Assume that the public key file of the current user is located at
`/root/.ssh/authorized_keys` while creating the virtual server.
Luckily, Synnefo fully supports the OpenStack suggestion for file injections on
VMs and kamaki allows it by using the **-p** argument (p stands for
VMs and kamaki allows it by using the **-p** argument (p stands for
`PERSONALITY` and is the term used in the
`respective OpenStack <http://docs.openstack.org/api/openstack-compute/2/content/CreateServers.html>`_ description).
......@@ -141,22 +141,22 @@ Create a vm while injecting current users public key to root account
[kamaki]: server
[server]: create 'NoPassword Server' 1 f1r57-1m4g3-1d -p /home/someuser/.ssh/id_rsa.pub,/root/.ssh/authorized_keys
accessIPv4:
accessIPv6:
addresses:
accessIPv4:
accessIPv6:
addresses:
adminPass: Th1s1s4U5elessTh1ngN0w
attachments:
config_drive:
attachments:
config_drive:
created: 2013-06-19T12:34:47.362078+00:00
diagnostics:
flavor: