openstack的每一个子项目(project)都有自己对应的命令行API,所有的这些API都是基于RESTful的,python代码实现的API。也就是说,这些API都是基于HTTP实现的,所以API都包含方法(GET,POST,DELETE,PUT,HEADER,OPTIONS),资源类型,响应码。
有了这些API,方便用户通过命令行来操作云平台资源,完成一些操作。这些,在Dashboard上也可以操作。例如Compute service可以通过python-novaclient进行操作。
下面列简单说说如何安装这些命令行程序。就拿我前面搭建的devstack环境举例说明,由于是运行在Centos上的,这就需要设置yum的资源仓库。
[stack@ip-10-121-5-244 devstack]$ yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm |
接下来,就是要enable上面的repository了,如下:
[stack@ip-10-121-5-244 devstack]$ yum install centos-release-openstack-liberty |
然后,更新yum缓存:
[stack@ip-10-121-5-244 devstack]$ yum makecache |
最后安装客户命令行软件包,可以指定安装某个包,如果是在单机环境安装,例如devstack,建议安装全包,若是用openstack安装在多个节点上,比如controller node, compute node, network node, block node, object node, image node, identity node等都是独立的,那么就根据具体情况,选择安装对应的包。我的环境是devstack,所以,我就安装了全包:
[stack@ip-10-121-5-244 devstack]$ sudo yum install python-openstackclient |
这里列出安装过程中,可以看到有那些子包被安装了:
[stack@ip---- devstack]$ sudo yum install python-openstackclient
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* epel: ftp.jaist.ac.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package python-openstackclient.noarch :1.7.-.el7 will be installed
--> Processing Dependency: python-stevedore for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-pbr for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-oslo-utils for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-oslo-serialization for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-oslo-i18n for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-oslo-config for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-os-client-config for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-novaclient for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-neutronclient for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-keystoneclient for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-glanceclient for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-crypto for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-cliff-tablib for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-cliff for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-cinderclient for package: python-openstackclient-1.7.-.el7.noarch
--> Processing Dependency: python-babel for package: python-openstackclient-1.7.-.el7.noarch
--> Running transaction check
---> Package python-babel.noarch :1.3-.el7 will be installed
--> Processing Dependency: pytz for package: python-babel-1.3-.el7.noarch
---> Package python-cinderclient.noarch :1.4.-.el7 will be installed
--> Processing Dependency: python-simplejson for package: python-cinderclient-1.4.-.el7.noarch
---> Package python-cliff.noarch :1.15.-.el7 will be installed
--> Processing Dependency: python-cmd2 >= 0.6. for package: python-cliff-1.15.-.el7.noarch
--> Processing Dependency: python-unicodecsv for package: python-cliff-1.15.-.el7.noarch
---> Package python-cliff-tablib.noarch :1.1-.el7 will be installed
--> Processing Dependency: python-tablib for package: python-cliff-tablib-1.1-.el7.noarch
---> Package python-crypto.x86_64 :2.6.-.el7.centos will be installed
---> Package python-glanceclient.noarch :1.1.-.el7 will be installed
--> Processing Dependency: python-warlock for package: :python-glanceclient-1.1.-.el7.noarch
--> Processing Dependency: python-httplib2 for package: :python-glanceclient-1.1.-.el7.noarch
---> Package python-keystoneclient.noarch :1.7.-.el7 will be installed
--> Processing Dependency: python-iso8601 >= 0.1. for package: :python-keystoneclient-1.7.-.el7.noarch
--> Processing Dependency: python-debtcollector >= 0.3. for package: :python-keystoneclient-1.7.-.el7.noarch
--> Processing Dependency: python-webob for package: :python-keystoneclient-1.7.-.el7.noarch
--> Processing Dependency: python-netaddr for package: :python-keystoneclient-1.7.-.el7.noarch
--> Processing Dependency: python-keyring for package: :python-keystoneclient-1.7.-.el7.noarch
---> Package python-neutronclient.noarch :3.1.-.el7 will be installed
--> Processing Dependency: pyparsing for package: python-neutronclient-3.1.-.el7.noarch
---> Package python-novaclient.noarch :2.30.-.el7 will be installed
--> Processing Dependency: python-netifaces for package: :python-novaclient-2.30.-.el7.noarch
---> Package python-pbr.noarch :1.8.-.el7 will be installed
---> Package python-stevedore.noarch :1.8.-.el7 will be installed
---> Package python2-os-client-config.noarch :1.7.-.el7 will be installed
--> Processing Dependency: python-fixtures for package: python2-os-client-config-1.7.-.el7.noarch
--> Processing Dependency: python-appdirs for package: python2-os-client-config-1.7.-.el7.noarch
---> Package python2-oslo-config.noarch :2.4.-.el7 will be installed
---> Package python2-oslo-i18n.noarch :2.6.-.el7 will be installed
---> Package python2-oslo-serialization.noarch :1.9.-.el7 will be installed
--> Processing Dependency: python-msgpack for package: python2-oslo-serialization-1.9.-.el7.noarch
---> Package python2-oslo-utils.noarch :2.5.-.el7 will be installed
--> Processing Dependency: python-monotonic for package: python2-oslo-utils-2.5.-.el7.noarch
--> Running transaction check
---> Package pyparsing.noarch :2.0.-.el7 will be installed
---> Package python-cmd2.noarch :0.6.-.el7 will be installed
---> Package python-fixtures.noarch :0.3.-.el7 will be installed
--> Processing Dependency: python-testtools for package: python-fixtures-0.3.-.el7.noarch
---> Package python-httplib2.noarch :0.7.-.el7 will be installed
---> Package python-iso8601.noarch :0.1.-.el7 will be installed
---> Package python-keyring.noarch :5.0-.el7 will be installed
---> Package python-monotonic.noarch :0.3-.el7 will be installed
---> Package python-msgpack.x86_64 :0.4.-.el7 will be installed
---> Package python-netaddr.noarch :0.7.-.el7 will be installed
---> Package python-netifaces.x86_64 :0.10.-.el7 will be installed
---> Package python-simplejson.x86_64 :3.3.-.el7 will be installed
---> Package python-tablib.noarch :0.10.-.el7 will be installed
---> Package python-unicodecsv.noarch :0.14.-.el7 will be installed
---> Package python-warlock.noarch :1.0.-.el7 will be installed
--> Processing Dependency: python-jsonschema for package: python-warlock-1.0.-.el7.noarch
---> Package python-webob.noarch :1.2.-.el7 will be installed
---> Package python2-appdirs.noarch :1.4.-.el7 will be installed
---> Package python2-debtcollector.noarch :0.8.-.el7 will be installed
--> Processing Dependency: python-wrapt for package: python2-debtcollector-0.8.-.el7.noarch
---> Package pytz.noarch :2012d-.el7 will be installed
--> Running transaction check
---> Package python-jsonschema.noarch :2.3.-.el7 will be installed
---> Package python-testtools.noarch :1.8.-.el7 will be installed
--> Processing Dependency: python-unittest2 >= 0.8. for package: python-testtools-1.8.-.el7.noarch
--> Processing Dependency: python-mimeparse for package: python-testtools-1.8.-.el7.noarch
--> Processing Dependency: python-extras for package: python-testtools-1.8.-.el7.noarch
---> Package python-wrapt.x86_64 :1.10.-.el7 will be installed
--> Running transaction check
---> Package python-extras.noarch :0.0.-.el7 will be installed
---> Package python-mimeparse.noarch :0.1.-.el7 will be installed
---> Package python-unittest2.noarch :1.0.-.el7 will be installed
--> Processing Dependency: python-traceback2 for package: python-unittest2-1.0.-.el7.noarch
--> Running transaction check
---> Package python-traceback2.noarch :1.4.-.el7 will be installed
--> Processing Dependency: python-linecache2 for package: python-traceback2-1.4.-.el7.noarch
--> Running transaction check
---> Package python-linecache2.noarch :1.0.-.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =============================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================
Installing:
python-openstackclient noarch 1.7.-.el7 centos-openstack-liberty k
Installing for dependencies:
pyparsing noarch 2.0.-.el7 centos-openstack-liberty k
python-babel noarch 1.3-.el7 centos-openstack-liberty 2.4 M
python-cinderclient noarch 1.4.-.el7 centos-openstack-liberty k
python-cliff noarch 1.15.-.el7 centos-openstack-liberty k
python-cliff-tablib noarch 1.1-.el7 centos-openstack-liberty k
python-cmd2 noarch 0.6.-.el7 centos-openstack-liberty k
python-crypto x86_64 2.6.-.el7.centos extras k
python-extras noarch 0.0.-.el7 centos-openstack-liberty k
python-fixtures noarch 0.3.-.el7 centos-openstack-liberty k
python-glanceclient noarch :1.1.-.el7 centos-openstack-liberty k
python-httplib2 noarch 0.7.-.el7 centos-openstack-liberty k
python-iso8601 noarch 0.1.-.el7 centos-openstack-liberty k
python-jsonschema noarch 2.3.-.el7 centos-openstack-liberty k
python-keyring noarch 5.0-.el7 epel k
python-keystoneclient noarch :1.7.-.el7 centos-openstack-liberty k
python-linecache2 noarch 1.0.-.el7 centos-openstack-liberty k
python-mimeparse noarch 0.1.-.el7 epel 9.3 k
python-monotonic noarch 0.3-.el7 centos-openstack-liberty 8.0 k
python-msgpack x86_64 0.4.-.el7 epel k
python-netaddr noarch 0.7.-.el7 centos-openstack-liberty 1.3 M
python-netifaces x86_64 0.10.-.el7 centos-openstack-liberty k
python-neutronclient noarch 3.1.-.el7 centos-openstack-liberty k
python-novaclient noarch :2.30.-.el7 centos-openstack-liberty k
python-pbr noarch 1.8.-.el7 centos-openstack-liberty k
python-simplejson x86_64 3.3.-.el7 centos-openstack-liberty k
python-stevedore noarch 1.8.-.el7 centos-openstack-liberty k
python-tablib noarch 0.10.-.el7 centos-openstack-liberty k
python-testtools noarch 1.8.-.el7 centos-openstack-liberty k
python-traceback2 noarch 1.4.-.el7 centos-openstack-liberty k
python-unicodecsv noarch 0.14.-.el7 centos-openstack-liberty k
python-unittest2 noarch 1.0.-.el7 centos-openstack-liberty k
python-warlock noarch 1.0.-.el7 centos-openstack-liberty k
python-webob noarch 1.2.-.el7 base k
python-wrapt x86_64 1.10.-.el7 epel k
python2-appdirs noarch 1.4.-.el7 centos-openstack-liberty k
python2-debtcollector noarch 0.8.-.el7 centos-openstack-liberty k
python2-os-client-config noarch 1.7.-.el7 centos-openstack-liberty k
python2-oslo-config noarch :2.4.-.el7 centos-openstack-liberty k
python2-oslo-i18n noarch 2.6.-.el7 centos-openstack-liberty k
python2-oslo-serialization noarch 1.9.-.el7 centos-openstack-liberty k
python2-oslo-utils noarch 2.5.-.el7 centos-openstack-liberty k
pytz noarch 2012d-.el7 base k Transaction Summary
=============================================================================================================================================
Install Package (+ Dependent packages) Total download size: 9.1 M
Installed size: M
Is this ok [y/d/N]: y
Downloading packages:
(/): pyparsing-2.0.-.el7.noarch.rpm | kB ::
(/): python-cinderclient-1.4.-.el7.noarch.rpm | kB ::
(/): python-cliff-1.15.-.el7.noarch.rpm | kB ::
(/): python-cliff-tablib-1.1-.el7.noarch.rpm | kB ::
(/): python-cmd2-0.6.-.el7.noarch.rpm | kB ::
(/): python-extras-0.0.-.el7.noarch.rpm | kB ::
(/): python-crypto-2.6.-.el7.centos.x86_64.rpm | kB ::
(/): python-fixtures-0.3.-.el7.noarch.rpm | kB ::
(/): python-glanceclient-1.1.-.el7.noarch.rpm | kB ::
(/): python-httplib2-0.7.-.el7.noarch.rpm | kB ::
(/): python-iso8601-0.1.-.el7.noarch.rpm | kB ::
(/): python-jsonschema-2.3.-.el7.noarch.rpm | kB ::
(/): python-keyring-5.0-.el7.noarch.rpm | kB ::
(/): python-babel-1.3-.el7.noarch.rpm | 2.4 MB ::
(/): python-mimeparse-0.1.-.el7.noarch.rpm | 9.3 kB ::
(/): python-linecache2-1.0.-.el7.noarch.rpm | kB ::
(/): python-msgpack-0.4.-.el7.x86_64.rpm | kB ::
(/): python-monotonic-0.3-.el7.noarch.rpm | 8.0 kB ::
(/): python-keystoneclient-1.7.-.el7.noarch.rpm | kB ::
(/): python-netifaces-0.10.-.el7.x86_64.rpm | kB ::
(/): python-neutronclient-3.1.-.el7.noarch.rpm | kB ::
(/): python-novaclient-2.30.-.el7.noarch.rpm | kB ::
(/): python-netaddr-0.7.-.el7.noarch.rpm | 1.3 MB ::
(/): python-pbr-1.8.-.el7.noarch.rpm | kB ::
(/): python-simplejson-3.3.-.el7.x86_64.rpm | kB ::
(/): python-stevedore-1.8.-.el7.noarch.rpm | kB ::
(/): python-openstackclient-1.7.-.el7.noarch.rpm | kB ::
(/): python-testtools-1.8.-.el7.noarch.rpm | kB ::
(/): python-traceback2-1.4.-.el7.noarch.rpm | kB ::
(/): python-unicodecsv-0.14.-.el7.noarch.rpm | kB ::
(/): python-unittest2-1.0.-.el7.noarch.rpm | kB ::
(/): python-webob-1.2.-.el7.noarch.rpm | kB ::
(/): python-wrapt-1.10.-.el7.x86_64.rpm | kB ::
(/): python-warlock-1.0.-.el7.noarch.rpm | kB ::
(/): python2-appdirs-1.4.-.el7.noarch.rpm | kB ::
(/): python2-debtcollector-0.8.-.el7.noarch.rpm | kB ::
(/): python2-os-client-config-1.7.-.el7.noarch.rpm | kB ::
(/): python-tablib-0.10.-.el7.noarch.rpm | kB ::
(/): python2-oslo-config-2.4.-.el7.noarch.rpm | kB ::
(/): python2-oslo-i18n-2.6.-.el7.noarch.rpm | kB ::
(/): pytz-2012d-.el7.noarch.rpm | kB ::
(/): python2-oslo-serialization-1.9.-.el7.noarch.rpm | kB ::
(/): python2-oslo-utils-2.5.-.el7.noarch.rpm | kB ::
---------------------------------------------------------------------------------------------------------------------------------------------
Total kB/s | 9.1 MB ::
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-pbr-1.8.-.el7.noarch /
Installing : python-iso8601-0.1.-.el7.noarch /
Installing : python-stevedore-1.8.-.el7.noarch /
Installing : python-netaddr-0.7.-.el7.noarch /
Installing : :python2-oslo-config-2.4.-.el7.noarch /
Installing : pytz-2012d-.el7.noarch /
Installing : python-babel-1.3-.el7.noarch /
Installing : python-simplejson-3.3.-.el7.x86_64 /
Installing : python-netifaces-0.10.-.el7.x86_64 /
Installing : pyparsing-2.0.-.el7.noarch /
Installing : python-keyring-5.0-.el7.noarch /
Installing : python-cmd2-0.6.-.el7.noarch /
Installing : python2-appdirs-1.4.-.el7.noarch /
Installing : python-unicodecsv-0.14.-.el7.noarch /
Installing : python-cliff-1.15.-.el7.noarch /
Installing : python-msgpack-0.4.-.el7.x86_64 /
Installing : python-webob-1.2.-.el7.noarch /
Installing : python-httplib2-0.7.-.el7.noarch /
Installing : python-monotonic-0.3-.el7.noarch /
Installing : python-jsonschema-2.3.-.el7.noarch /
Installing : python-warlock-1.0.-.el7.noarch /
Installing : python-wrapt-1.10.-.el7.x86_64 /
Installing : python2-debtcollector-0.8.-.el7.noarch /
Installing : python-crypto-2.6.-.el7.centos.x86_64 /
Installing : python-linecache2-1.0.-.el7.noarch /
Installing : python-traceback2-1.4.-.el7.noarch /
Installing : python-unittest2-1.0.-.el7.noarch /
Installing : python-mimeparse-0.1.-.el7.noarch /
Installing : python-extras-0.0.-.el7.noarch /
Installing : python-testtools-1.8.-.el7.noarch /
Installing : python-fixtures-0.3.-.el7.noarch /
Installing : python2-oslo-i18n-2.6.-.el7.noarch /
Installing : python2-oslo-utils-2.5.-.el7.noarch /
Installing : python2-oslo-serialization-1.9.-.el7.noarch /
Installing : :python-keystoneclient-1.7.-.el7.noarch /
Installing : python-cinderclient-1.4.-.el7.noarch /
Installing : :python-glanceclient-1.1.-.el7.noarch /
Installing : python-neutronclient-3.1.-.el7.noarch /
Installing : :python-novaclient-2.30.-.el7.noarch /
Installing : python2-os-client-config-1.7.-.el7.noarch /
Installing : python-tablib-0.10.-.el7.noarch /
Installing : python-cliff-tablib-1.1-.el7.noarch /
Installing : python-openstackclient-1.7.-.el7.noarch /
Verifying : python2-debtcollector-0.8.-.el7.noarch /
Verifying : python-unittest2-1.0.-.el7.noarch /
Verifying : python-cmd2-0.6.-.el7.noarch /
Verifying : python-cliff-tablib-1.1-.el7.noarch /
Verifying : python-pbr-1.8.-.el7.noarch /
Verifying : python-tablib-0.10.-.el7.noarch /
Verifying : python-extras-0.0.-.el7.noarch /
Verifying : python-openstackclient-1.7.-.el7.noarch /
Verifying : python-testtools-1.8.-.el7.noarch /
Verifying : python-fixtures-0.3.-.el7.noarch /
Verifying : :python-keystoneclient-1.7.-.el7.noarch /
Verifying : python-warlock-1.0.-.el7.noarch /
Verifying : python-keyring-5.0-.el7.noarch /
Verifying : python2-os-client-config-1.7.-.el7.noarch /
Verifying : python-mimeparse-0.1.-.el7.noarch /
Verifying : python-linecache2-1.0.-.el7.noarch /
Verifying : python-netaddr-0.7.-.el7.noarch /
Verifying : python-simplejson-3.3.-.el7.x86_64 /
Verifying : python-crypto-2.6.-.el7.centos.x86_64 /
Verifying : python-iso8601-0.1.-.el7.noarch /
Verifying : python-wrapt-1.10.-.el7.x86_64 /
Verifying : python-cinderclient-1.4.-.el7.noarch /
Verifying : python-stevedore-1.8.-.el7.noarch /
Verifying : python-jsonschema-2.3.-.el7.noarch /
Verifying : python-monotonic-0.3-.el7.noarch /
Verifying : pyparsing-2.0.-.el7.noarch /
Verifying : :python-glanceclient-1.1.-.el7.noarch /
Verifying : python-netifaces-0.10.-.el7.x86_64 /
Verifying : python-traceback2-1.4.-.el7.noarch /
Verifying : python-httplib2-0.7.-.el7.noarch /
Verifying : python2-oslo-utils-2.5.-.el7.noarch /
Verifying : python-webob-1.2.-.el7.noarch /
Verifying : python-msgpack-0.4.-.el7.x86_64 /
Verifying : python-unicodecsv-0.14.-.el7.noarch /
Verifying : python2-oslo-serialization-1.9.-.el7.noarch /
Verifying : python-neutronclient-3.1.-.el7.noarch /
Verifying : :python2-oslo-config-2.4.-.el7.noarch /
Verifying : python-cliff-1.15.-.el7.noarch /
Verifying : python-babel-1.3-.el7.noarch /
Verifying : python2-appdirs-1.4.-.el7.noarch /
Verifying : python2-oslo-i18n-2.6.-.el7.noarch /
Verifying : :python-novaclient-2.30.-.el7.noarch /
Verifying : pytz-2012d-.el7.noarch / Installed:
python-openstackclient.noarch :1.7.-.el7 Dependency Installed:
pyparsing.noarch :2.0.-.el7 python-babel.noarch :1.3-.el7 python-cinderclient.noarch :1.4.-.el7
python-cliff.noarch :1.15.-.el7 python-cliff-tablib.noarch :1.1-.el7 python-cmd2.noarch :0.6.-.el7
python-crypto.x86_64 :2.6.-.el7.centos python-extras.noarch :0.0.-.el7 python-fixtures.noarch :0.3.-.el7
python-glanceclient.noarch :1.1.-.el7 python-httplib2.noarch :0.7.-.el7 python-iso8601.noarch :0.1.-.el7
python-jsonschema.noarch :2.3.-.el7 python-keyring.noarch :5.0-.el7 python-keystoneclient.noarch :1.7.-.el7
python-linecache2.noarch :1.0.-.el7 python-mimeparse.noarch :0.1.-.el7 python-monotonic.noarch :0.3-.el7
python-msgpack.x86_64 :0.4.-.el7 python-netaddr.noarch :0.7.-.el7 python-netifaces.x86_64 :0.10.-.el7
python-neutronclient.noarch :3.1.-.el7 python-novaclient.noarch :2.30.-.el7 python-pbr.noarch :1.8.-.el7
python-simplejson.x86_64 :3.3.-.el7 python-stevedore.noarch :1.8.-.el7 python-tablib.noarch :0.10.-.el7
python-testtools.noarch :1.8.-.el7 python-traceback2.noarch :1.4.-.el7 python-unicodecsv.noarch :0.14.-.el7
python-unittest2.noarch :1.0.-.el7 python-warlock.noarch :1.0.-.el7 python-webob.noarch :1.2.-.el7
python-wrapt.x86_64 :1.10.-.el7 python2-appdirs.noarch :1.4.-.el7 python2-debtcollector.noarch :0.8.-.el7
python2-os-client-config.noarch :1.7.-.el7 python2-oslo-config.noarch :2.4.-.el7 python2-oslo-i18n.noarch :2.6.-.el7
python2-oslo-serialization.noarch :1.9.-.el7 python2-oslo-utils.noarch :2.5.-.el7 pytz.noarch :2012d-.el7 Complete!
测试一下呗,看看是否安装成功了,就执行一下openstack指令,随便试试看,看看都出现些什么:
[stack@ip---- devstack]$ openstack
(openstack) ll
openstack: 'll' is not an openstack command. See 'openstack --help'.
Did you mean one of these?
help
ip fixed add
ip fixed remove
ip floating add
ip floating create
ip floating delete
ip floating list
ip floating pool list
ip floating remove
role add
role create
role delete
role list
role remove
role show
(openstack)
是不是有命令行的功能了,其实还是比较简单的,友好的Usage信息。
下面还要说下,openstack的命令行工作,很多命令都需要设置很多参数,主要是openstack的不同的project之间相互通信,以及不同的用户的权限不同,API大多都涉及到权限认证等过程。为了使用的方便,需要将这些参数设置为环境变量,也是官方建议的做法。若不做这个,每次输入命令的时候带上参数其实也可以,只是比较麻烦:
[root@ip---- opt]# openstack project list
Missing parameter(s):
Set a username with --os-username, OS_USERNAME, or auth.username
Set an authentication URL, with --os-auth-url, OS_AUTH_URL or auth.auth_url
Set a scope, such as a project or domain, set a project scope with --os-project-name, OS_PROJECT_NAME or auth.project_name, set a domain scope with --os-domain-name, OS_DOMAIN_NAME or auth.domain_name
由于我有自己的devstack环境,所以,我直接登录到horizon的web界面,在project>compute>access&security下面的API access表下面,可以下载OpenStack RC file,下载后,将其source一下,就是实现变量export到当前termianl的环境变量列表中去,使用command 的时候,就可以不需要输入一些常规的参数了。
[root@ip---- opt]# echo $OS_USERNAME #执行source命令之前,OS_USERNAME是没有环境变量值的。
[root@ip---- opt]# source admin-openrc.sh #执行source命令后,需要输入用户名对应的密码,这里是admin的用户
Please enter your OpenStack Password:
[root@ip---- opt]# echo $OS_USERNAME #再查看,是不是有值了,admin就在环境变量里面了
admin
[root@ip---- opt]#
[root@ip---- opt]# openstack project list #再执行这个命令,是不是可以查看信息了,没有提示missing parameter(s)了吧。。
+----------------------------------+--------------------+
| ID | Name |
+----------------------------------+--------------------+
| 084a681f7fb44883b2ea6a4d17685156 | demo |
| 1710e04fb87b4dfe8fe2eb3f7e2bee2d | admin |
| 49af56f946a34e73a2289a3c3cf135c0 | alt_demo |
| 52ea2756ed024ecfb79dbb6e81cbe367 | invisible_to_admin |
| e3600e0af95346f5996359e3dea3ef36 | service |
+----------------------------------+--------------------+
最后,列举一下,可能的client包,以及对应的功能描述:
OpenStack services and clients
Service | Client | Package | Description |
---|---|---|---|
Application catalog | murano | python-muranoclient | Creates and manages applications. |
Block Storage | cinder | python-cinderclient | Creates and manages volumes. |
Clustering service | senlin | python-senlinclient | Creates and manages clustering services. |
Compute | nova | python-novaclient | Creates and manages images, instances, and flavors. |
Containers service | magnum | python-magnumclient | Creates and manages containers. |
Database service | trove | python-troveclient | Creates and manages databases. |
Data processing | sahara | python-saharaclient | Creates and manages Hadoop clusters on OpenStack. |
Deployment service | tuskar | python-tuskarclient | Plans Deployments. |
Identity | keystone | python-keystoneclient | Creates and manages users, tenants, roles, endpoints, and credentials. |
Image service | glance | python-glanceclient | Creates and manages images. |
Key Manager service | barbican | python-barbicanclient | Creates and manages keys. |
Monitoring | monasca | python-monascaclient | Monitoring solution. |
Networking | neutron | python-neutronclient | Configures networks for guest servers. |
Object Storage | swift | python-swiftclient | Gathers statistics, lists items, updates metadata, and uploads, downloads, and deletes files stored by the Object Storage service. Gains access to an Object Storage installation for ad hoc processing. |
Orchestration | heat | python-heatclient | Launches stacks from templates, views details of running stacks including events and resources, and updates and deletes stacks. |
Rating service | cloudkitty | python-cloudkittyclient | Rating service. |
Shared file systems | manila | python-manilaclient | Creates and manages shared file systems. |
Telemetry | ceilometer | python-ceilometerclient | Creates and collects measurements across OpenStack. |
Telemetry v3 | gnocchi | python-gnocchiclient | Creates and collects measurements across OpenStack. |
Workflow service | mistral | python-mistralclient | Workflow service for OpenStack cloud. |
Common client | openstack | python-openstackclient | Common client for the OpenStack project. |