Difference between revisions of "Piston: Access using the CLI"
(Created page with "== Using Ubuntu 14.04 == * This was based on the ubuntu cloud 14.04 image within the piston openstack tutorail (fairly minimal setup) * Setup virtualenv to setup an isolated p...") |
|||
| Line 1: | Line 1: | ||
== Using Ubuntu 14.04 == | == Using Ubuntu 14.04 == | ||
* This was based on the ubuntu cloud 14.04 image within the piston openstack tutorail (fairly minimal setup) | * This was based on the ubuntu cloud 14.04 image within the piston openstack tutorail (fairly minimal setup) | ||
| + | |||
| + | == Setup Virtual env == | ||
* Setup virtualenv to setup an isolated python environment | * Setup virtualenv to setup an isolated python environment | ||
<syntaxhighlight> | <syntaxhighlight> | ||
| Line 9: | Line 11: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | == Setup Client Modules == | ||
* Setup the virtual env and install all the openstack client modules | * Setup the virtual env and install all the openstack client modules | ||
<syntaxhighlight> | <syntaxhighlight> | ||
| Line 15: | Line 18: | ||
Installing setuptools, pip...done. | Installing setuptools, pip...done. | ||
ubuntu@ubuntu-1404-dp:~$ source piston-openstack/bin/activate | ubuntu@ubuntu-1404-dp:~$ source piston-openstack/bin/activate | ||
| − | (piston-openstack)ubuntu@ubuntu-1404-dp:~$ pip install python-cinderclient python-glanceclient python-keystoneclient python-neutronclient python-novaclient python-swiftclient cobalt-python-novaclient-ext | + | (piston-openstack)ubuntu@ubuntu-1404-dp:~$ pip install python-cinderclient python-glanceclient \ |
| + | python-keystoneclient python-neutronclient \ | ||
| + | python-novaclient python-swiftclient cobalt-python-novaclient-ext | ||
| + | |||
| + | pip install netifaces | ||
# Verify with: | # Verify with: | ||
| Line 21: | Line 28: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| + | == Download the RC file from the Piston Console == | ||
* Do the following to download the RC file for your project: | * Do the following to download the RC file for your project: | ||
| Line 32: | Line 40: | ||
<syntaxhighlight> | <syntaxhighlight> | ||
source projectname-openrc-region.sh | source projectname-openrc-region.sh | ||
| + | # or in my case | ||
| + | (piston-openstack)ubuntu@ubuntu-1404-dp:~$ source Daves\ Test\ Cloud-openrc.sh | ||
| + | Please enter your OpenStack Password: | ||
| + | (piston-openstack)ubuntu@ubuntu-1404-dp:~$ | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | |||
| + | == Using Glance == | ||
| + | The Glance client allows a user to view, inspect and create virtual machine images within the cluster: | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | (piston-openstack)ubuntu@ubuntu-1404-dp:~$ glance image-list | ||
| + | +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ | ||
| + | | ID | Name | Disk Format | Container Format | Size | Status | | ||
| + | +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ | ||
| + | | f3b414b2-863c-42f5-a832-22858486c91c | Centos 6 Generic Cloud | qcow2 | bare | 1151533056 | active | | ||
| + | | 483a03f1-93b5-4576-8b57-663ecbc31cd6 | Centos 7 Generic Cloud | qcow2 | bare | 989069312 | active | | ||
| + | | 1798f4aa-1871-4938-850b-b0029216c16a | Demo Image CirrOS 0.3.1 9 | qcow2 | bare | 18350080 | active | | ||
| + | | 6ccb1b77-5988-4fa6-a637-45cb751a7504 | Ubuntu 14.04 LTS | qcow2 | bare | 256639488 | active | | ||
| + | +--------------------------------------+---------------------------+-------------+------------------+------------+--------+ | ||
| + | |||
| + | </syntaxhighlight> | ||
| + | glance help will show you all of the options. | ||
| + | |||
| + | == Using Nova == | ||
| + | The Nova client gives access to all the functionality associated with virtual instances within the cluster: | ||
| + | <syntaxhighlight> | ||
| + | # this wouldnt work in the virtualenv - exited out and install python-novaclient, re-sourced the rc file and worked ok: | ||
| + | ubuntu@ubuntu-1404-dp:~$ nova list | ||
| + | +--------------------------------------+--------------------------------------------------+--------+------------+-------------+---------------------------------+ | ||
| + | | ID | Name | Status | Task State | Power State | Networks | | ||
| + | +--------------------------------------+--------------------------------------------------+--------+------------+-------------+---------------------------------+ | ||
| + | | 02350e36-b358-4a8a-867e-8aeae2f5d68c | centos-6-dp | ACTIVE | - | Running | private=172.16.3.6 | | ||
| + | | 7d9ca24a-ff40-457c-874a-d96c2d2f0c8e | centos-7-dp-7d9ca24a-ff40-457c-874a-d96c2d2f0c8e | ACTIVE | - | Running | private=172.16.3.3, 172.16.4.3 | | ||
| + | | eedc8512-6dca-4b1c-a129-cbe33f972599 | centos-7-dp-eedc8512-6dca-4b1c-a129-cbe33f972599 | ACTIVE | - | Running | private=172.16.3.2, 172.16.4.2 | | ||
| + | | 0926ed78-4a6a-4e7d-b06e-df774d07233b | cirros-dp | ACTIVE | - | Running | private=172.16.3.10, 172.16.4.4 | | ||
| + | | 188fbc08-b413-4db2-9b96-f64233bbba56 | ubuntu-1404-dp | ACTIVE | - | Running | private=172.16.3.8 | | ||
| + | +--------------------------------------+--------------------------------------------------+--------+------------+-------------+---------------------------------+ | ||
| + | </syntaxhighlight> | ||
| + | The nova command has a large number of subcommands and options, covering tasks as diverse as creating instances and attaching volumes to uploading SSH keys for injection and migrating instances between cloud nodes. nova help and nova help <subcommand> will help you to understand its capabilities. | ||
| + | |||
| + | == Using Cinder == | ||
| + | In order to create and work with block-storage volumes, you will use the Cinder client: | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | cinder list | ||
| + | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ||
| + | | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | | ||
| + | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ||
| + | | 0f467714-28e8-423e-ba0d-2154c07c8cb4 | available | postgres_data | 2 | ceph | false | | | ||
| + | | 1a6e26db-db8a-4a38-be99-7e1a1f9aaa4c | available | General_backup | 5 | ceph-slow | false | | | ||
| + | +--------------------------------------+-----------+----------------+------+-------------+----------+-------------+ | ||
| + | </syntaxhighlight> | ||
| + | As with the other commands, cinder help will explain its functionality in more detail. | ||
| + | |||
| + | == Using Swift == | ||
| + | The Swift client is for interacting with object storage: | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | $ swift list | ||
| + | images_for_download | ||
| + | static_assets | ||
| + | $ swift delete images_for_download | ||
| + | $ swift list | ||
| + | static_assets | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | Unless there are already containers and objects stored in your project, you probably won’t see any output from your swift list. swift help will help you get started with object storage from the command line. | ||
| + | |||
| + | == Using Keystone == | ||
| + | The Keystone client will be used almost exclusively by cloud administrators for managing users, projects and roles, and for viewing or manipulating endpoints and services: | ||
| + | |||
| + | <syntaxhighlight> | ||
| + | keystone user-list | ||
| + | +----------------------------------+---------+---------+----------------------+ | ||
| + | | id | name | enabled | email | | ||
| + | +----------------------------------+---------+---------+----------------------+ | ||
| + | | a02d39f9a01a437da98ad3254bd94e9f | admin | True | changeme@example.com | | ||
| + | | 618b304aa7e04e6fa30ba2d6f345bcf8 | cinder | True | changeme@example.com | | ||
| + | | 55a9b335eff1447eaa01e3df1739d94f | glance | True | changeme@example.com | | ||
| + | | 2602c19224ca41449ea66d8371e5bbd6 | neutron | True | changeme@example.com | | ||
| + | | e0a968de5f014b05a35c6fa2ab2e2c7c | nova | True | changeme@example.com | | ||
| + | +----------------------------------+---------+---------+----------------------+ | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 22:01, 2 March 2015
Using Ubuntu 14.04
- This was based on the ubuntu cloud 14.04 image within the piston openstack tutorail (fairly minimal setup)
Setup Virtual env
- Setup virtualenv to setup an isolated python environment
sudo apt-get install python-dev
sudo apt-get install python-virtualenv
sudo apt-get install libffi-dev
sudo apt-get install libssl-devSetup Client Modules
- Setup the virtual env and install all the openstack client modules
ubuntu@ubuntu-1404-dp:~$ virtualenv piston-openstack
New python executable in piston-openstack/bin/python
Installing setuptools, pip...done.
ubuntu@ubuntu-1404-dp:~$ source piston-openstack/bin/activate
(piston-openstack)ubuntu@ubuntu-1404-dp:~$ pip install python-cinderclient python-glanceclient \
python-keystoneclient python-neutronclient \
python-novaclient python-swiftclient cobalt-python-novaclient-ext
pip install netifaces
# Verify with:
pip freezeDownload the RC file from the Piston Console
- Do the following to download the RC file for your project:
- Log in to the dashboard as described in Logging in to the Dashboard.
- Select Admin > Project from the menu bar.
- Click Access & Security.
- Click Download OpenStack RC File.
- Move the downloaded file to your home directory.
- In a terminal window, change directory to the location where you moved the RC file.
- Execute the following command to source the RC file:
source projectname-openrc-region.sh
# or in my case
(piston-openstack)ubuntu@ubuntu-1404-dp:~$ source Daves\ Test\ Cloud-openrc.sh
Please enter your OpenStack Password:
(piston-openstack)ubuntu@ubuntu-1404-dp:~$
Using Glance
The Glance client allows a user to view, inspect and create virtual machine images within the cluster:
(piston-openstack)ubuntu@ubuntu-1404-dp:~$ glance image-list
+--------------------------------------+---------------------------+-------------+------------------+------------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------------+-------------+------------------+------------+--------+
| f3b414b2-863c-42f5-a832-22858486c91c | Centos 6 Generic Cloud | qcow2 | bare | 1151533056 | active |
| 483a03f1-93b5-4576-8b57-663ecbc31cd6 | Centos 7 Generic Cloud | qcow2 | bare | 989069312 | active |
| 1798f4aa-1871-4938-850b-b0029216c16a | Demo Image CirrOS 0.3.1 9 | qcow2 | bare | 18350080 | active |
| 6ccb1b77-5988-4fa6-a637-45cb751a7504 | Ubuntu 14.04 LTS | qcow2 | bare | 256639488 | active |
+--------------------------------------+---------------------------+-------------+------------------+------------+--------+glance help will show you all of the options.
Using Nova
The Nova client gives access to all the functionality associated with virtual instances within the cluster:
# this wouldnt work in the virtualenv - exited out and install python-novaclient, re-sourced the rc file and worked ok:
ubuntu@ubuntu-1404-dp:~$ nova list
+--------------------------------------+--------------------------------------------------+--------+------------+-------------+---------------------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+--------------------------------------------------+--------+------------+-------------+---------------------------------+
| 02350e36-b358-4a8a-867e-8aeae2f5d68c | centos-6-dp | ACTIVE | - | Running | private=172.16.3.6 |
| 7d9ca24a-ff40-457c-874a-d96c2d2f0c8e | centos-7-dp-7d9ca24a-ff40-457c-874a-d96c2d2f0c8e | ACTIVE | - | Running | private=172.16.3.3, 172.16.4.3 |
| eedc8512-6dca-4b1c-a129-cbe33f972599 | centos-7-dp-eedc8512-6dca-4b1c-a129-cbe33f972599 | ACTIVE | - | Running | private=172.16.3.2, 172.16.4.2 |
| 0926ed78-4a6a-4e7d-b06e-df774d07233b | cirros-dp | ACTIVE | - | Running | private=172.16.3.10, 172.16.4.4 |
| 188fbc08-b413-4db2-9b96-f64233bbba56 | ubuntu-1404-dp | ACTIVE | - | Running | private=172.16.3.8 |
+--------------------------------------+--------------------------------------------------+--------+------------+-------------+---------------------------------+The nova command has a large number of subcommands and options, covering tasks as diverse as creating instances and attaching volumes to uploading SSH keys for injection and migrating instances between cloud nodes. nova help and nova help <subcommand> will help you to understand its capabilities.
Using Cinder
In order to create and work with block-storage volumes, you will use the Cinder client:
cinder list
+--------------------------------------+-----------+----------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+----------------+------+-------------+----------+-------------+
| 0f467714-28e8-423e-ba0d-2154c07c8cb4 | available | postgres_data | 2 | ceph | false | |
| 1a6e26db-db8a-4a38-be99-7e1a1f9aaa4c | available | General_backup | 5 | ceph-slow | false | |
+--------------------------------------+-----------+----------------+------+-------------+----------+-------------+As with the other commands, cinder help will explain its functionality in more detail.
Using Swift
The Swift client is for interacting with object storage:
$ swift list
images_for_download
static_assets
$ swift delete images_for_download
$ swift list
static_assetsUnless there are already containers and objects stored in your project, you probably won’t see any output from your swift list. swift help will help you get started with object storage from the command line.
Using Keystone
The Keystone client will be used almost exclusively by cloud administrators for managing users, projects and roles, and for viewing or manipulating endpoints and services:
keystone user-list
+----------------------------------+---------+---------+----------------------+
| id | name | enabled | email |
+----------------------------------+---------+---------+----------------------+
| a02d39f9a01a437da98ad3254bd94e9f | admin | True | changeme@example.com |
| 618b304aa7e04e6fa30ba2d6f345bcf8 | cinder | True | changeme@example.com |
| 55a9b335eff1447eaa01e3df1739d94f | glance | True | changeme@example.com |
| 2602c19224ca41449ea66d8371e5bbd6 | neutron | True | changeme@example.com |
| e0a968de5f014b05a35c6fa2ab2e2c7c | nova | True | changeme@example.com |
+----------------------------------+---------+---------+----------------------+