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

Rajat Dhasmana rdhasman at redhat.com
Mon Apr 25 05:01:10 UTC 2022


Hi Tony,

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

> Hi,
>
> 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?
>
>
> Thanks!
> Tony
>
>
>
[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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20220425/5f142bc5/attachment.htm>


More information about the openstack-discuss mailing list