openstack-kr / contributhon-2020

https://openstack-kr-contributhon2020.readthedocs.io
Apache License 2.0
10 stars 16 forks source link

openstack volume create --read-only command issue #45

Open vdqvdw opened 4 years ago

vdqvdw commented 4 years ago

해당 이슈 스토리보드 링크 : https://storyboard.openstack.org/#!/story/2002158

내용

오픈스택 명령어 중 nova에서 volume을 생성하는 명령어를 실행할 때 --read-only 옵션을 주면 readOnly = true 속성을 갖는 volume이 생성되어야 하는데 오류가 발생하며 readOnly = false 속성을 갖는 volume이 생성됨

Shinhocheol commented 4 years ago
stack@devstack-m:~$ openstack volume create --size 1 --read-only hcshin-read-only
Failed to set volume read-only access mode flag: Invalid volume: Volume 23105246-5c4d-4d8f-b05f-9cb78c1eb952 status must be available to update readonly flag, but current status is: creating. (HTTP 400) (Request-ID: req-261bc639-a661-4219-9d1c-2799145c059c)
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2020-08-28T00:35:37.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 23105246-5c4d-4d8f-b05f-9cb78c1eb952 |
| multiattach         | False                                |
| name                | hcshin-read-only                     |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | lvmdriver-1                          |
| updated_at          | None                                 |
| user_id             | 932d51bb88e04a20a45ad7554d818b33     |
+---------------------+--------------------------------------+

#아래 명령어로 확인결과 read-only 값이 빠진 상태로 볼륨이 생성됨 
stack@devstack-m:~$ openstack volume show  hcshin-read-only
+------------------------------+--------------------------------------+
| Field                        | Value                                |
+------------------------------+--------------------------------------+
| attachments                  | []                                   |
| availability_zone            | nova                                 |
| bootable                     | false                                |
| consistencygroup_id          | None                                 |
| created_at                   | 2020-08-28T00:35:37.000000           |
| description                  | None                                 |
| encrypted                    | False                                |
| id                           | 23105246-5c4d-4d8f-b05f-9cb78c1eb952 |
| multiattach                  | False                                |
| name                         | hcshin-read-only                     |
| os-vol-tenant-attr:tenant_id | abb30e5a165d40eb987f13e59540fc13     |
| properties                   |                                      |
| replication_status           | None                                 |
| size                         | 1                                    |
| snapshot_id                  | None                                 |
| source_volid                 | None                                 |
| status                       | available                            |
| type                         | lvmdriver-1                          |
| updated_at                   | 2020-08-28T00:35:38.000000           |
| user_id                      | 932d51bb88e04a20a45ad7554d818b33     |
+------------------------------+--------------------------------------+

# OpenStack volume set 옵션을 사용해서 --read-only 세팅하면 정상적으로 read-only 속성값이 반영
stack@devstack-m:~$ openstack volume set -h  
usage: openstack volume set [-h] [--name <name>] [--size <size>]
                            [--description <description>] [--no-property]
                            [--property <key=value>]
                            [--image-property <key=value>] [--state <state>]
                            [--attached | --detached] [--type <volume-type>]
                            [--retype-policy <retype-policy>]
                            [--bootable | --non-bootable]
                            [--read-only | --read-write]
                            <volume>

stack@devstack-m:~$ openstack volume set --read-only  hcshin-read-only
stack@devstack-m:~$ openstack volume show  hcshin-read-only
+------------------------------+--------------------------------------+
| Field                        | Value                                |
+------------------------------+--------------------------------------+
| attachments                  | []                                   |
| availability_zone            | nova                                 |
| bootable                     | false                                |
| consistencygroup_id          | None                                 |
| created_at                   | 2020-08-28T00:35:37.000000           |
| description                  | None                                 |
| encrypted                    | False                                |
| id                           | 23105246-5c4d-4d8f-b05f-9cb78c1eb952 |
| multiattach                  | False                                |
| name                         | hcshin-read-only                     |
| os-vol-tenant-attr:tenant_id | abb30e5a165d40eb987f13e59540fc13     |
| properties                   | readonly='True'                      |
| replication_status           | None                                 |
| size                         | 1                                    |
| snapshot_id                  | None                                 |
| source_volid                 | None                                 |
| status                       | available                            |
| type                         | lvmdriver-1                          |
| updated_at                   | 2020-08-28T00:35:38.000000           |
| user_id                      | 932d51bb88e04a20a45ad7554d818b33     |
+------------------------------+--------------------------------------+
# volume 생성시 debug모드로 동작하는 방식을 확인  failed 부분을 확인할 필요 하며 volume 생성이후 set옵션동작 방법도 debug모드로 동작 하는 방식에 대해선 로그를 기록함

stack@devstack-m:~/devstack$ openstack volume create --size 1 --read-only hchsin-read-only_1 --debug
START with options: volume create --size 1 --read-only hchsin-read-only_1 --debug
options: Namespace(access_key='', access_secret='***', access_token='***', access_token_endpoint='', access_token_type='', application_credential_id='', application_credential_name='', application_credential_secret='***', auth_methods='', auth_type='password', auth_url='http://192.168.1.31/identity', cacert=None, cert='', client_id='', client_secret='***', cloud='', code='', consumer_key='', consumer_secret='***', debug=True, default_domain='default', default_domain_id='', default_domain_name='', deferred_help=False, discovery_endpoint='', domain_id='', domain_name='', endpoint='', identity_provider='', identity_provider_url='', insecure=None, interface='public', key='', log_file=None, openid_scope='', os_beta_command=False, os_compute_api_version='', os_dns_api_version='2', os_identity_api_version='3', os_image_api_version='', os_key_manager_api_version='1', os_network_api_version='', os_object_api_version='', os_placement_api_version='1.0', os_project_id=None, os_project_name=None, os_volume_api_version='3', passcode='', password='***', profile='', project_domain_id='default', project_domain_name='', project_id='', project_name='demo', protocol='', redirect_uri='', region_name='RegionOne', remote_project_domain_id='', remote_project_domain_name='', remote_project_id='', remote_project_name='', service_provider='', service_provider_endpoint='', service_provider_entity_id='', system_scope='', timing=False, token='***', trust_id='', user_domain_id='default', user_domain_name='', user_id='', username='demo', verbose_level=3, verify=None)
Auth plugin password selected
auth_config_hook(): {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'demo'}, 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.1.31/identity', 'username': 'demo', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'key_manager_api_version': '1', 'placement_api_version': '1.0', 'auth_type': 'password', 'networks': []}
defaults: {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'auth_type': 'password', 'baremetal_status_code_retries': 5, 'baremetal_introspection_status_code_retries': 5, 'image_status_code_retries': 5, 'disable_vendor_agent': {}, 'interface': None, 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active'}
cloud cfg: {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'demo'}, 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.1.31/identity', 'username': 'demo', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'key_manager_api_version': '1', 'placement_api_version': '1.0', 'auth_type': 'password', 'networks': []}
compute API version 2.1, cmd group openstack.compute.v2
identity API version 3, cmd group openstack.identity.v3
image API version 2, cmd group openstack.image.v2
network API version 2, cmd group openstack.network.v2
object_store API version 1, cmd group openstack.object_store.v1
volume API version 3, cmd group openstack.volume.v3
dns API version 2, cmd group openstack.dns.v2
/usr/local/lib/python3.6/dist-packages/barbicanclient/__init__.py:61: UserWarning: The secrets module is moved to barbicanclient/v1 directory, direct import of barbicanclient.secrets will be deprecated. Please import barbicanclient.v1.secrets instead.
  % (name, name, name))
key_manager API version 1, cmd group openstack.key_manager.v1
placement API version 1.0, cmd group openstack.placement.v1
neutronclient API version 2, cmd group openstack.neutronclient.v2
command: volume create -> openstackclient.volume.v2.volume.CreateVolume (auth=True)
Auth plugin password selected
auth_config_hook(): {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'demo'}, 'additional_user_agent': [('osc-lib', '2.2.0')], 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.1.31/identity', 'username': 'demo', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'key_manager_api_version': '1', 'placement_api_version': '1.0', 'auth_type': 'password', 'networks': []}
Using auth plugin: password
Using parameters {'auth_url': 'http://192.168.1.31/identity', 'project_name': 'demo', 'project_domain_id': 'default', 'username': 'demo', 'user_domain_id': 'default', 'password': '***'}
Get auth_ref
REQ: curl -g -i -X GET http://192.168.1.31/identity -H "Accept: application/json" -H "User-Agent: openstacksdk/0.48.0 keystoneauth1/4.2.1 python-requests/2.23.0 CPython/3.6.9"
Starting new HTTP connection (1): 192.168.1.31:80
http://192.168.1.31:80 "GET /identity HTTP/1.1" 300 271
RESP: [300] Connection: close Content-Length: 271 Content-Type: application/json Date: Sat, 29 Aug 2020 12:39:15 GMT Location: http://192.168.1.31/identity/v3/ Server: Apache/2.4.29 (Ubuntu) Vary: X-Auth-Token x-openstack-request-id: req-b20c07b8-4a22-4d3c-bc22-69197d7fc142
RESP BODY: {"versions": {"values": [{"id": "v3.14", "status": "stable", "updated": "2020-04-07T00:00:00Z", "links": [{"rel": "self", "href": "http://192.168.1.31/identity/v3/"}], "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}]}]}}
GET call to http://192.168.1.31/identity used request id req-b20c07b8-4a22-4d3c-bc22-69197d7fc142
Making authentication request to http://192.168.1.31/identity/v3/auth/tokens
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "POST /identity/v3/auth/tokens HTTP/1.1" 201 3243
{"token": {"methods": ["password"], "user": {"domain": {"id": "default", "name": "Default"}, "id": "932d51bb88e04a20a45ad7554d818b33", "name": "demo", "password_expires_at": null}, "audit_ids": ["eiJv3CxWRte8HQFYsfY22w"], "expires_at": "2020-08-29T13:39:15.000000Z", "issued_at": "2020-08-29T12:39:15.000000Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "abb30e5a165d40eb987f13e59540fc13", "name": "demo"}, "is_domain": false, "roles": [{"id": "224166d79e3b4d8ab20f7a55e91900d8", "name": "anotherrole"}, {"id": "ef881cf707084afabbe286ef32ab7ea5", "name": "member"}, {"id": "14614aadb26a4c81b462264669fc75d3", "name": "reader"}], "catalog": [{"endpoints": [{"id": "aee41d94d438416ca1b0924311c053bf", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "0885ee69c65b4cd58a72cc1912c9c6a0", "type": "block-storage", "name": "cinder"}, {"endpoints": [{"id": "2a6362f207cf4784be313b2f4a0bc814", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31:9696/", "region": "RegionOne"}], "id": "0fb53f5c24b74266841dfbc3e37e9f31", "type": "network", "name": "neutron"}, {"endpoints": [{"id": "9b0e2a0081774561bba8fa7b3cb972d4", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/image", "region": "RegionOne"}], "id": "1f0427af3f4d42cf934d6286dc49aa01", "type": "image", "name": "glance"}, {"endpoints": [{"id": "7eabfce83d0149088d77d4e19a8b5fa0", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/placement", "region": "RegionOne"}], "id": "2c6c970fe048442fb0d15eef2af933f2", "type": "placement", "name": "placement"}, {"endpoints": [{"id": "3af3ae7847ab4ef2af7cc641469ae763", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "45485335579e430c8fe2335140cd142f", "type": "volumev3", "name": "cinderv3"}, {"endpoints": [{"id": "cd5975d8891f48feb7d795b02bb55096", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/compute/v2/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "79dd159c4b244b40bc2cfc8e0de6aba1", "type": "compute_legacy", "name": "nova_legacy"}, {"endpoints": [{"id": "faeaf66e772a4b29a9300387d8fd674f", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/volume/v2/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "7cfe928d16e04d7e93566cf23afb7879", "type": "volumev2", "name": "cinderv2"}, {"endpoints": [{"id": "5fdf41615d5a42fb8f48af6a5d472b5e", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/compute/v2.1", "region": "RegionOne"}], "id": "bad95d1534404f7a9b8089f7f9cf68bc", "type": "compute", "name": "nova"}, {"endpoints": [{"id": "d1296397d80748a59a028f1d2124fae3", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/identity", "region": "RegionOne"}, {"id": "d9c8d90784224db189042ede9f11b7c1", "interface": "admin", "region_id": "RegionOne", "url": "http://192.168.1.31/identity", "region": "RegionOne"}], "id": "c9ac6042d109490ea2f4377557d7ea85", "type": "identity", "name": "keystone"}]}}
run(Namespace(availability_zone=None, bootable=False, columns=[], consistency_group=None, description=None, fit_width=False, formatter='table', hint=None, image=None, max_width=0, name='hchsin-read-only_1', noindent=False, non_bootable=False, prefix='', print_empty=False, property=None, read_only=True, read_write=False, size=1, snapshot=None, source=None, source_replicated=None, type=None, variables=[]))
Instantiating volume client: <class 'cinderclient.v3.client.Client'>
REQ: curl -g -i -X GET http://192.168.1.31/image -H "Accept: application/json" -H "User-Agent: openstacksdk/0.48.0 keystoneauth1/4.2.1 python-requests/2.23.0 CPython/3.6.9"
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "GET /image HTTP/1.1" 300 984
RESP: [300] Connection: close Content-Length: 984 Content-Type: application/json Date: Sat, 29 Aug 2020 12:39:15 GMT Server: Apache/2.4.29 (Ubuntu)
RESP BODY: {"versions": [{"id": "v2.9", "status": "CURRENT", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.7", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.6", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.5", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.4", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.3", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.2", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.1", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}, {"id": "v2.0", "status": "SUPPORTED", "links": [{"rel": "self", "href": "http://192.168.1.31/image/v2/"}]}]}
Image client initialized using OpenStack SDK: <openstack.image.v2._proxy.Proxy object at 0x7f624ebee5f8>
REQ: curl -g -i -X POST http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-cinderclient" -H "X-Auth-Token: {SHA256}97621b22682c53f5d8fadb984fd89b00ae10967b18e59a010dc7f180cbe6457d" -d '{"volume": {"size": 1, "consistencygroup_id": null, "snapshot_id": null, "name": "hchsin-read-only_1", "description": null, "volume_type": null, "availability_zone": null, "metadata": {}, "imageRef": null, "source_volid": null, "backup_id": null}}'
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "POST /volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes HTTP/1.1" 202 794
RESP: [202] Connection: close Content-Length: 794 Content-Type: application/json Date: Sat, 29 Aug 2020 12:39:15 GMT OpenStack-API-Version: volume 3.0 Server: Apache/2.4.29 (Ubuntu) Vary: OpenStack-API-Version x-compute-request-id: req-1d326005-20fc-410f-83ee-6719eeb299ca x-openstack-request-id: req-1d326005-20fc-410f-83ee-6719eeb299ca
RESP BODY: {"volume": {"id": "1fe0f208-e7a7-4ac7-a1d2-c6cd40922597", "status": "creating", "size": 1, "availability_zone": "nova", "created_at": "2020-08-29T12:39:16.000000", "updated_at": null, "name": "hchsin-read-only_1", "description": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "links": [{"rel": "self", "href": "http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597"}, {"rel": "bookmark", "href": "http://192.168.1.31/volume/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597"}], "user_id": "932d51bb88e04a20a45ad7554d818b33", "bootable": "false", "encrypted": false, "replication_status": null, "consistencygroup_id": null, "multiattach": false, "attachments": []}}
POST call to volumev3 for http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes used request id req-1d326005-20fc-410f-83ee-6719eeb299ca
REQ: curl -g -i -X POST http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597/action -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-cinderclient" -H "X-Auth-Token: {SHA256}97621b22682c53f5d8fadb984fd89b00ae10967b18e59a010dc7f180cbe6457d" -H "X-OpenStack-Request-ID: req-1d326005-20fc-410f-83ee-6719eeb299ca" -d '{"os-update_readonly_flag": {"readonly": true}}'
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "POST /volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597/action HTTP/1.1" 400 186
RESP: [400] Connection: close Content-Length: 186 Content-Type: application/json Date: Sat, 29 Aug 2020 12:39:15 GMT OpenStack-API-Version: volume 3.0 Server: Apache/2.4.29 (Ubuntu) Vary: OpenStack-API-Version x-compute-request-id: req-cc5c32c7-f8ea-4827-97f0-2a700c7ef58c x-openstack-request-id: req-cc5c32c7-f8ea-4827-97f0-2a700c7ef58c
RESP BODY: {"badRequest": {"code": 400, "message": "Invalid volume: Volume 1fe0f208-e7a7-4ac7-a1d2-c6cd40922597 status must be available to update readonly flag, but current status is: creating."}}
POST call to volumev3 for http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597/action used request id req-cc5c32c7-f8ea-4827-97f0-2a700c7ef58c
Failed to set volume read-only access mode flag: Invalid volume: Volume 1fe0f208-e7a7-4ac7-a1d2-c6cd40922597 status must be available to update readonly flag, 
but current status is: creating. (HTTP 400) (Request-ID: req-cc5c32c7-f8ea-4827-97f0-2a700c7ef58c)
+---------------------+--------------------------------------+
| Field               | Value                                |
+---------------------+--------------------------------------+
| attachments         | []                                   |
| availability_zone   | nova                                 |
| bootable            | false                                |
| consistencygroup_id | None                                 |
| created_at          | 2020-08-29T12:39:16.000000           |
| description         | None                                 |
| encrypted           | False                                |
| id                  | 1fe0f208-e7a7-4ac7-a1d2-c6cd40922597 |
| multiattach         | False                                |
| name                | hchsin-read-only_1                   |
| properties          |                                      |
| replication_status  | None                                 |
| size                | 1                                    |
| snapshot_id         | None                                 |
| source_volid        | None                                 |
| status              | creating                             |
| type                | lvmdriver-1                          |
| updated_at          | None                                 |
| user_id             | 932d51bb88e04a20a45ad7554d818b33     |
+---------------------+--------------------------------------+
clean_up CreateVolume:
END return value: 0

stack@devstack-m:~/devstack$ openstack volume set --read-only hchsin-read-only_1 --debug
START with options: volume set --read-only hchsin-read-only_1 --debug
options: Namespace(access_key='', access_secret='***', access_token='***', access_token_endpoint='', access_token_type='', application_credential_id='', application_credential_name='', application_credential_secret='***', auth_methods='', auth_type='password', auth_url='http://192.168.1.31/identity', cacert=None, cert='', client_id='', client_secret='***', cloud='', code='', consumer_key='', consumer_secret='***', debug=True, default_domain='default', default_domain_id='', default_domain_name='', deferred_help=False, discovery_endpoint='', domain_id='', domain_name='', endpoint='', identity_provider='', identity_provider_url='', insecure=None, interface='public', key='', log_file=None, openid_scope='', os_beta_command=False, os_compute_api_version='', os_dns_api_version='2', os_identity_api_version='3', os_image_api_version='', os_key_manager_api_version='1', os_network_api_version='', os_object_api_version='', os_placement_api_version='1.0', os_project_id=None, os_project_name=None, os_volume_api_version='3', passcode='', password='***', profile='', project_domain_id='default', project_domain_name='', project_id='', project_name='demo', protocol='', redirect_uri='', region_name='RegionOne', remote_project_domain_id='', remote_project_domain_name='', remote_project_id='', remote_project_name='', service_provider='', service_provider_endpoint='', service_provider_entity_id='', system_scope='', timing=False, token='***', trust_id='', user_domain_id='default', user_domain_name='', user_id='', username='demo', verbose_level=3, verify=None)
Auth plugin password selected
auth_config_hook(): {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'demo'}, 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.1.31/identity', 'username': 'demo', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'key_manager_api_version': '1', 'placement_api_version': '1.0', 'auth_type': 'password', 'networks': []}
defaults: {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'auth_type': 'password', 'baremetal_status_code_retries': 5, 'baremetal_introspection_status_code_retries': 5, 'image_status_code_retries': 5, 'disable_vendor_agent': {}, 'interface': None, 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active'}
cloud cfg: {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'demo'}, 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.1.31/identity', 'username': 'demo', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'key_manager_api_version': '1', 'placement_api_version': '1.0', 'auth_type': 'password', 'networks': []}
compute API version 2.1, cmd group openstack.compute.v2
identity API version 3, cmd group openstack.identity.v3
image API version 2, cmd group openstack.image.v2
network API version 2, cmd group openstack.network.v2
object_store API version 1, cmd group openstack.object_store.v1
volume API version 3, cmd group openstack.volume.v3
dns API version 2, cmd group openstack.dns.v2
/usr/local/lib/python3.6/dist-packages/barbicanclient/__init__.py:61: UserWarning: The secrets module is moved to barbicanclient/v1 directory, direct import of barbicanclient.secrets will be deprecated. Please import barbicanclient.v1.secrets instead.
  % (name, name, name))
key_manager API version 1, cmd group openstack.key_manager.v1
placement API version 1.0, cmd group openstack.placement.v1
neutronclient API version 2, cmd group openstack.neutronclient.v2
command: volume set -> openstackclient.volume.v2.volume.SetVolume (auth=True)
Auth plugin password selected
auth_config_hook(): {'api_timeout': None, 'verify': True, 'cacert': None, 'cert': None, 'key': None, 'baremetal_status_code_retries': '5', 'baremetal_introspection_status_code_retries': '5', 'image_status_code_retries': '5', 'disable_vendor_agent': {}, 'interface': 'public', 'floating_ip_source': 'neutron', 'image_api_use_tasks': False, 'image_format': 'qcow2', 'message': '', 'network_api_version': '2', 'object_store_api_version': '1', 'secgroup_source': 'neutron', 'status': 'active', 'auth': {'user_domain_id': 'default', 'project_domain_id': 'default', 'project_name': 'demo'}, 'additional_user_agent': [('osc-lib', '2.2.0')], 'verbose_level': 3, 'deferred_help': False, 'debug': True, 'region_name': 'RegionOne', 'default_domain': 'default', 'timing': False, 'auth_url': 'http://192.168.1.31/identity', 'username': 'demo', 'password': '***', 'beta_command': False, 'identity_api_version': '3', 'volume_api_version': '3', 'dns_api_version': '2', 'key_manager_api_version': '1', 'placement_api_version': '1.0', 'auth_type': 'password', 'networks': []}
Using auth plugin: password
Using parameters {'auth_url': 'http://192.168.1.31/identity', 'project_name': 'demo', 'project_domain_id': 'default', 'username': 'demo', 'user_domain_id': 'default', 'password': '***'}
Get auth_ref
REQ: curl -g -i -X GET http://192.168.1.31/identity -H "Accept: application/json" -H "User-Agent: openstacksdk/0.48.0 keystoneauth1/4.2.1 python-requests/2.23.0 CPython/3.6.9"
Starting new HTTP connection (1): 192.168.1.31:80
http://192.168.1.31:80 "GET /identity HTTP/1.1" 300 271
RESP: [300] Connection: close Content-Length: 271 Content-Type: application/json Date: Sat, 29 Aug 2020 12:57:10 GMT Location: http://192.168.1.31/identity/v3/ Server: Apache/2.4.29 (Ubuntu) Vary: X-Auth-Token x-openstack-request-id: req-40f78a2c-61dc-4f18-b402-c71f47fbb198
RESP BODY: {"versions": {"values": [{"id": "v3.14", "status": "stable", "updated": "2020-04-07T00:00:00Z", "links": [{"rel": "self", "href": "http://192.168.1.31/identity/v3/"}], "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}]}]}}
GET call to http://192.168.1.31/identity used request id req-40f78a2c-61dc-4f18-b402-c71f47fbb198
Making authentication request to http://192.168.1.31/identity/v3/auth/tokens
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "POST /identity/v3/auth/tokens HTTP/1.1" 201 3243
{"token": {"methods": ["password"], "user": {"domain": {"id": "default", "name": "Default"}, "id": "932d51bb88e04a20a45ad7554d818b33", "name": "demo", "password_expires_at": null}, "audit_ids": ["-1PRcjQ8QWKOPw-sNJoFPQ"], "expires_at": "2020-08-29T13:57:10.000000Z", "issued_at": "2020-08-29T12:57:10.000000Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "abb30e5a165d40eb987f13e59540fc13", "name": "demo"}, "is_domain": false, "roles": [{"id": "224166d79e3b4d8ab20f7a55e91900d8", "name": "anotherrole"}, {"id": "ef881cf707084afabbe286ef32ab7ea5", "name": "member"}, {"id": "14614aadb26a4c81b462264669fc75d3", "name": "reader"}], "catalog": [{"endpoints": [{"id": "aee41d94d438416ca1b0924311c053bf", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "0885ee69c65b4cd58a72cc1912c9c6a0", "type": "block-storage", "name": "cinder"}, {"endpoints": [{"id": "2a6362f207cf4784be313b2f4a0bc814", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31:9696/", "region": "RegionOne"}], "id": "0fb53f5c24b74266841dfbc3e37e9f31", "type": "network", "name": "neutron"}, {"endpoints": [{"id": "9b0e2a0081774561bba8fa7b3cb972d4", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/image", "region": "RegionOne"}], "id": "1f0427af3f4d42cf934d6286dc49aa01", "type": "image", "name": "glance"}, {"endpoints": [{"id": "7eabfce83d0149088d77d4e19a8b5fa0", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/placement", "region": "RegionOne"}], "id": "2c6c970fe048442fb0d15eef2af933f2", "type": "placement", "name": "placement"}, {"endpoints": [{"id": "3af3ae7847ab4ef2af7cc641469ae763", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "45485335579e430c8fe2335140cd142f", "type": "volumev3", "name": "cinderv3"}, {"endpoints": [{"id": "cd5975d8891f48feb7d795b02bb55096", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/compute/v2/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "79dd159c4b244b40bc2cfc8e0de6aba1", "type": "compute_legacy", "name": "nova_legacy"}, {"endpoints": [{"id": "faeaf66e772a4b29a9300387d8fd674f", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/volume/v2/abb30e5a165d40eb987f13e59540fc13", "region": "RegionOne"}], "id": "7cfe928d16e04d7e93566cf23afb7879", "type": "volumev2", "name": "cinderv2"}, {"endpoints": [{"id": "5fdf41615d5a42fb8f48af6a5d472b5e", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/compute/v2.1", "region": "RegionOne"}], "id": "bad95d1534404f7a9b8089f7f9cf68bc", "type": "compute", "name": "nova"}, {"endpoints": [{"id": "d1296397d80748a59a028f1d2124fae3", "interface": "public", "region_id": "RegionOne", "url": "http://192.168.1.31/identity", "region": "RegionOne"}, {"id": "d9c8d90784224db189042ede9f11b7c1", "interface": "admin", "region_id": "RegionOne", "url": "http://192.168.1.31/identity", "region": "RegionOne"}], "id": "c9ac6042d109490ea2f4377557d7ea85", "type": "identity", "name": "keystone"}]}}
run(Namespace(attached=False, bootable=False, description=None, detached=False, image_property=None, name=None, no_property=False, non_bootable=False, property=None, read_only=True, read_write=False, retype_policy=None, size=None, state=None, type=None, volume='hchsin-read-only_1'))
Instantiating volume client: <class 'cinderclient.v3.client.Client'>
REQ: curl -g -i -X GET http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/hchsin-read-only_1 -H "Accept: application/json" -H "User-Agent: python-cinderclient" -H "X-Auth-Token: {SHA256}6ed60e87d6a304f913f3a1a39d3abfe035aa5b98a987f676f5362f282d7a789f"
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "GET /volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/hchsin-read-only_1 HTTP/1.1" 404 91
RESP: [404] Connection: close Content-Length: 91 Content-Type: application/json Date: Sat, 29 Aug 2020 12:57:10 GMT OpenStack-API-Version: volume 3.0 Server: Apache/2.4.29 (Ubuntu) Vary: OpenStack-API-Version x-compute-request-id: req-6c83205d-27ab-49ed-9e98-81f13dc1331d x-openstack-request-id: req-6c83205d-27ab-49ed-9e98-81f13dc1331d
RESP BODY: {"itemNotFound": {"code": 404, "message": "Volume hchsin-read-only_1 could not be found."}}
GET call to volumev3 for http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/hchsin-read-only_1 used request id req-6c83205d-27ab-49ed-9e98-81f13dc1331d
REQ: curl -g -i -X GET http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/detail?all_tenants=1&name=hchsin-read-only_1 -H "Accept: application/json" -H "User-Agent: python-cinderclient" -H "X-Auth-Token: {SHA256}6ed60e87d6a304f913f3a1a39d3abfe035aa5b98a987f676f5362f282d7a789f"
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "GET /volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/detail?all_tenants=1&name=hchsin-read-only_1 HTTP/1.1" 200 890
RESP: [200] Connection: close Content-Length: 890 Content-Type: application/json Date: Sat, 29 Aug 2020 12:57:11 GMT OpenStack-API-Version: volume 3.0 Server: Apache/2.4.29 (Ubuntu) Vary: OpenStack-API-Version x-compute-request-id: req-3545c378-47b3-47f1-b89c-9b4dbe6f11e9 x-openstack-request-id: req-3545c378-47b3-47f1-b89c-9b4dbe6f11e9
RESP BODY: {"volumes": [{"id": "1fe0f208-e7a7-4ac7-a1d2-c6cd40922597", "status": "available", "size": 1, "availability_zone": "nova", "created_at": "2020-08-29T12:39:16.000000", "updated_at": "2020-08-29T12:39:17.000000", "name": "hchsin-read-only_1", "description": null, "volume_type": "lvmdriver-1", "snapshot_id": null, "source_volid": null, "metadata": {}, "links": [{"rel": "self", "href": "http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597"}, {"rel": "bookmark", "href": "http://192.168.1.31/volume/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597"}], "user_id": "932d51bb88e04a20a45ad7554d818b33", "bootable": "false", "encrypted": false, "replication_status": null, "consistencygroup_id": null, "multiattach": false, "attachments": [], "os-vol-tenant-attr:tenant_id": "abb30e5a165d40eb987f13e59540fc13"}]}
GET call to volumev3 for http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/detail?all_tenants=1&name=hchsin-read-only_1 used request id req-3545c378-47b3-47f1-b89c-9b4dbe6f11e9
REQ: curl -g -i -X POST http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597/action -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-cinderclient" -H "X-Auth-Token: {SHA256}6ed60e87d6a304f913f3a1a39d3abfe035aa5b98a987f676f5362f282d7a789f" -H "X-OpenStack-Request-ID: req-3545c378-47b3-47f1-b89c-9b4dbe6f11e9" -d '{"os-update_readonly_flag": {"readonly": true}}'
Resetting dropped connection: 192.168.1.31
http://192.168.1.31:80 "POST /volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597/action HTTP/1.1" 202 0
RESP: [202] Connection: close Content-Length: 0 Content-Type: application/json Date: Sat, 29 Aug 2020 12:57:11 GMT OpenStack-API-Version: volume 3.0 Server: Apache/2.4.29 (Ubuntu) Vary: OpenStack-API-Version x-compute-request-id: req-edbb901e-6b8c-4cb0-b749-8749baa05cef x-openstack-request-id: req-edbb901e-6b8c-4cb0-b749-8749baa05cef
POST call to volumev3 for http://192.168.1.31/volume/v3/abb30e5a165d40eb987f13e59540fc13/volumes/1fe0f208-e7a7-4ac7-a1d2-c6cd40922597/action used request id req-edbb901e-6b8c-4cb0-b749-8749baa05cef
clean_up SetVolume:
END return value: 0
stack@devstack-m:~/devstack$
Shinhocheol commented 4 years ago
RESP BODY: {"badRequest": {"code": 400, "message": "Invalid volume: Volume 1fe0f208-e7a7-4ac7-a1d2-c6cd40922597 status must be available to update readonly flag, but current status is: creating."}}

read-only flag 들어가는 항목에서 volume이 만들어지는 상태여서 udate가 진행이 안된ㄴ 문제로 보여집니다.

코드를 volume이 다 만들어지고나서 readonly flag값이 들어가지도록 수정하면 될 것같아요 ~~~