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.

openstack命令行的更多相关文章

  1. openstack 命令行管理 - 目录

    原文http://blog.csdn.net/signmem/article/details/19513775 相关 openstack  命令行管理, 分下面部分进行介绍 openstack 命令行 ...

  2. OpenStack 命令行速查表

    OpenStack 命令行速查表   updated: 2017-07-18 08:53 Contents 认证 (keystone) 镜像(glance) 计算 (nova) 实例的暂停.挂起.停止 ...

  3. OpenStack命令行工具与API

    Openstack命令行工具 我们推荐Openstack命令行工具和Openstack的Dashboard两者结合使用.一些用户由于使用过其他云技术背景的,可能会使用EC2兼容的API,相对于我们需要 ...

  4. Openstack命令行创建不同vlan段虚拟机

    默认使用nova-network的vlan模式,但是在使用默认的dashboard的时候,不能指定创建的虚拟机的使用网段,固定IP地址. 实际上该功能是在存在的,只是openstack的dashbbo ...

  5. Openstack命令行删除虚拟机硬件模板flavor

    openstack中,有一种概念叫flavor,其实flavor就是一种创建虚拟机的硬件尺寸模板化.比如我先创建一个flavor,该flavor包含的CPU数目,内存大小,硬盘大小都预先设置好,在创建 ...

  6. openstack操作之一 命令行

    在openstack环境中提供了多种操作虚拟机的方法,有最简单直接的dashborad界面,有不直观但高效的命令行,还有进阶版的postman调用openstack restfulapi和命令行中使用 ...

  7. rabbitmq常用命令行汇总

    最近处理openstack问题时,碰到了rabbitmq相关的问题,使用相关命令行时,经常去现找相关的帖子,感觉很麻烦,记录下自己定位问题时,用到的一些常用命令行,方便以后问题的查找 1)常用的一些查 ...

  8. OpenStack-keystone命令行

    Keystone简介 Keystone(OpenStack Identity Service)是OpenStack框架中,负责身份验证.服务规则和服务令牌的功能, 它实现了OpenStack的Iden ...

  9. 人性化的HTTP命令行工具——HTTPie

    Httpie 是什么 Httpie (aych-tee-tee-pie)是一个 HTTP 的命令行客户端.其目标是让 CLI 和 web 服务之间的交互尽可能的人性化.你可以用它很方便的用 http ...

随机推荐

  1. java学习第九天

    目标 异常(5个关键字 throw try catch finally throws ) 一.概念 异常: 非正常情况,例外.人为什么会生病?内因+外因.内因: 身体不够健壮—>锻炼身体增强体质 ...

  2. Redis 3.0 集群搭建

    Redis 3.0 集群搭建 开启两个虚拟机 分别在两个虚拟机上开启3个Redis实例 3主3从两个虚拟机里的实例互为主备 下面分别在两个虚拟机上安装,网络设置参照codis集群的前两个主机 分别关闭 ...

  3. Java中生成随机字符的方法总结

    package learnExercise; public class RandomCharacter { public static char getRandomCharacter(char ch1 ...

  4. keynotes egestas,PPT 渐变背景下载-imsoft.cnblogs

  5. linux shell 逻辑运算符、逻辑表达式详解

    shell的逻辑运算符 涉及有以下几种类型,因此只要适当选择,可以解决我们很多复杂的判断,达到事半功倍效果. 一.逻辑运算符 逻辑卷标 表示意思 1. 关于档案与目录的侦测逻辑卷标! -f 常用!侦测 ...

  6. mysql 操作突然断网,MySQL: “lock wait timeout exceeded”

    show processlist;//显示所有进程select * from information_schema.innodb_trx;//查询锁的进程-- kill 310;//杀掉锁进程

  7. ZOJ 1234 Chopsticks

    原题链接 题目大意:有这么一个公式 A,B,C(A<=B<=C), (A-B)^2来衡量这对数字的好坏,值越小越好.现在给出一个数组,要求每三个配对,最后得到的每组值总和最小. 解法:我是 ...

  8. 【BZOJ2013】【JSOI2008】球形空间产生器

    看chty代码 原题: BZOJ挂了--等好了补上题面 有一个球形空间产生器能够在n维空间中产生一个坚硬的球体.现在,你被困在了这个n维球体中,你只知道球面上n+1个点的坐标,你需要以最快的速度确定这 ...

  9. android开源项目---项目篇

    本文转载于:http://blog.csdn.net/likebamboo/article/details/19081151 主要介绍那些Android还不错的完整项目,目前包含的项目主要依据是项目有 ...

  10. 【转】免费开源的FTP软件,FileZilla

    原文网址:http://baike.baidu.com/view/670329.htm?fr=aladdin FileZilla FileZilla是一个免费开源的FTP软件,分为客户端版本和服务器版 ...