From ceddb3cfd033661f63d1245a45e0e197561be19c Mon Sep 17 00:00:00 2001
From: whoami-rajat <rajatdhasmana@gmail.com>
Date: Thu, 5 Dec 2019 05:18:38 +0000
Subject: [PATCH] Fix: --poll inconsistency

When we use `--poll` parameter with cinder create command, it waits
for the volume to become available but doesn't update the data
displayed to the user.
Due to this, there are inconsistency between several parameters
in the output after 'poll' and 'cinder show' command.
Eg: cinder create 1 --image <image-id> --poll
shows 'bootable' flag as false
whereas, cinder show <vol-id>
shows 'bootable' as true

Change-Id: I1502e88f1cd84d225b75c07313e4eb252cc2d645
Closes-Bug: #1855224
---
 cinderclient/tests/unit/v3/test_shell.py | 1 -
 cinderclient/v3/shell.py                 | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/cinderclient/tests/unit/v3/test_shell.py b/cinderclient/tests/unit/v3/test_shell.py
index ee35ddfd9..f76a4847e 100644
--- a/cinderclient/tests/unit/v3/test_shell.py
+++ b/cinderclient/tests/unit/v3/test_shell.py
@@ -1165,7 +1165,6 @@ class ShellTest(utils.TestCase):
         volume = self.shell.cs.volumes.get('1234')
         info = dict()
         info.update(volume._info)
-        info.pop('links', None)
         self.assertEqual(1, poll_method.call_count)
         timeout_period = 3600
         poll_method.assert_has_calls([mock.call(self.shell.cs.volumes.get,
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index fa1cc9c0f..fcb9e4a04 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -675,6 +675,8 @@ def do_create(cs, args):
         shell_utils._poll_for_status(
             cs.volumes.get, volume.id, info, 'creating', ['available'],
             timeout_period, cs.client.global_request_id, cs.messages)
+        volume = cs.volumes.get(volume.id)
+        info.update(volume._info)
 
     utils.print_dict(info)