failed to volume-attach to a instance
I have finished openstack installation with Centos7.3.1611+newton exactly following the guide:https://docs.openstack.org/newton/install-guide-rdo/cinder.html. i can create the server and start from image and it's working, now i want attach a volume to the instance.
[root@controller ~]# nova list
+--------------------------------------+----------------------+--------+------------+-------------+---------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+----------------------+--------+------------+-------------+---------------------+
| 0d13f1ef-6c02-4688-ac0d-ee7e9fe48a95 | selfservice-instance | ACTIVE | - | Running | selfservice=3.3.3.5 |
+--------------------------------------+----------------------+--------+------------+-------------+---------------------+
[root@controller ~]# cinder list
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| 32e01f2b-fda0-4245-a60a-6bb03bafa21b | available | test | 1 | - | false | |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
[root@controller ~]# nova volume-attach selfservice-instance 32e01f2b-fda0-4245-a60a-6bb03bafa21b /dev/vdb
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/vdb |
| id | 32e01f2b-fda0-4245-a60a-6bb03bafa21b |
| serverId | 0d13f1ef-6c02-4688-ac0d-ee7e9fe48a95 |
| volumeId | 32e01f2b-fda0-4245-a60a-6bb03bafa21b |
+----------+--------------------------------------+
[root@controller ~]#
it's looks succesful without error, now i check the cloud disk status on storage, i did not found the target:
[root@storage1 ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
volume-32e01f2b-fda0-4245-a60a-6bb03bafa21b cinder-volumes -wi-a----- 1.00g
[root@storage1 ~]# targetcli
targetcli shell version 2.1.fb41
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> ls
o- / ......................................................................................................................... [...]
o- backstores .............................................................................................................. [...]
| o- block .................................................................................................. [Storage Objects: 0]
| o- fileio ................................................................................................. [Storage Objects: 0]
| o- pscsi .................................................................................................. [Storage Objects: 0]
| o- ramdisk ................................................................................................ [Storage Objects: 0]
o- iscsi ............................................................................................................ [Targets: 0]
o- loopback ......................................................................................................... [Targets: 0]
/>
Then i try to check the cinder logs in /var/log/cinder/api.log :
2017-02-21 20:35:28.459 15057 INFO cinder.api.openstack.wsgi [req-1ffca51d-18b5-4d47-ae42-3fe60fe919e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] POST http://controller:8776/v2/d512da13581f43dd8bf42a525afb830f/volumes
2017-02-21 20:35:28.463 15057 INFO cinder.api.v2.volumes [req-1ffca51d-18b5-4d47-ae42-3fe60fe919e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] Create volume of 1 GB
2017-02-21 20:35:28.476 15057 INFO cinder.volume.api [req-1ffca51d-18b5-4d47-ae42-3fe60fe919e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] Availability Zones retrieved successfully.
2017-02-21 20:35:28.812 15057 INFO cinder.volume.api [req-1ffca51d-18b5-4d47-ae42-3fe60fe919e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] Volume created successfully.
2017-02-21 20:35:28.814 15057 INFO cinder.api.openstack.wsgi [req-1ffca51d-18b5-4d47-ae42-3fe60fe919e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] http://controller:8776/v2/d512da13581f43dd8bf42a525afb830f/volumes returned with HTTP 202
2017-02-21 20:35:28.815 15057 INFO eventlet.wsgi.server [req-1ffca51d-18b5-4d47-ae42-3fe60fe919e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] 1.1.1.5 "POST /v2/d512da13581f43dd8bf42a525afb830f/volumes HTTP/1.1" status: 202 len: 1064 time: 0.9083891
2017-02-21 20:35:28.852 15057 INFO cinder.api.openstack.wsgi [req-2192b1a0-cbcf-40b1-abd1-0ee4712fe9e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] GET http://controller:8776/v2/d512da13581f43dd8bf42a525afb830f/volumes/32e01f2b-fda0-4245-a60a-6bb03bafa21b
2017-02-21 20:35:28.920 15057 INFO cinder.volume.api [req-2192b1a0-cbcf-40b1-abd1-0ee4712fe9e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] Volume info retrieved successfully.
2017-02-21 20:35:28.927 15057 INFO cinder.api.openstack.wsgi [req-2192b1a0-cbcf-40b1-abd1-0ee4712fe9e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] http://controller:8776/v2/d512da13581f43dd8bf42a525afb830f/volumes/32e01f2b-fda0-4245-a60a-6bb03bafa21b returned with HTTP 200
2017-02-21 20:35:28.928 15057 INFO eventlet.wsgi.server [req-2192b1a0-cbcf-40b1-abd1-0ee4712fe9e0 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] 1.1.1.5 "GET /v2/d512da13581f43dd8bf42a525afb830f/volumes/32e01f2b-fda0-4245-a60a-6bb03bafa21b HTTP/1.1" status: 200 len: 1237 time: 0.1092041
2017-02-21 20:35:41.201 15049 INFO cinder.api.openstack.wsgi [req-29a8fa7b-fe92-4035-98fd-0f9ab6c3fad9 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] GET http://controller:8776/v2/d512da13581f43dd8bf42a525afb830f/volumes/detail
2017-02-21 20:35:41.275 15049 INFO cinder.volume.api [req-29a8fa7b-fe92-4035-98fd-0f9ab6c3fad9 090c13cc34ef44d9b1c44f9ca588fa2f d512da13581f43dd8bf42a525afb830f - default default] Get all volumes ...
Two suggestions. 1: I don't know what Cinder wants with /var/lib/nova; search the Cinder configuration for this string and correct it if necessary. 2: If /var/lib/nova is legitimate, perhaps you have an SELinux issue. Cinder is supposed to create the directory as root.
My cinder.conf has a config variable named lock_path which "Defaults to environment variable OSLO_LOCK_PATH". Could be a candidate.