[cinder] how cinder gets the volume name when restore from a backup?

Tony Liu tonyliu0592 at hotmail.com
Tue Apr 26 03:00:30 UTC 2022

Hi Rajat,

I did those steps on dashboard with Xena.
I don't think dashboard save the volume name, it must be from API.
But I can't figure out where the volume name is retrieved when restore
the deleted volume from backup.

From: Rajat Dhasmana <rdhasman at redhat.com>
Sent: April 24, 2022 10:01 PM
To: Tony Liu
Cc: openstack-dev at lists.openstack.org
Subject: Re: [cinder] how cinder gets the volume name when restore from a backup?

Hi Tony,

On Sun, Apr 24, 2022 at 9:43 AM Tony Liu <tonyliu0592 at hotmail.com<mailto:tonyliu0592 at hotmail.com>> wrote:

Here is what I do.
* Create a volume.
* Create a backup of this volume.
* Delete the volume.
* Restore the volume from backup.

There are different ways to do the following operations, 1) from cinderclient, 2) from openstackclient, 3) hitting the API manually or with a script etc so it's always good to be explicit about how the steps were done i.e. mentioning the way used to perform the above operations.
Also it's helpful to provide the OpenStack release you're using as different releases have different behavior. I will use OpenStack Zed (master) as reference for below observations.
Lastly providing the volume and backup backend is also useful information (however not very relevant in this case).

The restored volume has different UUID, but the same name.

AFAICS, if you're using cinderclient or hitting API directly, there's a "name" parameter[1][2] you can provide that will be used as the name of the restored volume.
If you don't provide the name parameter, it will create the volume with the following name "restore_backup_<backup-id>"[3].

I don't see volume name is stored in backup metadata.

It's not taken from backup metadata.

How does Cinder know the volume name when restore it from backup,
given the volume is already deleted?


[1] https://opendev.org/openstack/python-cinderclient/src/branch/master/cinderclient/v3/shell.py#L227-L232
[2] https://opendev.org/openstack/cinder/src/branch/master/cinder/api/contrib/backups.py#L214
[3] https://opendev.org/openstack/cinder/src/branch/master/cinder/backup/api.py#L384-L386

Thanks and Regards
Rajat Dhasmana

More information about the openstack-discuss mailing list