SHIHUC

好记性不如烂笔头,还可以分享给别人看看! 专注基础算法,互联网架构,人工智能领域的技术实现和应用。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

openstack命令行

Posted on 2016-01-13 11:48  shihuc  阅读(4803)  评论(0编辑  收藏  举报

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

这里列出安装过程中,可以看到有那些子包被安装了:

  1 [stack@ip-10-121-5-244 devstack]$ sudo yum install python-openstackclient
  2 Loaded plugins: fastestmirror
  3 Loading mirror speeds from cached hostfile
  4  * base: ftp.iij.ad.jp
  5  * epel: ftp.jaist.ac.jp
  6  * extras: ftp.iij.ad.jp
  7  * updates: ftp.iij.ad.jp
  8 Resolving Dependencies
  9 --> Running transaction check
 10 ---> Package python-openstackclient.noarch 0:1.7.1-1.el7 will be installed
 11 --> Processing Dependency: python-stevedore for package: python-openstackclient-1.7.1-1.el7.noarch
 12 --> Processing Dependency: python-pbr for package: python-openstackclient-1.7.1-1.el7.noarch
 13 --> Processing Dependency: python-oslo-utils for package: python-openstackclient-1.7.1-1.el7.noarch
 14 --> Processing Dependency: python-oslo-serialization for package: python-openstackclient-1.7.1-1.el7.noarch
 15 --> Processing Dependency: python-oslo-i18n for package: python-openstackclient-1.7.1-1.el7.noarch
 16 --> Processing Dependency: python-oslo-config for package: python-openstackclient-1.7.1-1.el7.noarch
 17 --> Processing Dependency: python-os-client-config for package: python-openstackclient-1.7.1-1.el7.noarch
 18 --> Processing Dependency: python-novaclient for package: python-openstackclient-1.7.1-1.el7.noarch
 19 --> Processing Dependency: python-neutronclient for package: python-openstackclient-1.7.1-1.el7.noarch
 20 --> Processing Dependency: python-keystoneclient for package: python-openstackclient-1.7.1-1.el7.noarch
 21 --> Processing Dependency: python-glanceclient for package: python-openstackclient-1.7.1-1.el7.noarch
 22 --> Processing Dependency: python-crypto for package: python-openstackclient-1.7.1-1.el7.noarch
 23 --> Processing Dependency: python-cliff-tablib for package: python-openstackclient-1.7.1-1.el7.noarch
 24 --> Processing Dependency: python-cliff for package: python-openstackclient-1.7.1-1.el7.noarch
 25 --> Processing Dependency: python-cinderclient for package: python-openstackclient-1.7.1-1.el7.noarch
 26 --> Processing Dependency: python-babel for package: python-openstackclient-1.7.1-1.el7.noarch
 27 --> Running transaction check
 28 ---> Package python-babel.noarch 0:1.3-6.el7 will be installed
 29 --> Processing Dependency: pytz for package: python-babel-1.3-6.el7.noarch
 30 ---> Package python-cinderclient.noarch 0:1.4.0-1.el7 will be installed
 31 --> Processing Dependency: python-simplejson for package: python-cinderclient-1.4.0-1.el7.noarch
 32 ---> Package python-cliff.noarch 0:1.15.0-1.el7 will be installed
 33 --> Processing Dependency: python-cmd2 >= 0.6.7 for package: python-cliff-1.15.0-1.el7.noarch
 34 --> Processing Dependency: python-unicodecsv for package: python-cliff-1.15.0-1.el7.noarch
 35 ---> Package python-cliff-tablib.noarch 0:1.1-3.el7 will be installed
 36 --> Processing Dependency: python-tablib for package: python-cliff-tablib-1.1-3.el7.noarch
 37 ---> Package python-crypto.x86_64 0:2.6.1-1.el7.centos will be installed
 38 ---> Package python-glanceclient.noarch 1:1.1.0-1.el7 will be installed
 39 --> Processing Dependency: python-warlock for package: 1:python-glanceclient-1.1.0-1.el7.noarch
 40 --> Processing Dependency: python-httplib2 for package: 1:python-glanceclient-1.1.0-1.el7.noarch
 41 ---> Package python-keystoneclient.noarch 1:1.7.2-1.el7 will be installed
 42 --> Processing Dependency: python-iso8601 >= 0.1.9 for package: 1:python-keystoneclient-1.7.2-1.el7.noarch
 43 --> Processing Dependency: python-debtcollector >= 0.3.0 for package: 1:python-keystoneclient-1.7.2-1.el7.noarch
 44 --> Processing Dependency: python-webob for package: 1:python-keystoneclient-1.7.2-1.el7.noarch
 45 --> Processing Dependency: python-netaddr for package: 1:python-keystoneclient-1.7.2-1.el7.noarch
 46 --> Processing Dependency: python-keyring for package: 1:python-keystoneclient-1.7.2-1.el7.noarch
 47 ---> Package python-neutronclient.noarch 0:3.1.0-1.el7 will be installed
 48 --> Processing Dependency: pyparsing for package: python-neutronclient-3.1.0-1.el7.noarch
 49 ---> Package python-novaclient.noarch 1:2.30.1-1.el7 will be installed
 50 --> Processing Dependency: python-netifaces for package: 1:python-novaclient-2.30.1-1.el7.noarch
 51 ---> Package python-pbr.noarch 0:1.8.1-2.el7 will be installed
 52 ---> Package python-stevedore.noarch 0:1.8.0-1.el7 will be installed
 53 ---> Package python2-os-client-config.noarch 0:1.7.4-1.el7 will be installed
 54 --> Processing Dependency: python-fixtures for package: python2-os-client-config-1.7.4-1.el7.noarch
 55 --> Processing Dependency: python-appdirs for package: python2-os-client-config-1.7.4-1.el7.noarch
 56 ---> Package python2-oslo-config.noarch 2:2.4.0-1.el7 will be installed
 57 ---> Package python2-oslo-i18n.noarch 0:2.6.0-1.el7 will be installed
 58 ---> Package python2-oslo-serialization.noarch 0:1.9.0-1.el7 will be installed
 59 --> Processing Dependency: python-msgpack for package: python2-oslo-serialization-1.9.0-1.el7.noarch
 60 ---> Package python2-oslo-utils.noarch 0:2.5.0-1.el7 will be installed
 61 --> Processing Dependency: python-monotonic for package: python2-oslo-utils-2.5.0-1.el7.noarch
 62 --> Running transaction check
 63 ---> Package pyparsing.noarch 0:2.0.3-1.el7 will be installed
 64 ---> Package python-cmd2.noarch 0:0.6.8-3.el7 will be installed
 65 ---> Package python-fixtures.noarch 0:0.3.14-3.el7 will be installed
 66 --> Processing Dependency: python-testtools for package: python-fixtures-0.3.14-3.el7.noarch
 67 ---> Package python-httplib2.noarch 0:0.7.7-3.el7 will be installed
 68 ---> Package python-iso8601.noarch 0:0.1.10-1.el7 will be installed
 69 ---> Package python-keyring.noarch 0:5.0-1.el7 will be installed
 70 ---> Package python-monotonic.noarch 0:0.3-1.el7 will be installed
 71 ---> Package python-msgpack.x86_64 0:0.4.6-1.el7 will be installed
 72 ---> Package python-netaddr.noarch 0:0.7.18-1.el7 will be installed
 73 ---> Package python-netifaces.x86_64 0:0.10.4-1.el7 will be installed
 74 ---> Package python-simplejson.x86_64 0:3.3.3-1.el7 will be installed
 75 ---> Package python-tablib.noarch 0:0.10.0-1.el7 will be installed
 76 ---> Package python-unicodecsv.noarch 0:0.14.1-1.el7 will be installed
 77 ---> Package python-warlock.noarch 0:1.0.1-1.el7 will be installed
 78 --> Processing Dependency: python-jsonschema for package: python-warlock-1.0.1-1.el7.noarch
 79 ---> Package python-webob.noarch 0:1.2.3-6.el7 will be installed
 80 ---> Package python2-appdirs.noarch 0:1.4.0-4.el7 will be installed
 81 ---> Package python2-debtcollector.noarch 0:0.8.0-1.el7 will be installed
 82 --> Processing Dependency: python-wrapt for package: python2-debtcollector-0.8.0-1.el7.noarch
 83 ---> Package pytz.noarch 0:2012d-5.el7 will be installed
 84 --> Running transaction check
 85 ---> Package python-jsonschema.noarch 0:2.3.0-1.el7 will be installed
 86 ---> Package python-testtools.noarch 0:1.8.0-2.el7 will be installed
 87 --> Processing Dependency: python-unittest2 >= 0.8.0 for package: python-testtools-1.8.0-2.el7.noarch
 88 --> Processing Dependency: python-mimeparse for package: python-testtools-1.8.0-2.el7.noarch
 89 --> Processing Dependency: python-extras for package: python-testtools-1.8.0-2.el7.noarch
 90 ---> Package python-wrapt.x86_64 0:1.10.4-6.el7 will be installed
 91 --> Running transaction check
 92 ---> Package python-extras.noarch 0:0.0.3-2.el7 will be installed
 93 ---> Package python-mimeparse.noarch 0:0.1.4-2.el7 will be installed
 94 ---> Package python-unittest2.noarch 0:1.0.1-1.el7 will be installed
 95 --> Processing Dependency: python-traceback2 for package: python-unittest2-1.0.1-1.el7.noarch
 96 --> Running transaction check
 97 ---> Package python-traceback2.noarch 0:1.4.0-2.el7 will be installed
 98 --> Processing Dependency: python-linecache2 for package: python-traceback2-1.4.0-2.el7.noarch
 99 --> Running transaction check
100 ---> Package python-linecache2.noarch 0:1.0.0-1.el7 will be installed
101 --> Finished Dependency Resolution
102 
103 Dependencies Resolved
104 
105 =============================================================================================================================================
106  Package                                  Arch                 Version                          Repository                              Size
107 =============================================================================================================================================
108 Installing:
109  python-openstackclient                   noarch               1.7.1-1.el7                      centos-openstack-liberty               431 k
110 Installing for dependencies:
111  pyparsing                                noarch               2.0.3-1.el7                      centos-openstack-liberty                98 k
112  python-babel                             noarch               1.3-6.el7                        centos-openstack-liberty               2.4 M
113  python-cinderclient                      noarch               1.4.0-1.el7                      centos-openstack-liberty               186 k
114  python-cliff                             noarch               1.15.0-1.el7                     centos-openstack-liberty                92 k
115  python-cliff-tablib                      noarch               1.1-3.el7                        centos-openstack-liberty                71 k
116  python-cmd2                              noarch               0.6.8-3.el7                      centos-openstack-liberty                40 k
117  python-crypto                            x86_64               2.6.1-1.el7.centos               extras                                 470 k
118  python-extras                            noarch               0.0.3-2.el7                      centos-openstack-liberty                13 k
119  python-fixtures                          noarch               0.3.14-3.el7                     centos-openstack-liberty                70 k
120  python-glanceclient                      noarch               1:1.1.0-1.el7                    centos-openstack-liberty               248 k
121  python-httplib2                          noarch               0.7.7-3.el7                      centos-openstack-liberty                70 k
122  python-iso8601                           noarch               0.1.10-1.el7                     centos-openstack-liberty                17 k
123  python-jsonschema                        noarch               2.3.0-1.el7                      centos-openstack-liberty                60 k
124  python-keyring                           noarch               5.0-1.el7                        epel                                   116 k
125  python-keystoneclient                    noarch               1:1.7.2-1.el7                    centos-openstack-liberty               606 k
126  python-linecache2                        noarch               1.0.0-1.el7                      centos-openstack-liberty                11 k
127  python-mimeparse                         noarch               0.1.4-2.el7                      epel                                   9.3 k
128  python-monotonic                         noarch               0.3-1.el7                        centos-openstack-liberty               8.0 k
129  python-msgpack                           x86_64               0.4.6-1.el7                      epel                                    73 k
130  python-netaddr                           noarch               0.7.18-1.el7                     centos-openstack-liberty               1.3 M
131  python-netifaces                         x86_64               0.10.4-1.el7                     centos-openstack-liberty                17 k
132  python-neutronclient                     noarch               3.1.0-1.el7                      centos-openstack-liberty               182 k
133  python-novaclient                        noarch               1:2.30.1-1.el7                   centos-openstack-liberty               254 k
134  python-pbr                               noarch               1.8.1-2.el7                      centos-openstack-liberty               161 k
135  python-simplejson                        x86_64               3.3.3-1.el7                      centos-openstack-liberty               171 k
136  python-stevedore                         noarch               1.8.0-1.el7                      centos-openstack-liberty                54 k
137  python-tablib                            noarch               0.10.0-1.el7                     centos-openstack-liberty               747 k
138  python-testtools                         noarch               1.8.0-2.el7                      centos-openstack-liberty               301 k
139  python-traceback2                        noarch               1.4.0-2.el7                      centos-openstack-liberty                18 k
140  python-unicodecsv                        noarch               0.14.1-1.el7                     centos-openstack-liberty                25 k
141  python-unittest2                         noarch               1.0.1-1.el7                      centos-openstack-liberty               171 k
142  python-warlock                           noarch               1.0.1-1.el7                      centos-openstack-liberty                14 k
143  python-webob                             noarch               1.2.3-6.el7                      base                                   202 k
144  python-wrapt                             x86_64               1.10.4-6.el7                     epel                                    45 k
145  python2-appdirs                          noarch               1.4.0-4.el7                      centos-openstack-liberty                16 k
146  python2-debtcollector                    noarch               0.8.0-1.el7                      centos-openstack-liberty                27 k
147  python2-os-client-config                 noarch               1.7.4-1.el7                      centos-openstack-liberty                48 k
148  python2-oslo-config                      noarch               2:2.4.0-1.el7                    centos-openstack-liberty               136 k
149  python2-oslo-i18n                        noarch               2.6.0-1.el7                      centos-openstack-liberty                55 k
150  python2-oslo-serialization               noarch               1.9.0-1.el7                      centos-openstack-liberty                27 k
151  python2-oslo-utils                       noarch               2.5.0-1.el7                      centos-openstack-liberty                96 k
152  pytz                                     noarch               2012d-5.el7                      base                                    38 k
153 
154 Transaction Summary
155 =============================================================================================================================================
156 Install  1 Package (+42 Dependent packages)
157 
158 Total download size: 9.1 M
159 Installed size: 40 M
160 Is this ok [y/d/N]: y
161 Downloading packages:
162 (1/43): pyparsing-2.0.3-1.el7.noarch.rpm                                                                              |  98 kB  00:00:01     
163 (2/43): python-cinderclient-1.4.0-1.el7.noarch.rpm                                                                    | 186 kB  00:00:00     
164 (3/43): python-cliff-1.15.0-1.el7.noarch.rpm                                                                          |  92 kB  00:00:00     
165 (4/43): python-cliff-tablib-1.1-3.el7.noarch.rpm                                                                      |  71 kB  00:00:00     
166 (5/43): python-cmd2-0.6.8-3.el7.noarch.rpm                                                                            |  40 kB  00:00:00     
167 (6/43): python-extras-0.0.3-2.el7.noarch.rpm                                                                          |  13 kB  00:00:00     
168 (7/43): python-crypto-2.6.1-1.el7.centos.x86_64.rpm                                                                   | 470 kB  00:00:00     
169 (8/43): python-fixtures-0.3.14-3.el7.noarch.rpm                                                                       |  70 kB  00:00:00     
170 (9/43): python-glanceclient-1.1.0-1.el7.noarch.rpm                                                                    | 248 kB  00:00:00     
171 (10/43): python-httplib2-0.7.7-3.el7.noarch.rpm                                                                       |  70 kB  00:00:00     
172 (11/43): python-iso8601-0.1.10-1.el7.noarch.rpm                                                                       |  17 kB  00:00:00     
173 (12/43): python-jsonschema-2.3.0-1.el7.noarch.rpm                                                                     |  60 kB  00:00:00     
174 (13/43): python-keyring-5.0-1.el7.noarch.rpm                                                                          | 116 kB  00:00:00     
175 (14/43): python-babel-1.3-6.el7.noarch.rpm                                                                            | 2.4 MB  00:00:04     
176 (15/43): python-mimeparse-0.1.4-2.el7.noarch.rpm                                                                      | 9.3 kB  00:00:00     
177 (16/43): python-linecache2-1.0.0-1.el7.noarch.rpm                                                                     |  11 kB  00:00:00     
178 (17/43): python-msgpack-0.4.6-1.el7.x86_64.rpm                                                                        |  73 kB  00:00:00     
179 (18/43): python-monotonic-0.3-1.el7.noarch.rpm                                                                        | 8.0 kB  00:00:00     
180 (19/43): python-keystoneclient-1.7.2-1.el7.noarch.rpm                                                                 | 606 kB  00:00:02     
181 (20/43): python-netifaces-0.10.4-1.el7.x86_64.rpm                                                                     |  17 kB  00:00:00     
182 (21/43): python-neutronclient-3.1.0-1.el7.noarch.rpm                                                                  | 182 kB  00:00:00     
183 (22/43): python-novaclient-2.30.1-1.el7.noarch.rpm                                                                    | 254 kB  00:00:01     
184 (23/43): python-netaddr-0.7.18-1.el7.noarch.rpm                                                                       | 1.3 MB  00:00:04     
185 (24/43): python-pbr-1.8.1-2.el7.noarch.rpm                                                                            | 161 kB  00:00:00     
186 (25/43): python-simplejson-3.3.3-1.el7.x86_64.rpm                                                                     | 171 kB  00:00:00     
187 (26/43): python-stevedore-1.8.0-1.el7.noarch.rpm                                                                      |  54 kB  00:00:00     
188 (27/43): python-openstackclient-1.7.1-1.el7.noarch.rpm                                                                | 431 kB  00:00:03     
189 (28/43): python-testtools-1.8.0-2.el7.noarch.rpm                                                                      | 301 kB  00:00:01     
190 (29/43): python-traceback2-1.4.0-2.el7.noarch.rpm                                                                     |  18 kB  00:00:00     
191 (30/43): python-unicodecsv-0.14.1-1.el7.noarch.rpm                                                                    |  25 kB  00:00:00     
192 (31/43): python-unittest2-1.0.1-1.el7.noarch.rpm                                                                      | 171 kB  00:00:00     
193 (32/43): python-webob-1.2.3-6.el7.noarch.rpm                                                                          | 202 kB  00:00:00     
194 (33/43): python-wrapt-1.10.4-6.el7.x86_64.rpm                                                                         |  45 kB  00:00:00     
195 (34/43): python-warlock-1.0.1-1.el7.noarch.rpm                                                                        |  14 kB  00:00:00     
196 (35/43): python2-appdirs-1.4.0-4.el7.noarch.rpm                                                                       |  16 kB  00:00:00     
197 (36/43): python2-debtcollector-0.8.0-1.el7.noarch.rpm                                                                 |  27 kB  00:00:00     
198 (37/43): python2-os-client-config-1.7.4-1.el7.noarch.rpm                                                              |  48 kB  00:00:00     
199 (38/43): python-tablib-0.10.0-1.el7.noarch.rpm                                                                        | 747 kB  00:00:04     
200 (39/43): python2-oslo-config-2.4.0-1.el7.noarch.rpm                                                                   | 136 kB  00:00:00     
201 (40/43): python2-oslo-i18n-2.6.0-1.el7.noarch.rpm                                                                     |  55 kB  00:00:00     
202 (41/43): pytz-2012d-5.el7.noarch.rpm                                                                                  |  38 kB  00:00:00     
203 (42/43): python2-oslo-serialization-1.9.0-1.el7.noarch.rpm                                                            |  27 kB  00:00:00     
204 (43/43): python2-oslo-utils-2.5.0-1.el7.noarch.rpm                                                                    |  96 kB  00:00:00     
205 ---------------------------------------------------------------------------------------------------------------------------------------------
206 Total                                                                                                        591 kB/s | 9.1 MB  00:00:15     
207 Running transaction check
208 Running transaction test
209 Transaction test succeeded
210 Running transaction
211   Installing : python-pbr-1.8.1-2.el7.noarch                                                                                            1/43 
212   Installing : python-iso8601-0.1.10-1.el7.noarch                                                                                       2/43 
213   Installing : python-stevedore-1.8.0-1.el7.noarch                                                                                      3/43 
214   Installing : python-netaddr-0.7.18-1.el7.noarch                                                                                       4/43 
215   Installing : 2:python2-oslo-config-2.4.0-1.el7.noarch                                                                                 5/43 
216   Installing : pytz-2012d-5.el7.noarch                                                                                                  6/43 
217   Installing : python-babel-1.3-6.el7.noarch                                                                                            7/43 
218   Installing : python-simplejson-3.3.3-1.el7.x86_64                                                                                     8/43 
219   Installing : python-netifaces-0.10.4-1.el7.x86_64                                                                                     9/43 
220   Installing : pyparsing-2.0.3-1.el7.noarch                                                                                            10/43 
221   Installing : python-keyring-5.0-1.el7.noarch                                                                                         11/43 
222   Installing : python-cmd2-0.6.8-3.el7.noarch                                                                                          12/43 
223   Installing : python2-appdirs-1.4.0-4.el7.noarch                                                                                      13/43 
224   Installing : python-unicodecsv-0.14.1-1.el7.noarch                                                                                   14/43 
225   Installing : python-cliff-1.15.0-1.el7.noarch                                                                                        15/43 
226   Installing : python-msgpack-0.4.6-1.el7.x86_64                                                                                       16/43 
227   Installing : python-webob-1.2.3-6.el7.noarch                                                                                         17/43 
228   Installing : python-httplib2-0.7.7-3.el7.noarch                                                                                      18/43 
229   Installing : python-monotonic-0.3-1.el7.noarch                                                                                       19/43 
230   Installing : python-jsonschema-2.3.0-1.el7.noarch                                                                                    20/43 
231   Installing : python-warlock-1.0.1-1.el7.noarch                                                                                       21/43 
232   Installing : python-wrapt-1.10.4-6.el7.x86_64                                                                                        22/43 
233   Installing : python2-debtcollector-0.8.0-1.el7.noarch                                                                                23/43 
234   Installing : python-crypto-2.6.1-1.el7.centos.x86_64                                                                                 24/43 
235   Installing : python-linecache2-1.0.0-1.el7.noarch                                                                                    25/43 
236   Installing : python-traceback2-1.4.0-2.el7.noarch                                                                                    26/43 
237   Installing : python-unittest2-1.0.1-1.el7.noarch                                                                                     27/43 
238   Installing : python-mimeparse-0.1.4-2.el7.noarch                                                                                     28/43 
239   Installing : python-extras-0.0.3-2.el7.noarch                                                                                        29/43 
240   Installing : python-testtools-1.8.0-2.el7.noarch                                                                                     30/43 
241   Installing : python-fixtures-0.3.14-3.el7.noarch                                                                                     31/43 
242   Installing : python2-oslo-i18n-2.6.0-1.el7.noarch                                                                                    32/43 
243   Installing : python2-oslo-utils-2.5.0-1.el7.noarch                                                                                   33/43 
244   Installing : python2-oslo-serialization-1.9.0-1.el7.noarch                                                                           34/43 
245   Installing : 1:python-keystoneclient-1.7.2-1.el7.noarch                                                                              35/43 
246   Installing : python-cinderclient-1.4.0-1.el7.noarch                                                                                  36/43 
247   Installing : 1:python-glanceclient-1.1.0-1.el7.noarch                                                                                37/43 
248   Installing : python-neutronclient-3.1.0-1.el7.noarch                                                                                 38/43 
249   Installing : 1:python-novaclient-2.30.1-1.el7.noarch                                                                                 39/43 
250   Installing : python2-os-client-config-1.7.4-1.el7.noarch                                                                             40/43 
251   Installing : python-tablib-0.10.0-1.el7.noarch                                                                                       41/43 
252   Installing : python-cliff-tablib-1.1-3.el7.noarch                                                                                    42/43 
253   Installing : python-openstackclient-1.7.1-1.el7.noarch                                                                               43/43 
254   Verifying  : python2-debtcollector-0.8.0-1.el7.noarch                                                                                 1/43 
255   Verifying  : python-unittest2-1.0.1-1.el7.noarch                                                                                      2/43 
256   Verifying  : python-cmd2-0.6.8-3.el7.noarch                                                                                           3/43 
257   Verifying  : python-cliff-tablib-1.1-3.el7.noarch                                                                                     4/43 
258   Verifying  : python-pbr-1.8.1-2.el7.noarch                                                                                            5/43 
259   Verifying  : python-tablib-0.10.0-1.el7.noarch                                                                                        6/43 
260   Verifying  : python-extras-0.0.3-2.el7.noarch                                                                                         7/43 
261   Verifying  : python-openstackclient-1.7.1-1.el7.noarch                                                                                8/43 
262   Verifying  : python-testtools-1.8.0-2.el7.noarch                                                                                      9/43 
263   Verifying  : python-fixtures-0.3.14-3.el7.noarch                                                                                     10/43 
264   Verifying  : 1:python-keystoneclient-1.7.2-1.el7.noarch                                                                              11/43 
265   Verifying  : python-warlock-1.0.1-1.el7.noarch                                                                                       12/43 
266   Verifying  : python-keyring-5.0-1.el7.noarch                                                                                         13/43 
267   Verifying  : python2-os-client-config-1.7.4-1.el7.noarch                                                                             14/43 
268   Verifying  : python-mimeparse-0.1.4-2.el7.noarch                                                                                     15/43 
269   Verifying  : python-linecache2-1.0.0-1.el7.noarch                                                                                    16/43 
270   Verifying  : python-netaddr-0.7.18-1.el7.noarch                                                                                      17/43 
271   Verifying  : python-simplejson-3.3.3-1.el7.x86_64                                                                                    18/43 
272   Verifying  : python-crypto-2.6.1-1.el7.centos.x86_64                                                                                 19/43 
273   Verifying  : python-iso8601-0.1.10-1.el7.noarch                                                                                      20/43 
274   Verifying  : python-wrapt-1.10.4-6.el7.x86_64                                                                                        21/43 
275   Verifying  : python-cinderclient-1.4.0-1.el7.noarch                                                                                  22/43 
276   Verifying  : python-stevedore-1.8.0-1.el7.noarch                                                                                     23/43 
277   Verifying  : python-jsonschema-2.3.0-1.el7.noarch                                                                                    24/43 
278   Verifying  : python-monotonic-0.3-1.el7.noarch                                                                                       25/43 
279   Verifying  : pyparsing-2.0.3-1.el7.noarch                                                                                            26/43 
280   Verifying  : 1:python-glanceclient-1.1.0-1.el7.noarch                                                                                27/43 
281   Verifying  : python-netifaces-0.10.4-1.el7.x86_64                                                                                    28/43 
282   Verifying  : python-traceback2-1.4.0-2.el7.noarch                                                                                    29/43 
283   Verifying  : python-httplib2-0.7.7-3.el7.noarch                                                                                      30/43 
284   Verifying  : python2-oslo-utils-2.5.0-1.el7.noarch                                                                                   31/43 
285   Verifying  : python-webob-1.2.3-6.el7.noarch                                                                                         32/43 
286   Verifying  : python-msgpack-0.4.6-1.el7.x86_64                                                                                       33/43 
287   Verifying  : python-unicodecsv-0.14.1-1.el7.noarch                                                                                   34/43 
288   Verifying  : python2-oslo-serialization-1.9.0-1.el7.noarch                                                                           35/43 
289   Verifying  : python-neutronclient-3.1.0-1.el7.noarch                                                                                 36/43 
290   Verifying  : 2:python2-oslo-config-2.4.0-1.el7.noarch                                                                                37/43 
291   Verifying  : python-cliff-1.15.0-1.el7.noarch                                                                                        38/43 
292   Verifying  : python-babel-1.3-6.el7.noarch                                                                                           39/43 
293   Verifying  : python2-appdirs-1.4.0-4.el7.noarch                                                                                      40/43 
294   Verifying  : python2-oslo-i18n-2.6.0-1.el7.noarch                                                                                    41/43 
295   Verifying  : 1:python-novaclient-2.30.1-1.el7.noarch                                                                                 42/43 
296   Verifying  : pytz-2012d-5.el7.noarch                                                                                                 43/43 
297 
298 Installed:
299   python-openstackclient.noarch 0:1.7.1-1.el7                                                                                                
300 
301 Dependency Installed:
302   pyparsing.noarch 0:2.0.3-1.el7                    python-babel.noarch 0:1.3-6.el7            python-cinderclient.noarch 0:1.4.0-1.el7    
303   python-cliff.noarch 0:1.15.0-1.el7                python-cliff-tablib.noarch 0:1.1-3.el7     python-cmd2.noarch 0:0.6.8-3.el7            
304   python-crypto.x86_64 0:2.6.1-1.el7.centos         python-extras.noarch 0:0.0.3-2.el7         python-fixtures.noarch 0:0.3.14-3.el7       
305   python-glanceclient.noarch 1:1.1.0-1.el7          python-httplib2.noarch 0:0.7.7-3.el7       python-iso8601.noarch 0:0.1.10-1.el7        
306   python-jsonschema.noarch 0:2.3.0-1.el7            python-keyring.noarch 0:5.0-1.el7          python-keystoneclient.noarch 1:1.7.2-1.el7  
307   python-linecache2.noarch 0:1.0.0-1.el7            python-mimeparse.noarch 0:0.1.4-2.el7      python-monotonic.noarch 0:0.3-1.el7         
308   python-msgpack.x86_64 0:0.4.6-1.el7               python-netaddr.noarch 0:0.7.18-1.el7       python-netifaces.x86_64 0:0.10.4-1.el7      
309   python-neutronclient.noarch 0:3.1.0-1.el7         python-novaclient.noarch 1:2.30.1-1.el7    python-pbr.noarch 0:1.8.1-2.el7             
310   python-simplejson.x86_64 0:3.3.3-1.el7            python-stevedore.noarch 0:1.8.0-1.el7      python-tablib.noarch 0:0.10.0-1.el7         
311   python-testtools.noarch 0:1.8.0-2.el7             python-traceback2.noarch 0:1.4.0-2.el7     python-unicodecsv.noarch 0:0.14.1-1.el7     
312   python-unittest2.noarch 0:1.0.1-1.el7             python-warlock.noarch 0:1.0.1-1.el7        python-webob.noarch 0:1.2.3-6.el7           
313   python-wrapt.x86_64 0:1.10.4-6.el7                python2-appdirs.noarch 0:1.4.0-4.el7       python2-debtcollector.noarch 0:0.8.0-1.el7  
314   python2-os-client-config.noarch 0:1.7.4-1.el7     python2-oslo-config.noarch 2:2.4.0-1.el7   python2-oslo-i18n.noarch 0:2.6.0-1.el7      
315   python2-oslo-serialization.noarch 0:1.9.0-1.el7   python2-oslo-utils.noarch 0:2.5.0-1.el7    pytz.noarch 0:2012d-5.el7                   
316 
317 Complete!
View Code

 

测试一下呗,看看是否安装成功了,就执行一下openstack指令,随便试试看,看看都出现些什么:

 1 [stack@ip-10-121-5-244 devstack]$ openstack
 2 (openstack) ll
 3 openstack: 'll' is not an openstack command. See 'openstack --help'.
 4 Did you mean one of these?
 5   help
 6   ip fixed add
 7   ip fixed remove
 8   ip floating add
 9   ip floating create
10   ip floating delete
11   ip floating list
12   ip floating pool list
13   ip floating remove
14   role add
15   role create
16   role delete
17   role list
18   role remove
19   role show
20 (openstack) 

是不是有命令行的功能了,其实还是比较简单的,友好的Usage信息。

 

下面还要说下,openstack的命令行工作,很多命令都需要设置很多参数,主要是openstack的不同的project之间相互通信,以及不同的用户的权限不同,API大多都涉及到权限认证等过程。为了使用的方便,需要将这些参数设置为环境变量,也是官方建议的做法。若不做这个,每次输入命令的时候带上参数其实也可以,只是比较麻烦:

1 [root@ip-10-121-5-244 opt]# openstack project list
2 Missing parameter(s): 
3 Set a username with --os-username, OS_USERNAME, or auth.username
4 Set an authentication URL, with --os-auth-url, OS_AUTH_URL or auth.auth_url
5 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 的时候,就可以不需要输入一些常规的参数了。

 1 [root@ip-10-121-5-244 opt]# echo $OS_USERNAME          #执行source命令之前,OS_USERNAME是没有环境变量值的。
 2 
 3 [root@ip-10-121-5-244 opt]# source admin-openrc.sh        #执行source命令后,需要输入用户名对应的密码,这里是admin的用户
 4 Please enter your OpenStack Password: 
 5 [root@ip-10-121-5-244 opt]# echo $OS_USERNAME          #再查看,是不是有值了,admin就在环境变量里面了
 6 admin
 7 [root@ip-10-121-5-244 opt]# 
 8 [root@ip-10-121-5-244 opt]# openstack project list       #再执行这个命令,是不是可以查看信息了,没有提示missing parameter(s)了吧。。
 9 +----------------------------------+--------------------+
10 | ID                               | Name               |
11 +----------------------------------+--------------------+
12 | 084a681f7fb44883b2ea6a4d17685156 | demo               |
13 | 1710e04fb87b4dfe8fe2eb3f7e2bee2d | admin              |
14 | 49af56f946a34e73a2289a3c3cf135c0 | alt_demo           |
15 | 52ea2756ed024ecfb79dbb6e81cbe367 | invisible_to_admin |
16 | e3600e0af95346f5996359e3dea3ef36 | service            |
17 +----------------------------------+--------------------+

 

最后,列举一下,可能的client包,以及对应的功能描述:

OpenStack services and clients

ServiceClientPackageDescription
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.