cinder-backup - CLI 'VolumeBackupsRestore' object is not iterable

Bug #1733315 reported by Helen Walsh
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
python-openstackclient
Confirmed
Undecided
Rajat Dhasmana

Bug Description

The CLI outputs "'VolumeBackupsRestore' object is not iterable" even though the restore operation succeeds.

stack@stack:~/devstack$ openstack volume backup restore 48408d59-564c-400d-9d76-1d049091405b 8b4cb4dc-55b5-4931-82d4-c9f224585cc6
'VolumeBackupsRestore' object is not iterable

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

Appears this is coming from somewhere in the client code.

no longer affects: cinder
Changed in python-cinderclient:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

Verified this command works fine with "cinder backup-restore --volume <uuid> <backup_uuid>".

This is happening in openstackclient/volume/v2/backup.py in the take_action() call it returns the result of the restore operation, which is a VolumeBackupsRetore object. But that returns to cliff/display.py where in the run() call it has:

column_names, data = self.take_action(parsed_args)

So the attempt to unpack the VolumeBackupsRestore object into the two variables is what is causing it to blow up.

no longer affects: python-cinderclient
Changed in python-openstackclient:
status: New → Confirmed
Revision history for this message
Sofia Enriquez (lsofia-enriquez) wrote :

I have tried to reproduce the error but It seems like the CLI has been fixed. Should I close this?

cinder backup-restore --volume 5a19899e-3726-414e-92ec-fc923c8812f5 ecef6f16-de5c-4366-a979-9afe0e395352
+-------------+--------------------------------------+
| Property | Value |
+-------------+--------------------------------------+
| backup_id | ecef6f16-de5c-4366-a979-9afe0e395352 |
| volume_id | 5a19899e-3726-414e-92ec-fc923c8812f5 |
| volume_name | v1 |
+-------------+--------------------------------------+

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

Sofia, the example you give shows using the cinder CLI. Did you test this with the openstack client CLI?

See my previous note that this is not an issue in python-cinderclient.

Revision history for this message
Jay Bryant (jsbryant) wrote :

The current status of this bug is unclear. Sofia, have you verified that this works without error on the openstack client as well as the cinderclient? If not, that needs to be done before we can close this.

Thanks!
Jay

Revision history for this message
Rajat Dhasmana (whoami-rajat) wrote :

The same problem persists in master

stack@ubuntu-xenial:~$ openstack volume backup restore c6c37982-b470-4e50-84d7-a0fbdd58c6f0 27b5a87f-4fb6-4bab-8d2e-8ada838e1736
'VolumeBackupsRestore' object is not iterable

Changed in python-openstackclient:
assignee: nobody → Rajat Dhasmana (whoami-rajat)
Revision history for this message
Rajat Dhasmana (whoami-rajat) wrote :

So after digging into the matter i found out that cliff expects a list with two tuples (columns and its respective data) to display in a tabular format whereas the restore class returned VolumeBackupsRetore object as to what sean explained.

VolumeBackupsRetore object contains _info field which should be returned instead of the object

{'_checksum': None,
 '_info': {u'backup_id': u'c6c37982-b470-4e50-84d7-a0fbdd58c6f0',
           u'volume_id': u'27b5a87f-4fb6-4bab-8d2e-8ada838e1736',
           u'volume_name': u'new_vol'},
 '_loaded': False,
 'backup_id': u'c6c37982-b470-4e50-84d7-a0fbdd58c6f0',
 'manager': <cinderclient.v2.volume_backups_restore.VolumeBackupRestoreManager object at 0x7fbe47875590>,
 'volume_id': u'27b5a87f-4fb6-4bab-8d2e-8ada838e1736',
 'volume_name': u'new_vol',
 'x_openstack_request_ids': ['req-557fa5bf-0c4c-4938-8d78-f00ec3684865']}

This is the return value format expected by cliff,

[(u'backup_id', u'volume_id', u'volume_name'), (u'c6c37982-b470-4e50-84d7-a0fbdd58c6f0', u'27b5a87f-4fb6-4bab-8d2e-8ada838e1736', u'new_vol')]

Revision history for this message
Rajat Dhasmana (whoami-rajat) wrote :
Revision history for this message
Deepa (dpaclt) wrote :

Hello Team

Even with the very latest train version we will get this error .

openstack volume backup restore 7272344f-b351-4bf6-9bd8-1d7629009a69 newvol
'VolumeBackupsRestore' object is not iterable

Revision history for this message
Rajat Dhasmana (whoami-rajat) wrote :

Hi Deepa,

I tried executing the same command and it executed successfully in master branch.
Could you share the traceback of the error(s) you received during executing the restore command.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (stable/2023.1)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-openstackclient (stable/2023.1)

Change abandoned by "Lucas de Ataides Barreto <email address hidden>" on branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/python-openstackclient/+/902294

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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