OpenStack cinder命令集合

1、#cinder help

  獲得幫助信息,列出所有命令。

2、[root@wi115-10 ~]# cinder absolute-limits
    +-------------------------+-------+
    |           Name          | Value |
    +-------------------------+-------+
    | maxTotalVolumeGigabytes |  1000 |
    |     maxTotalVolumes     |   10  |
    +-------------------------+-------+

列出當前用戶的所有資源(Print a list of absolute limits for a user),此用戶能夠用的磁盤總大小爲1000G,volume個數最大爲10個。

3、[root@wi115-10 ~]# cinder create --display_name cin01 10
  +---------------------+--------------------------------------+
  |       Property      |                Value                 |
  +---------------------+--------------------------------------+
  |     attachments     |                  []                  |
  |  availability_zone  |                 nova                 |
  |      created_at     |      2012-12-18T07:03:08.490263      |
  | display_description |                 None                 |
  |     display_name    |                cin01                 |
  |          id         | 93b42627-f4db-4e70-8531-5687b30cc32a |
  |       metadata      |                  {}                  |
  |         size        |                  10                  |
  |     snapshot_id     |                 None                 |
  |        status       |               creating               |
  |     volume_type     |                 None                 |
  +---------------------+--------------------------------------+

創建一個volume,後還可以接其他參數,如:--volume_type <type_name>

4、[root@wi115-10 ~]# cinder list
  +--------------------------------------+-----------+--------------+------+-------------+-------------+
  |                  ID                  |   Status  | Display Name | Size | Volume Type | Attached to |
  +--------------------------------------+-----------+--------------+------+-------------+-------------+
  | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 | available |      qt      |  10  |     None    |             |
  | 93b42627-f4db-4e70-8531-5687b30cc32a |   error   |    cin01     |  10  |     None    |             |
  +--------------------------------------+-----------+--------------+------+-------------+-------------+

列出所有的volume(剛剛創建的那個error了T_T。。。。),與cinder沒有獨立出來之前的 # nova volume-list命令功能相同。

5、[root@wi115-10 ~]# cinder delete 93b42627-f4db-4e70-8531-5687b30cc32a

  [root@wi115-10 ~]# cinder list
  +--------------------------------------+-----------+--------------+------+-------------+-------------+
  |                  ID                  |   Status  | Display Name | Size | Volume Type | Attached to |
  +--------------------------------------+-----------+--------------+------+-------------+-------------+
  | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 | available |      qt      |  10  |     None    |             |
  +--------------------------------------+-----------+--------------+------+-------------+-------------+

刪除一個volume,#cinder delete <volume_id or volume_name>,與cinder沒有獨立出來之前的 # nova volume-delete<volume_id or volume_name>命令功能相同。

6、[root@wi115-10 ~]# cinder credentials

幫助裏的解釋是:“Discover endpoints that get returned from the authenticate services.”,這條命令的具體用途我不是很清楚,但是看列出來的類容,是將openstack的幾個獨立模塊的authority信息給列出來了。
  +------------------+----------------------------------------------------------------------------------------+
  | User Credentials |                                         Value                                          |
  +------------------+----------------------------------------------------------------------------------------+
  |        id        |                            2f98c94b6e2149c984a09c738ef815da                            |
  |       name       |                                         admin                                          |
  |      roles       | [{u'name': u'admin'}, {u'name': u'KeystoneServiceAdmin'}, {u'name': u'KeystoneAdmin'}] |
  |   roles_links    |                                           []                                           |
  |     username     |                                         admin                                          |
  +------------------+----------------------------------------------------------------------------------------+
  +---------+---------------------------------------------------------------------------------------------------------+
  |  Token  |                                                  Value                                                  |
  +---------+---------------------------------------------------------------------------------------------------------+
  | expires |                                           2012-12-19T07:14:14Z                                          |
  |    id   |                                     17d0550c8e154e439a61051505237328                                    |
  |  tenant | {u'enabled': True, u'id': u'74b0e15f70414b7ea8c43a08ba3211f1', u'name': u'admin', u'description': None} |
  +---------+---------------------------------------------------------------------------------------------------------+

列出當前用戶的keystone認證信息。

7、[root@wi115-10 ~]# cinder show  65d23a41-b13f-4345-ab65-918a4b8a6fe6
  +---------------------+--------------------------------------+
  |       Property      |                Value                 |
  +---------------------+--------------------------------------+
  |     attachments     |                  []                  |
  |  availability_zone  |                 nova                 |
  |      created_at     |      2012-12-18T06:21:45.000000      |
  | display_description |                 None                 |
  |     display_name    |                  qt                  |
  |          id         | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 |
  |       metadata      |                  {}                  |
  |         size        |                  10                  |
  |     snapshot_id     |                 None                 |
  |        status       |              available               |
  |     volume_type     |                 None                 |
  +---------------------+--------------------------------------+

顯示出指定volume的詳細信息,與與cinder沒有獨立出來之前的 # nova volume-show<volume_id or volume_name>命令功能相同。

8、[root@wi115-10 ~]# cinder snapshot-create --display_name qt-snap 65d23a41-b13f-4345-ab65-918a4b8a6fe6
  +---------------------+--------------------------------------+
  |       Property      |                Value                 |
  +---------------------+--------------------------------------+
  |      created_at     |      2012-12-18T07:33:36.105541      |
  | display_description |                 None                 |
  |     display_name    |               qt-snap                |
  |          id         | e95506af-2bc6-48ea-a218-8e8c943262c7 |
  |         size        |                  10                  |
  |        status       |               creating               |
  |      volume_id      | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 |
  +---------------------+--------------------------------------+

創建 一個volume快照。

9、[root@wi115-10 ~]# cinder snapshot-list
  +--------------------------------------+--------------------------------------+--------+--------------+------+
  |                  ID                  |              Volume ID               | Status | Display Name | Size |
  +--------------------------------------+--------------------------------------+--------+--------------+------+
  | e95506af-2bc6-48ea-a218-8e8c943262c7 | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 | error  |   qt-snap    |  10  |
  +--------------------------------------+--------------------------------------+--------+--------------+------+

列出volume快照。

10、[root@wi115-10 ~]# cinder snapshot-show e95506af-2bc6-48ea-a218-8e8c943262c7
  +--------------------------------------------+--------------------------------------+
  |                  Property                  |                Value                 |
  +--------------------------------------------+--------------------------------------+
  |                 created_at                 |      2012-12-18T07:33:36.000000      |
  |            display_description             |                 None                 |
  |                display_name                |               qt-snap                |
  |                     id                     | e95506af-2bc6-48ea-a218-8e8c943262c7 |
  |  os-extended-snapshot-attributes:progress  |                  0%                  |
  | os-extended-snapshot-attributes:project_id |   74b0e15f70414b7ea8c43a08ba3211f1   |
  |                    size                    |                  10                  |
  |                   status                   |                error                 |
  |                 volume_id                  | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 |
  +--------------------------------------------+--------------------------------------+

列出快照的詳細信息。

11、[root@wi115-10 ~]# cinder snapshot-delete e95506af-2bc6-48ea-a218-8e8c943262c7
  [root@wi115-10 ~]# cinder snapshot-list

  [root@wi115-10 ~]#

刪除一個volume快照。

12、[root@wi115-10 ~]# cinder type-create AP
  +----+------+
  | ID   | Name |
  +----+------+
  | 1    |  AP    |
  +----+------+

創建一個volume類型,這樣在創建volume的時候就可以加上類型:

  [root@wi115-10 ~]# cinder create --display_name ss --volume_type AP 2
  +---------------------+--------------------------------------+
  |       Property      |                Value                 |
  +---------------------+--------------------------------------+
  |     attachments     |                  []                  |
  |  availability_zone  |                 nova                 |
  |      created_at     |      2012-12-18T07:51:30.034858      |
  | display_description |                 None                 |
  |     display_name    |                  ss                  |
  |          id         | b2ea409b-3b4d-44bb-8b4c-0d5ef6200985 |
  |       metadata      |                  {}                  |
  |         size        |                  2                   |
  |     snapshot_id     |                 None                 |
  |        status       |               creating               |
  |     volume_type     |                  1                   |
  +---------------------+--------------------------------------+
  [root@wi115-10 ~]# cinder list
  +--------------------------------------+-----------+--------------+------+-------------+-------------+
  |                  ID                  |   Status  | Display Name | Size | Volume Type | Attached to |
  +--------------------------------------+-----------+--------------+------+-------------+-------------+
  | 65d23a41-b13f-4345-ab65-918a4b8a6fe6 | available |      qt      |  10  |     None    |             |
  | b2ea409b-3b4d-44bb-8b4c-0d5ef6200985 | available |      ss      |  2   |      AP     |             |
  +--------------------------------------+-----------+--------------+------+-------------+-------------+

13、[root@wi115-10 ~]# cinder type-list
  +----+------+
  | ID | Name |
  +----+------+
  | 1  |  AP  |
  +----+------+

列出所有的volume type。

14、[root@wi115-10 ~]# cinder type-delete 1
  [root@wi115-10 ~]# cinder type-list

  [root@wi115-10 ~]#

刪除指定的volume type。不知道是什麼原因,之前在測試創建有類型的volume時,--volume_type後只能接type的名字,而在刪除type時,只能接type的ID。

另外,cinder還有幾個關於quato的命令,目前沒有研究有什麼作用,待進一步學習。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章