From 9f95ae9dc27dbf08961fdf03570d1b5d2bf95833 Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: Wed, 7 Nov 2018 19:37:01 +0100 Subject: [PATCH] Set right attach mode after migration When migrating attached volumes we are assuming they are always in "rw" mode, which means that a "ro" attached volume will end up as "rw" after a migration. Closes-Bug: #1802155 Change-Id: I374df5d294587e0e91a10525b08ea1a5911c35a1 --- cinder/tests/unit/volume/test_volume_migration.py | 2 +- cinder/volume/manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cinder/tests/unit/volume/test_volume_migration.py b/cinder/tests/unit/volume/test_volume_migration.py index a6a417d0b4c..2270e8e92f2 100644 --- a/cinder/tests/unit/volume/test_volume_migration.py +++ b/cinder/tests/unit/volume/test_volume_migration.py @@ -642,7 +642,7 @@ class VolumeMigrationTestCase(base.BaseVolumeTestCase): attachment['instance_uuid'], attachment['attached_host'], attachment['mountpoint'], - 'rw' + attachment.get('attach_mode', 'rw'), ) self.assertIsNotNone(attachments) self.assertEqual(attached_host, diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 9937c6656fb..7f84b8b9d92 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -2319,7 +2319,7 @@ class VolumeManager(manager.CleanableManager, attachment.instance_uuid, attachment.attached_host, attachment.mountpoint, - 'rw') + attachment.attach_mode or 'rw') # At this point we now have done almost all of our swapping and # state-changes. The target volume is now marked back to # "in-use" the destination/worker volume is now in deleting