티스토리 뷰

OpenStack

Cinder 명령어로 볼륨 생성하기

naleejang 2012. 12. 13. 16:21

오픈테크넷에서 세미나를 한 후 저에게 질문을 해 오시는 분들이 생기기 시작했습니다. 저도 아직 오픈스택에 대해 많은 것을 알고 있는것이 아니라, 그냥 단지 먼저 삽질을 시작한 것 뿐이고 아직 삽질하지 못한 부분이 더 많이 있습니다. 


그리고, 질문들이 제가 이전에 겪었던 그래서 커뮤니티 회원의 누군가로부터 도움을 받았던 내용들이라 저도 그 내용을 다시 전파를 해 주었습니다. 오늘은 어떤 분이 cinder 볼륨과 nova 볼륨에 대한 질문을 해 오셨기에 저도 아직 사용해 보지 않은 내용이고 많이 테스트 해 보지 않은 부분이라서 cinder 명령어를 테스트 해 보고, 정리해 보았습니다.



Cinder 명령어는 nova 명령어와 같이 cinder-manage 로 시작하는 명령어가 있고, cinder로 시작하는 명령어가 있다. 어떤 종류의 서브 명령어와 옵션들이 있는지 궁금하다면 help를 치면 친절하게 어떤 명령어들이 있는지 나온다.

$ cinder-manage --help

Available categories:

       config

       db

       host

       logs

       shell

       sm

       version

       volume

       migrate

 

$ cinder --help

Command-line interface to the OpenStack Volume API.

Positional arguments:

  <subcommand>

    absolute-limits     Print a list of absolute limits for a user

    create              Add a new volume.

    credentials         Show user credentials returned from auth

    delete              Remove a volume.

    endpoints           Discover endpoints that get returned from the

                        authenticate services

    extra-specs-list    Print a list of current 'volume types and extra specs'

                        (Admin Only).

    list                List all the volumes.

    quota-class-show    List the quotas for a quota class.

    quota-class-update  Update the quotas for a quota class.

    quota-defaults      List the default quotas for a tenant.

    quota-show          List the quotas for a tenant.

    quota-update        Update the quotas for a tenant.

    rate-limits         Print a list of rate limits for a user

    rename              Rename a volume.

    show                Show details about a volume.

    snapshot-create     Add a new snapshot.

    snapshot-delete     Remove a snapshot.

    snapshot-list       List all the snapshots.

    snapshot-rename     Rename a snapshot.

    snapshot-show       Show details about a snapshot.

    type-create         Create a new volume type.

    type-delete         Delete a specific volume type

    type-key            Set or unset extra_spec for a volume type.

    type-list           Print a list of available 'volume types'.

    bash-completion     Prints all of the commands and options to stdout so

                        that the

    help                Display help about this program or one of its

                        subcommands.


cinder-manage 의 서브 커맨드들은 9개가 존재를 하며 그중에서도 가장 많이 쓰이는 것이 host 가 아닐까 싶다.

cinder volume storage로 설정되어 있는 host 리스트 정보를 보여준다. 아직까지는 cinder가 제대로 구현이 되지 않아 debug 도 함께 보이지만, 이것도 좀 업데이트 되지 않을까 싶다.

$ cinder-manage host list

host                          zone          

2012-12-13 15:49:35 DEBUG cinder.utils [req-f93bbb68-15a9-47e6-a104-20c5cde70c3c None None] backend <module 'cinder.db.sqlalchemy.api' from '/opt/stack/cinder/cinder/db/sqlalchemy/api.pyc'> from (pid=5719) __get_backend /opt/stack/cinder/cinder/utils.py:557

openstack02                   nova          

openstack01                   nova          

openstack03                   nova


그외에 cinder-manage의 서브 커맨드들은 어떤 옵션들이 있는걸까? Help를 통해 알아보자

$ cinder-manage config   # 이 명령어는 cinder.conf 파일을 보여준다.

/usr/local/bin/cinder-manage category action [<args>]

Available actions for config category:

       list

 

$ cinder-manage db       # DB와 내용을 sync시키고, version정보를 보여준다.

/usr/local/bin/cinder-manage category action [<args>]

Available actions for db category:

       sync

       version

 

$ cinder-manage logs     # cinder를 사용하면서 발생하는 에러로그와 시스템로그를 보여준다.

/usr/local/bin/cinder-manage category action [<args>]

Available actions for logs category:

       errors

       syslog


지금까지는 cinder-manage 명령어에 대해서 알아보았다. 지금부터는 cinder 로 시작하는 명령어에 대해서 알아보도록 하자.

나는 우선 cinder 명령어를 익히기 위해서 Dashboard에서 다 지원하지만, Command 로 볼륨을 생성하고 인스턴스에 Attach를 시켜보았다. 같이 한번 해 보도록 하자.


1. 우선 내가 생성할 수 볼륨 사이즈가 어떻게 되는지 알아본다. 이건 다음과 같이 다양한 명령어로 확인할 수 있다. 

$ cinder absolute-limits

+-------------------------+-------+

|           Name          | Value |

+-------------------------+-------+

| maxTotalVolumeGigabytes |  1000 |

|     maxTotalVolumes     |   10  |

+-------------------------+-------+

 

$ cinder quota-show nalee   # nalee는 내 계정이 소속된 Tenant 명이다.

+-----------+-------+

|  Property | Value |

+-----------+-------+

| gigabytes |  1000 |

|  volumes  |   10  |

+-----------+-------+

$ cinder quota-defaults nalee

+-----------+-------+

|  Property | Value |

+-----------+-------+

| gigabytes |  1000 |

|  volumes  |   10  |

+-----------+-------+

$ cinder quota-class-show nalee

+-----------+-------+

|  Property | Value |

+-----------+-------+

| gigabytes |  1000 |

|  volumes  |   10  |

+-----------+-------+


2. cinder create 명령어로 volume을 생성한다.

$ cinder create --display-name "testvol" --display-description "test" --availability-zone "nova" 100

+---------------------+--------------------------------------+

|       Property      |                Value                 |

+---------------------+--------------------------------------+

|     attachments     |                  []                  |

|  availability_zone  |                 nova                 |

|       bootable      |                false                 |

|      created_at     |      2012-12-13T05:28:13.131825      |

| display_description |                 test                 |

|     display_name    |               testvol                |

|          id         | a6257e84-a8a9-403a-8587-ee70aa476a58 |

|       metadata      |                  {}                  |

|         size        |                 100                  |

|     snapshot_id     |                 None                 |

|        status       |               creating               |

|     volume_type     |                 None                 |

+---------------------+--------------------------------------+


이렇게 생성을 하면 Dashboard의 Volumes 메뉴에서 확인이 가능하다.

 

3. 볼륨이 잘 생성되었는지 cinder list로 확인한다.

$ cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

| 260d2060-eb6f-4ed9-9b46-c7ae999379fb | available |   testvol    | 100  |     None    |  false   |             |

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+


4. 이번에는 volume의 상세정보를 한번 확인해 보자.

$ cinder show 260d2060-eb6f-4ed9-9b46-c7ae999379fb

+------------------------------+--------------------------------------+

|           Property           |                Value                 |

+------------------------------+--------------------------------------+

|         attachments          |                  []                  |

|      availability_zone       |                 nova                 |

|           bootable           |                false                 |

|          created_at          |      2012-12-13T05:28:13.000000      |

|     display_description      |                 test                 |

|         display_name         |               testvol                |

|              id              | 260d2060-eb6f-4ed9-9b46-c7ae999379fb |

|           metadata           |                  {}                  |

|    os-vol-host-attr:host     |             openstack02              |

| os-vol-tenant-attr:tenant_id |   1e1cf5cd2c3b419a858f9730a320860e   |

|             size             |                 100                  |

|         snapshot_id          |                 None                 |

|            status            |              available               |

|         volume_type          |                 None                 |

+------------------------------+--------------------------------------+


5. 그럼 이제 인스턴스와 cinder 볼륨을 연결시켜보자. 다음과 같이 nova-list 로 인스턴스 정보를 확인하고 cinder list로 볼륨 정보를 확인한다. 

$ nova list

+--------------------------------------+--------+--------+--------------------+

| ID                                   | Name   | Status | Networks           |

+--------------------------------------+--------+--------+--------------------+

| 88b90166-88aa-4d2d-acc1-90b3ca9016c8 | testvm | ACTIVE | private=10.4.128.2 |

+--------------------------------------+--------+--------+--------------------+

$ cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

|                  ID                  |   Status  | Display Name | Size | Volume Type | Bootable | Attached to |

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

| 260d2060-eb6f-4ed9-9b46-c7ae999379fb | available |   testvol    | 100  |     None    |  false   |             |

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

$ nova volume-attach 88b90166-88aa-4d2d-acc1-90b3ca9016c8 260d2060-eb6f-4ed9-9b46-c7ae999379fb /dev/vdc

+----------+--------------------------------------+

| Property | Value                                |

+----------+--------------------------------------+

| device   | /dev/vdc                             |

| id       | 260d2060-eb6f-4ed9-9b46-c7ae999379fb |

| serverId | 88b90166-88aa-4d2d-acc1-90b3ca9016c8 |

| volumeId | 260d2060-eb6f-4ed9-9b46-c7ae999379fb |

+----------+--------------------------------------+


이렇게 생성하고 나면 Dashboard에서 역시 인스턴스와 볼륨이 연결되어 있는 걸을 확인 할 수 있다.



처음 오픈스택을 시작했을 때는 Help 기능이 있는지도 잘 몰라서 많이 헤매었는데 몇 개월동안 삽질을 하다보니 이제 당연히 Help를 보고 따라 쳐보면 되겠구나 라는 생각이 든다. 나도 그동안 많이 발전한 거겠지~~~ 삽질을 통해서 말이다.ㅋ


오픈스택이라는 오픈소스는 먼저 삽질을 시작한 선배들에게서 배우고, 또 이제 막 삽질을 시작한 후배들에게 정보를 공유할 수 있어 이것이 바로 오픈소스를 공부하고 사용하는 또 하나의 매력이 아닌가 싶다. ^^

'OpenStack' 카테고리의 다른 글

Keystone 명령어 테이블  (0) 2013.01.04
Openstack Swift Install Shell Script  (2) 2012.12.21
Chef 명령어 정리  (0) 2012.12.07
Ubuntu에서 Ubuntu Instance로 접속할 때~!!  (7) 2012.11.21
OpenStack Folsom에서의 Quantum 문제  (1) 2012.11.15
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함