Something is up with the NFS driver's migration code, I think it may be
relying on qemu-img locking behavior to work correctly... which has changed
in new versions of qemu-img.
This implies that anyone installing a qemu-img newer than 2.10 may encounter a data loss bug, but I'm still working out the details.
Apply https://review.openstack.org/#/c/611423/ to Cinder, then:
$ cinder type-list
+--------------------------------------+------+-------------+-----------+
| ID | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| 08290bc3-0bab-4ddb-9602-fcb2ced76bcc | nfs2 | - | True |
| e5eb00a3-5814-4459-b1de-94b4bcebdfdd | nfs | - | True |
+--------------------------------------+------+-------------+-----------+
$ cinder create 1 --poll
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2018-10-17T20:02:06.000000 |
| description | None |
| encrypted | False |
| group_id | None |
| id | 66774b90-01ed-4d34-8b9a-5ef586f01380 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | None |
| os-vol-host-attr:host | None |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 1a081dd2505547f5a8bb1a230f2295f4 |
| provider_id | None |
| replication_status | None |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| updated_at | None |
| user_id | ad9fe430b3a6416f908c79e4de3bfa98 |
| volume_type | nfs |
+--------------------------------+--------------------------------------+
$ cinder list
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
| 66774b90-01ed-4d34-8b9a-5ef586f01380 | available | - | 1 | nfs | false | |
+--------------------------------------+-----------+------+------+-------------+----------+-------------+
$ ls -l /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/
total 0
-rw-rw-rw-. 1 root root 1073741824 Oct 17 16:02 volume-66774b90-01ed-4d34-8b9a-5ef586f01380
$ cinder retype --migration-policy on-demand 66774b90-01ed-4d34-8b9a-5ef586f01380 nfs2
During migration:
$ ls -l /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/
total 0
-rw-rw-rw-. 1 root root 1073741824 Oct 17 16:02 volume-66774b90-01ed-4d34-8b9a-5ef586f01380
-rw-r--r--. 1 root root 1073741824 Oct 17 16:03 volume-e256cf97-0392-44e9-9faa-0ef263cdafdc
After migration:
$ ls -l /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/
total 0
!!
Where is the volume file?
snippets from c-vol log:
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG oslo_concurrency.processutils [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf dd if=/opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-66774b90-01ed-4d34-8b9a-5ef586f01380 of=/opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-e256cf97-0392-44e9-9faa-0ef263cdafdc count=1073741824 bs=1M iflag=count_bytes,direct oflag=direct
conv=sparse" returned: 0 in 4.374s {{(pid=20690) execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:409}}
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG cinder.volume.utils [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Volume copy details: src /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-66774b90-01ed-4d34-8b9a-5ef586f01380, dest /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-e256cf97-0392-44e9-9faa-0ef263cdafdc, size 1024.00 MB, duration 4.38 sec {{(pid=20690) _copy_volume_with_path /opt/stack/cinder/cinder/volume/utils.py:487}}
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG os_brick.initiator.connectors.remotefs [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] ==> disconnect_volume: call u"{'connection_properties': {u'name': u'volume-e256cf97-0392-44e9-9faa-0ef263cdafdc', u'format': u'raw', u'encrypted': False, u'qos_specs': None, u'export': u'localhost:/srv/nfs1', u'access_mode': u'rw', u'options': None}, 'self': <os_brick.initiator.connectors.remotefs.RemoteFsConnector object at 0x7fa3add7dc50>, 'force': True, 'device_info': {'path': u'/opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-e256cf97-0392-44e9-9faa-0ef263cdafdc'}, 'ignore_errors': False}" {{(pid=20690) trace_logging_wrapper /opt/stack/os-brick/os_brick/utils.py:146}}
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG os_brick.initiator.connectors.remotefs [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] <== disconnect_volume: return (0ms) None {{(pid=20690) trace_logging_wrapper /opt/stack/os-brick/os_brick/utils.py:170}}
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: INFO cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Terminate volume connection completed successfully.
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG os_brick.initiator.connectors.remotefs [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] ==> disconnect_volume: call u"{'connection_properties': {'name': u'volume-66774b90-01ed-4d34-8b9a-5ef586f01380', 'format': 'raw', 'encrypted': False, 'qos_specs': None, 'export': u'localhost:/srv/nfs1', 'access_mode': 'rw', 'options': None}, 'self': <os_brick.initiator.connectors.remotefs.RemoteFsConnector object at 0x7fa3ae03e9d0>, 'force': True, 'device_info': {'path': u'/opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-66774b90-01ed-4d34-8b9a-5ef586f01380'}, 'ignore_errors': False}" {{(pid=20690) trace_logging_wrapper /opt/stack/os-brick/os_brick/utils.py:146}}
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG os_brick.initiator.connectors.remotefs [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] <== disconnect_volume: return (0ms) None {{(pid=20690) trace_logging_wrapper /opt/stack/os-brick/os_brick/utils.py:170}}
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: INFO cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Terminate volume connection completed successfully.
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: INFO cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Remove volume export completed successfully.
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: INFO cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Remove volume export completed successfully.
Oct 17 16:03:15 centstack.localdomain cinder-volume[20664]: DEBUG cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] migrate_volume_completion: completing migration for volume 66774b90-01ed-4d34-8b9a-5ef586f01380 (temporary volume e256cf97-0392-44e9-9faa-0ef263cdafdc {{(pid=20690) migrate_volume_completion /opt/stack/cinder/cinder/volume/manager.py:2221}}
Oct 17 16:03:16 centstack.localdomain cinder-volume[20664]: INFO cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Complete-Migrate volume completed successfully.
Oct 17 16:03:16 centstack.localdomain cinder-volume[20664]: INFO cinder.volume.manager [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Migrate volume completed successfully.
Oct 17 16:03:16 centstack.localdomain cinder-volume[20664]: DEBUG cinder.coordination [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Lock "cinder-e256cf97-0392-44e9-9faa-0ef263cdafdc-delete_volume" acquired by "delete_volume" :: waited 0.033s {{(pid=20690) _synchronized /opt/stack/cinder/cinder/coordination.py:150}}
Oct 17 16:03:16 centstack.localdomain cinder-volume[20664]: DEBUG cinder.coordination [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Lock "cinder-nfs-e256cf97-0392-44e9-9faa-0ef263cdafdc" acquired by "delete_volume" :: waited 0.021s {{(pid=20690) _synchronized /opt/stack/cinder/cinder/coordination.py:150}}
Oct 17 16:03:16 centstack.localdomain cinder-volume[20664]: DEBUG cinder.volume.drivers.nfs [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Deleting volume e256cf97-0392-44e9-9faa-0ef263cdafdc, provider_location: localhost:/srv/nfs1 {{(pid=20690) delete_volume /opt/stack/cinder/cinder/volume/drivers/nfs.py:517}}
Oct 17 16:03:16 centstack.localdomain cinder-volume[20664]: DEBUG oslo_concurrency.processutils [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Running cmd (subprocess): sudo cinder-rootwrap /etc/cinder/rootwrap.conf rm -f /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-66774b90-01ed-4d34-8b9a-5ef586f01380 {{(pid=20690) execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:372}}
Oct 17 16:03:17 centstack.localdomain cinder-volume[20664]: DEBUG oslo_concurrency.processutils [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] CMD "sudo cinder-rootwrap /etc/cinder/rootwrap.conf rm -f /opt/stack/data/cinder/mnt/896fb15da6036b68a917322e72ebfe57/volume-66774b90-01ed-4d34-8b9a-5ef586f01380" returned: 0 in 0.639s {{(pid=20690) execute /usr/lib/python2.7/site-packages/oslo_concurrency/processutils.py:409}}
Oct 17 16:03:17 centstack.localdomain cinder-volume[20664]: DEBUG cinder.coordination [req-4b404526-db5d-4bbf-ba20-e23f684c83b5 req-283ab440-82d4-4eff-8953-f732d18ce01f demo None] Lock "cinder-nfs-e256cf97-0392-44e9-9faa-0ef263cdafdc" released by "delete_volume" :: held 0.655s {{(pid=20690) _synchronized /opt/stack/cinder/cinder/coordination.py:162}}
Stops happening if we revert the fix for force-share.
Fix proposed to branch: master /review. opendev. org/678278
Review: https:/