HPE: Fix keyerror seen during volume migration

Refactors _get_updated_comments to retrieve updated comment via Volume.get().
This prevents a KeyError when getting comment during volume migration.

Closes-Bug: #2008931
Change-Id: Ic0cfa68172d2b0607928b35fec081da96e33c434
This commit is contained in:
Desire Barine 2023-03-15 20:14:34 +00:00
parent 42d5d1d648
commit 955ac9e3fc
2 changed files with 8 additions and 1 deletions

View File

@ -3092,7 +3092,7 @@ class HPE3PARCommon(object):
def _get_updated_comment(self, vol_name, **values):
vol = self.client.getVolume(vol_name)
comment = json.loads(vol['comment']) if vol['comment'] else {}
comment = json.loads(vol['comment']) if vol.get('comment') else {}
comment.update(values)
def _update_comment(self, vol_name, **values):

View File

@ -0,0 +1,7 @@
---
fixes:
- |
HPE 3PAR driver `bug #2008931
<https://bugs.launchpad.net/cinder/+bug/2008931>`_: Fixed
issue when performing migrate volume operation when `comment`
attribute is missing from the volume.