[HPE] Volume name migration fails with keyerror

Bug #2008931 reported by Abhinav Shrivastava
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
Unassigned

Bug Description

Tried to migrate volume using openstack cinder driver, It fails with following stack trace:

23-03-01 01:41:22.233 188499 ERROR cinder.volume.drivers.hpe.hpe_3par_common [req-9a148c2c-84ba-4b32-b6ae-b56400195810 38c48571d2a449a4961bab3245931a7d 38bfeb802369419391b14d61bbdb52fe - - -] Changing the migrating volume name from osv-yaFqp-.iPS.U3oE.Jvsj4FA to osv-3NcxHxxxxtttzzzzZYcT6w failed because 'comment'
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager [req-9a148c2c-84ba-4b32-b6ae-b56400195810 38c48571d2a449a4961bab3245931a7d 38bfeb802369419391b14d61bbdb52fe - - -] Failed to copy volume ca516ca7-ffa2-492f-94de-813e2468f814 to dcd7311e-d842-4e8a-97df-80e8658713eb: KeyError: 'comment'
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager Traceback (most recent call last):
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/manager.py", line 2395, in _migrate_volume_generic
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager self.migrate_volume_completion(ctxt, volume, new_volume,
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/manager.py", line 2539, in migrate_volume_completion
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager self.update_migrated_volume(ctxt, new_volume, volume,
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/powervc_cinder/volume/manager.py", line 2913, in update_migrated_volume
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager super(PowerVCVolumeManager, self).update_migrated_volume(
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/manager.py", line 4623, in update_migrated_volume
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager model_update = self.driver.update_migrated_volume(ctxt,
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/volume_utils.py", line 1473, in trace_logging_wrapper
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager return f(*args, **kwargs)
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/drivers/hpe/hpe_3par_base.py", line 266, in update_migrated_volume
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager return self.common.update_migrated_volume(context, volume, new_volume,
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/drivers/hpe/hpe_3par_common.py", line 2990, in update_migrated_volume
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager self._update_comment(current_name, volume_id=volume['id'],
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/drivers/hpe/hpe_3par_common.py", line 3010, in _update_comment
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager comment = self._get_updated_comment(vol_name, **values)
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager File "/usr/lib/python3.9/site-packages/cinder/volume/drivers/hpe/hpe_3par_common.py", line 3003, in _get_updated_comment
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager comment = json.loads(vol['comment']) if vol['comment'] else {}
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager KeyError: 'comment'
2023-03-01 01:41:22.264 188499 ERROR cinder.volume.manager
2023-03-01 01:41:23.382 188499 WARNING py.warnings

Revision history for this message
Abhinav Shrivastava (abshriva) wrote :

Changing :

    def _get_updated_comment(self, vol_name, **values):
        vol = self.client.getVolume(vol_name)
        comment = json.loads(vol['comment']) if vol['comment'] else {}
        comment.update(values)

to

    def _get_updated_comment(self, vol_name, **values):
        vol = self.client.getVolume(vol_name)
        comment = json.loads(vol['comment']) if vol.get('comment') else {}
        comment.update(values)

resolves the issue.

description: updated
tags: added: drivers hpe
Changed in cinder:
importance: Undecided → Low
tags: added: low-hanging-fruit
removed: hpe
tags: added: hpe
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/877583

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/877583
Committed: https://opendev.org/openstack/cinder/commit/955ac9e3fcb4d96081d5caff40441acc0e0c0a8e
Submitter: "Zuul (22348)"
Branch: master

commit 955ac9e3fcb4d96081d5caff40441acc0e0c0a8e
Author: Desire Barine <email address hidden>
Date: Wed Mar 15 20:14:34 2023 +0000

    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

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 23.0.0.0rc1

This issue was fixed in the openstack/cinder 23.0.0.0rc1 release candidate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.