From 751b0a0411941490e5d1be678e0a3ca4ad1b8db5 Mon Sep 17 00:00:00 2001 From: Jakub Jursa Date: Mon, 5 Jun 2017 15:16:50 +0200 Subject: [PATCH] Pass hints to Cinder scheduler in create_volume This commit adds support for passing 'scheduler_hints' as kwarg in create_volume. Change-Id: I85915fab03f2bff77a21802791f2f6a7579815f2 --- shade/openstackcloud.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shade/openstackcloud.py b/shade/openstackcloud.py index 25aa5a690..c0c1c49f4 100644 --- a/shade/openstackcloud.py +++ b/shade/openstackcloud.py @@ -3764,9 +3764,13 @@ class OpenStackCloud( kwargs['imageRef'] = image_obj['id'] kwargs = self._get_volume_kwargs(kwargs) kwargs['size'] = size + payload = dict(volume=kwargs) + if 'scheduler_hints' in kwargs: + payload['OS-SCH-HNT:scheduler_hints'] = kwargs.pop( + 'scheduler_hints', None) with _utils.shade_exceptions("Error in creating volume"): volume = self._volume_client.post( - '/volumes', json=dict(volume=kwargs)) + '/volumes', json=dict(payload)) self.list_volumes.invalidate(self) if volume['status'] == 'error':