OpenStack ː Clients ligne de commande

Revision as of 20:07, 1 May 2017 by Diane27 (talk | contribs) (Created page with "==Installation== Les outils ligne de commande OpenStack sont pour Python et fonctionnent sur un ordinateur personnel ou sur une instance infonuagique. Les différentes distrib...")
Other languages:

Page enfant de OpenStack

OpenStackClient permet d'utiliser plusieurs fonctions du tableau de bord OpenStack, ainsi que d'autres fonctions qui ne sont pas disponibles par l'interface graphique. Pour l'utiliser sur tout genre de machine, virtuelle ou autre, il suffit d'installer le client et de disposer d'une connexion Internet. Les exemples de cette page sont sous Linux.

Installation

Les outils ligne de commande OpenStack sont pour Python et fonctionnent sur un ordinateur personnel ou sur une instance infonuagique. Les différentes distributions de Linux peuvent offrir des paquets précompilés; pour les détails, consultez la documentation d'installation. Si vous avez les permissions d'administrateur, vous pouvez rapidement installer Python et les outils ligne de commande OpenStack.

Ubuntu
sudo apt-get install python python-dev python-pip
sudo pip install python-openstackclient
CentOS 7

Run as root

yum install epel-release
yum install gcc python python-dev python2-pip
pip install python-openstackclient
Fedora
sudo dnf install python-openstackclient
Note
If you do not have administrative privileges and cannot use the OS package manager, then you will need to install Python and pip by other means. Once installed, you can get the command line tools installed into your home space like so:
pip install --user python-openstackclient
The install location is probably already included in your $PATH, but you can double check whether ~/.bashrc or ~/.bash_profile contains the following line PATH=$PATH:$HOME/.local/bin:$HOME/bin
SDK

If you wish to explore the OpenStack API for Python, add export PYTHONPATH=${HOME}/.local/lib/python2.7/site-packages/:${PYTHONPATH} to your .bashrc file. Adjust the python2.7 phrase to match the Python version you have installed.

Connecting CLI to OpenStack

Your command line client must now be told how to find your OpenStack project on the CC-Cloud. The most convenient way to do this is to download an OpenStack environment setup file. On the OpenStack dashboard go to Compute-> Access & Security-> API Access-> Download OpenStack RC File.

On East-cloud there are two RC files to choose from, a v2.0 and a v3 file. Unless you have a specific reason to choose v2.0, choose v3. If your OpenStack client version is version 2.5.0 or later, you will have to add the line export OS_IDENTITY_API_VERSION=3 to the East-cloud v3 file.

Then source the file with something like

 
[name@server ~]$ source <project name>-openrc.sh

It will ask you for your OpenStack password, which is simply your CC-Cloud password. Test your setup by typing

 
[name@server ~]$ openstack image list

If you switch between different RC files (e.g. east and west cloud RC files) you should be careful of environment variables which may still be set from the previous RC file, these may cause your OpenStack client commands to fail. Either ensure that all environment variables set in the RC file are unset with unset <variable-name>, or start a fresh new session without any of the RC environment variables set.

Executing commands

The CLI tool can be used interactively by typing

 
[name@server ~]$ openstack

and then issuing commands at the prompt. Alternatively the commands can be issued as one-offs by preceding the command with openstack, for example

 
[name@server ~]$ openstack server list

When running in interactive mode a list of available commands can be seen by typing help at the OpenStack prompt. The available commands are categorized by groups; many of the most commonly used groups are listed below. A list of commands belonging to a command group can be obtained by typing help <command group>. To get help on a particular command (e.g. options and arguments of the command) one can type help <command group> <command>. Note that many commands are available only to OpenStack administrators and will return an error message if a non-administrator tries using it. For this reason a list of available commands grouped by command groups is provided below to allow one to easily identify commands available to the average user.

Groupes de commandes

Commandes server

add security group migrate resume unlock
add volume pause set unpause
create reboot shelve unrescue
delete rebuild show unset
dump create remove security group ssh unshelve
image create remove volume start
list rescue stop
lock resize suspend

Commandes volume

create set
delete show
list unset

Commande console

log show url show

Commande flavor

list show

Commandes imagep

create save
delete set
list show

Commandes ip

fixed add floating list
fixed remove floating pool list
floating add floating remove
floating create floating show
floating delete

Commandes keypair

create list
delete show

Commandes network

create set
delete show
list

Commandes snapshot

create set
delete show
list unset

Commandes security group

create rule list
delete rule show
list set
rule create show
rule delete

limits show