summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormvpnitesh <parimalanitesh@gmail.com>2019-01-28 09:12:21 +0000
committerJulia Kreger <juliaashleykreger@gmail.com>2019-02-05 22:18:42 +0000
commit8e0a3b1726223a294a49213e2caa3401b9c24872 (patch)
treefba4a63e4380036516964a20582362b797fa8a54
parent802464eda2280644ee258a2038d9b0eeecfa3cc4 (diff)
downloadironic-8e0a3b1726223a294a49213e2caa3401b9c24872.tar.gz
Provides mount point as cinder requires it to attach volume
This patch provides a mount point which is required by cinder to attach the volume to the baremetal, when the volume targets are created for any node. Story: 2004864 Task: 29107 Change-Id: Id2a2e071026b86a6fd586a998bf865b1ddb960d7 (cherry picked from commit 57037378bec5cd326f4d1efad5b0d4ba76322cc3)
-rw-r--r--ironic/common/cinder.py8
-rw-r--r--ironic/tests/unit/common/test_cinder.py16
-rw-r--r--releasenotes/notes/provide_mountpoint-58cfd25b6dd4cfde.yaml7
3 files changed, 21 insertions, 10 deletions
diff --git a/ironic/common/cinder.py b/ironic/common/cinder.py
index 3f356fcd0..7328f2cb2 100644
--- a/ironic/common/cinder.py
+++ b/ironic/common/cinder.py
@@ -310,10 +310,10 @@ def attach_volumes(task, volume_list, connector):
# database record to indicate that the attachment has
# been completed, which moves the volume to the
# 'attached' state. This action also sets a mountpoint
- # for the volume, if known. In our use case, there is
- # no way for us to know what the mountpoint is inside of
- # the operating system, thus we send None.
- client.volumes.attach(volume_id, instance_uuid, None)
+ # for the volume, as cinder requires a mointpoint to
+ # attach the volume, thus we send 'mount_volume'.
+ client.volumes.attach(volume_id, instance_uuid,
+ 'ironic_mountpoint')
except cinder_exceptions.ClientException as e:
msg = (_('Failed to inform cinder that the attachment for volume '
diff --git a/ironic/tests/unit/common/test_cinder.py b/ironic/tests/unit/common/test_cinder.py
index ce581f554..4b4ceb94f 100644
--- a/ironic/tests/unit/common/test_cinder.py
+++ b/ironic/tests/unit/common/test_cinder.py
@@ -202,6 +202,7 @@ class TestCinderActions(db_base.DbTestCase):
self.node = object_utils.create_test_node(
self.context,
instance_uuid=uuidutils.generate_uuid())
+ self.mount_point = 'ironic_mountpoint'
@mock.patch.object(cinderclient.volumes.VolumeManager, 'attach',
autospec=True)
@@ -246,7 +247,8 @@ class TestCinderActions(db_base.DbTestCase):
mock_reserve.assert_called_once_with(mock.ANY, volume_id)
mock_init.assert_called_once_with(mock.ANY, volume_id, connector)
mock_attach.assert_called_once_with(mock.ANY, volume_id,
- self.node.instance_uuid, None)
+ self.node.instance_uuid,
+ self.mount_point)
mock_set_meta.assert_called_once_with(mock.ANY, volume_id,
{'bar': 'baz'})
mock_get.assert_called_once_with(mock.ANY, volume_id)
@@ -278,7 +280,6 @@ class TestCinderActions(db_base.DbTestCase):
'ironic_volume_uuid': '000-001'}}]
volumes = [volume_id, 'already_attached']
-
connector = {'foo': 'bar'}
mock_create_meta.return_value = {'bar': 'baz'}
mock_get.side_effect = [
@@ -301,7 +302,8 @@ class TestCinderActions(db_base.DbTestCase):
mock_reserve.assert_called_once_with(mock.ANY, volume_id)
mock_init.assert_called_once_with(mock.ANY, volume_id, connector)
mock_attach.assert_called_once_with(mock.ANY, volume_id,
- self.node.instance_uuid, None)
+ self.node.instance_uuid,
+ self.mount_point)
mock_set_meta.assert_called_once_with(mock.ANY, volume_id,
{'bar': 'baz'})
@@ -362,7 +364,7 @@ class TestCinderActions(db_base.DbTestCase):
mock.ANY, '111111111-0000-0000-0000-000000000003', connector)
mock_attach.assert_called_once_with(
mock.ANY, '111111111-0000-0000-0000-000000000003',
- self.node.instance_uuid, None)
+ self.node.instance_uuid, self.mount_point)
mock_set_meta.assert_called_once_with(
mock.ANY, '111111111-0000-0000-0000-000000000003', {'bar': 'baz'})
@@ -453,7 +455,8 @@ class TestCinderActions(db_base.DbTestCase):
mock_reserve.assert_called_once_with(mock.ANY, volume_id)
mock_init.assert_called_once_with(mock.ANY, volume_id, connector)
mock_attach.assert_called_once_with(mock.ANY, volume_id,
- self.node.instance_uuid, None)
+ self.node.instance_uuid,
+ self.mount_point)
mock_get.assert_called_once_with(mock.ANY, volume_id)
mock_is_attached.assert_called_once_with(mock.ANY,
mock_get.return_value)
@@ -503,7 +506,8 @@ class TestCinderActions(db_base.DbTestCase):
mock_reserve.assert_called_once_with(mock.ANY, volume_id)
mock_init.assert_called_once_with(mock.ANY, volume_id, connector)
mock_attach.assert_called_once_with(mock.ANY, volume_id,
- self.node.instance_uuid, None)
+ self.node.instance_uuid,
+ self.mount_point)
mock_set_meta.assert_called_once_with(mock.ANY, volume_id,
{'bar': 'baz'})
mock_get.assert_called_once_with(mock.ANY, volume_id)
diff --git a/releasenotes/notes/provide_mountpoint-58cfd25b6dd4cfde.yaml b/releasenotes/notes/provide_mountpoint-58cfd25b6dd4cfde.yaml
new file mode 100644
index 000000000..6d7b1bca3
--- /dev/null
+++ b/releasenotes/notes/provide_mountpoint-58cfd25b6dd4cfde.yaml
@@ -0,0 +1,7 @@
+---
+fixes:
+ - |
+ Fixes a bug where cinder block storage service volumes volume fail to attach expecting a
+ mountpoint to be a valid string. See `story 2004864
+ <https://storyboard.openstack.org/#!/story/2004864>`_ for additional
+ information.