From 68784feef22e9253316aee08322dc586b3402e34 Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Sat, 30 Jun 2018 07:34:08 -0400 Subject: [PATCH] cinder: Specify mountpoint host param to attach API When an image data is uploaded to cinder backend, it causes the following error: glance_store._drivers.cinder BadRequest: Invalid input for field/attribute mountpoint. This is due to cinder require the mountpoint param on attach API. Change-Id: Ie82e9f4f3848cebe54f4dbccb9018815a0d5ebf1 Closes-Bug: #1779455 --- glance_store/_drivers/cinder.py | 2 +- glance_store/tests/unit/test_cinder_store.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/glance_store/_drivers/cinder.py b/glance_store/_drivers/cinder.py index dab944d4..ace0cc8a 100644 --- a/glance_store/_drivers/cinder.py +++ b/glance_store/_drivers/cinder.py @@ -492,7 +492,7 @@ class Store(glance_store.driver.Store): connection_info['driver_volume_type'], root_helper, conn=connection_info) device = conn.connect_volume(connection_info['data']) - volume.attach(None, None, attach_mode, host_name=host) + volume.attach(None, 'glance_store', attach_mode, host_name=host) volume = self._wait_volume_status(volume, 'attaching', 'in-use') if (connection_info['driver_volume_type'] == 'rbd' and not conn.do_local_attach): diff --git a/glance_store/tests/unit/test_cinder_store.py b/glance_store/tests/unit/test_cinder_store.py index 36a4db5b..4c710b38 100644 --- a/glance_store/tests/unit/test_cinder_store.py +++ b/glance_store/tests/unit/test_cinder_store.py @@ -179,7 +179,8 @@ class TestCinderStore(base.StoreBaseTest, fake_connector.disconnect_volume.assert_called_once_with( mock.ANY, fake_devinfo) fake_volume.attach.assert_called_once_with( - None, None, attach_mode, host_name=socket.gethostname()) + None, 'glance_store', attach_mode, + host_name=socket.gethostname()) fake_volumes.detach.assert_called_once_with(fake_volume) def test_open_cinder_volume_rw(self):