Bug 1703939 - [cinder] Deleting a snapshot referenced by glance image is permitted
Summary: [cinder] Deleting a snapshot referenced by glance image is permitted
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-cinder
Version: 14.0 (Rocky)
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Pablo Caruana
QA Contact: Tzach Shefi
Tana
URL:
Whiteboard:
Depends On:
Blocks: 1777781 1791829 1795959
TreeView+ depends on / blocked
 
Reported: 2019-04-29 07:32 UTC by Mauro Oddi
Modified: 2022-08-23 16:04 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1777781 (view as bug list)
Environment:
Last Closed: 2019-05-21 11:56:15 UTC
Target Upstream Version:
Embargoed:
tshefi: automate_bug-


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker OSP-3529 0 None None None 2022-08-23 16:04:30 UTC

Description Mauro Oddi 2019-04-29 07:32:34 UTC
Description of problem:
If a snapshot is created from an instance booted from a volume, a glance image referencing the snapshot is also created. However if the snapshot is later deleted the image referencing the deleted snapshot will remain in glance.

Version-Release number of selected component (if applicable):
RHOSP 14
openstack-cinder-13.0.3-2.el7ost.noarch
python-cinder-13.0.3-2.el7ost.noarch
python2-cinderclient-4.0.1-0.20180809133302.460229c.el7ost.noarch


How reproducible:
always

Steps to Reproduce:
 1. Boot instnace from image and create boot volume

nova boot --flavor rhel_flavor --security-groups 00aae3ce-6df4-4a8f-9ec5-505842308f4f --key-name my_rsa-key --nic net-name=net_ipv64_1 --block-device source=image,id=,dest=volume,size=10,shutdown=preserve,bootindex=0 testvm-vol-1


        (overcloud) [stack@undercloud-0 ~]$ nova boot --flavor rhel_flavor --security-groups 00aae3ce-6df4-4a8f-9ec5-505842308f4f --key-name my_rsa-key --nic net-name=net_ipv64_1 --block-device source=image,id=4eb35e58-f42c-4a23-8b89-9b008a9630b0,dest=volume,size=10,shutdown=preserve,bootindex=0 testvm-vol-1
        +--------------------------------------+-------------------------------------------------+
        | Property                             | Value                                           |
        +--------------------------------------+-------------------------------------------------+
        | OS-DCF:diskConfig                    | MANUAL                                          |
        | OS-EXT-AZ:availability_zone          |                                                 |
        | OS-EXT-SRV-ATTR:host                 | -                                               |
        | OS-EXT-SRV-ATTR:hostname             | testvm-vol-1                                    |
        | OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                               |
        | OS-EXT-SRV-ATTR:instance_name        |                                                 |
        | OS-EXT-SRV-ATTR:kernel_id            |                                                 |
        | OS-EXT-SRV-ATTR:launch_index         | 0                                               |
        | OS-EXT-SRV-ATTR:ramdisk_id           |                                                 |
        | OS-EXT-SRV-ATTR:reservation_id       | r-71rz1ia4                                      |
        | OS-EXT-SRV-ATTR:root_device_name     | -                                               |
        | OS-EXT-SRV-ATTR:user_data            | -                                               |
        | OS-EXT-STS:power_state               | 0                                               |
        | OS-EXT-STS:task_state                | scheduling                                      |
        | OS-EXT-STS:vm_state                  | building                                        |
        | OS-SRV-USG:launched_at               | -                                               |
        | OS-SRV-USG:terminated_at             | -                                               |
        | accessIPv4                           |                                                 |
        | accessIPv6                           |                                                 |
        | adminPass                            | N3bNYRBMprt9                                    |
        | config_drive                         |                                                 |
        | created                              | 2019-04-01T17:49:56Z                            |
        | description                          | -                                               |
        | flavor:disk                          | 10                                              |
        | flavor:ephemeral                     | 0                                               |
        | flavor:extra_specs                   | {}                                              |
        | flavor:original_name                 | rhel_flavor                                     |
        | flavor:ram                           | 1024                                            |
        | flavor:swap                          | 0                                               |
        | flavor:vcpus                         | 1                                               |
        | hostId                               |                                                 |
        | host_status                          |                                                 |
        | id                                   | ae60bb5e-c797-452a-8809-d43ee148e760            |
        | image                                | Attempt to boot from volume - no image supplied |
        | key_name                             | my_rsa-key                                      |
        | locked                               | False                                           |
        | metadata                             | {}                                              |
        | name                                 | testvm-vol-1                                    |
        | os-extended-volumes:volumes_attached | []                                              |
        | progress                             | 0                                               |
        | security_groups                      | 00aae3ce-6df4-4a8f-9ec5-505842308f4f            |
        | status                               | BUILD                                           |
        | tags                                 | []                                              |
        | tenant_id                            | b477ab2cb709468bbaf59dd9eea4fa84                |
        | trusted_image_certificates           | -                                               |
        | updated                              | 2019-04-01T17:49:56Z                            |
        | user_id                              | c4ef33d8325b4333bd21027d6594c9f9                |
        +--------------------------------------+-------------------------------------------------+


 2. Check created server and new volume

        (overcloud) [stack@undercloud-0 ~]$ openstack server list
        +--------------------------------------+--------------+--------+-------------------------------------------------+-------+-------------+
        | ID                                   | Name         | Status | Networks                                        | Image | Flavor      |
        +--------------------------------------+--------------+--------+-------------------------------------------------+-------+-------------+
        | ae60bb5e-c797-452a-8809-d43ee148e760 | testvm-vol-1 | ACTIVE | net_ipv64_1=10.0.1.9, 2001::f816:3eff:fecf:84dc |       | rhel_flavor |
        +--------------------------------------+--------------+--------+-------------------------------------------------+-------+-------------+
        (overcloud) [stack@undercloud-0 ~]$ openstack volume list
        +--------------------------------------+------+--------+------+---------------------------------------+
        | ID                                   | Name | Status | Size | Attached to                           |
        +--------------------------------------+------+--------+------+---------------------------------------+
        | d2d3da50-a20a-4678-9c40-31f2c6e3de87 |      | in-use |   10 | Attached to testvm-vol-1 on /dev/vda  |
        +--------------------------------------+------+--------+------+---------------------------------------+
        (overcloud) [stack@undercloud-0 ~]$

 - Create snapshot and verify the results (properties field of image points to the snapshot_id)

        (overcloud) [stack@undercloud-0 ~]$ openstack volume snapshot list

        (overcloud) [stack@undercloud-0 ~]$ nova image-create testvm-vol-1 testvm-vol-1-snap
        (overcloud) [stack@undercloud-0 ~]$ openstack volume snapshot list
        +--------------------------------------+--------------------------------+-------------+-----------+------+
        | ID                                   | Name                           | Description | Status    | Size |
        +--------------------------------------+--------------------------------+-------------+-----------+------+
        | 1c277112-c370-4770-9c24-94af7d259d4c | snapshot for testvm-vol-1-snap |             | available |   10 |
        +--------------------------------------+--------------------------------+-------------+-----------+------+
        (overcloud) [stack@undercloud-0 ~]$ openstack image list
        +--------------------------------------+-------------------+--------+
        | ID                                   | Name              | Status |
        +--------------------------------------+-------------------+--------+
        | 4eb35e58-f42c-4a23-8b89-9b008a9630b0 | rhel75            | active |
        | 1d51b8ca-d0fb-4551-8719-296bb0e26e25 | testvm-vol-1-snap | active |
        +--------------------------------------+-------------------+--------+
        (overcloud) [stack@undercloud-0 ~]$ openstack image show testvm-vol-1-snap | egrep 'disk_format|properties'
        | disk_format      | qcow2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
        | properties       | base_image_ref='', bdm_v2='True', block_device_mapping='[{"guest_format": null, "boot_index": 0, "delete_on_termination": false, "no_device": null, "snapshot_id": "1c277112-c370-4770-9c24-94af7d259d4c", "device_name": "/dev/vda", "disk_bus": "virtio", "image_id": null, "source_type": "snapshot", "tag": null, "device_type": "disk", "volume_id": null, "destination_type": "volume", "volume_size": 10}]', boot_roles='_member_,admin,reader,member', direct_url='swift+config://ref1/glance/1d51b8ca-d0fb-4551-8719-296bb0e26e25', os_hash_algo='sha512', os_hash_value='cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e', os_hidden='False', owner_project_name='admin', owner_user_name='admin', root_device_name='/dev/vda' |


 3. Remove snapshot and verify the image still exists

        (overcloud) [stack@undercloud-0 ~]$ openstack volume snapshot list
        +--------------------------------------+--------------------------------+-------------+-----------+------+
        | ID                                   | Name                           | Description | Status    | Size |
        +--------------------------------------+--------------------------------+-------------+-----------+------+
        | 1c277112-c370-4770-9c24-94af7d259d4c | snapshot for testvm-vol-1-snap |             | available |   10 |
        +--------------------------------------+--------------------------------+-------------+-----------+------+
        (overcloud) [stack@undercloud-0 ~]$ openstack volume snapshot delete 1c277112-c370-4770-9c24-94af7d259d4c
        (overcloud) [stack@undercloud-0 ~]$ openstack volume snapshot list

        (overcloud) [stack@undercloud-0 ~]$ openstack image list
        +--------------------------------------+-------------------+--------+
        | ID                                   | Name              | Status |
        +--------------------------------------+-------------------+--------+
        | 4eb35e58-f42c-4a23-8b89-9b008a9630b0 | rhel75            | active |
        | 1d51b8ca-d0fb-4551-8719-296bb0e26e25 | testvm-vol-1-snap | active |
        +--------------------------------------+-------------------+--------+
        (overcloud) [stack@undercloud-0 ~]$ 

Actual results:
Snapshot deletion is successful

Expected results:
Snapshot deletion fails because it is still being referenced by glance image.

Additional info:
N/A

Comment 6 Alan Bishop 2019-05-21 11:56:15 UTC
Brian's comment #5 indicates this is the expected behaviour.

Comment 7 Tzach Shefi 2019-05-26 11:11:33 UTC
NotABug nothing to test/automated per close loop.


Note You need to log in before you can comment on or make changes to this bug.