[SRU][RBD] Retyping of in-use boot volumes renders instances unusable (possible data corruption)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
New
|
Critical
|
Eric Harney | ||
Wallaby |
New
|
Critical
|
Unassigned | ||
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Unassigned | ||
Ubuntu Cloud Archive |
Fix Released
|
Undecided
|
Unassigned | ||
Antelope |
Fix Released
|
Undecided
|
Unassigned | ||
Bobcat |
Fix Released
|
Undecided
|
Unassigned | ||
Caracal |
Fix Released
|
Undecided
|
Unassigned | ||
Yoga |
Fix Released
|
Undecided
|
Unassigned | ||
Zed |
Fix Released
|
Undecided
|
Unassigned | ||
cinder (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Jammy |
Fix Released
|
Undecided
|
Unassigned | ||
Lunar |
Won't Fix
|
Undecided
|
Unassigned | ||
Mantic |
Fix Released
|
Undecided
|
Unassigned | ||
Noble |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
See bug description for full details but short summary is that a patch landed in Wallaby release that introduced a regression whereby retyping an in-use volume leaves the attached volume in an inconsistent state with potential for data corruption. Result is that a vm does not receive updated connection_info from Cinder and will keep pointing to the old volume, even after reboot.
[Test Plan]
* Deploy Openstack with two Cinder RBD storage backends (different pools)
* Create two volume types
* Boot a vm from volume: openstack server create --wait --image jammy --flavor m1.small --key-name testkey --nic net-id=
* Retype the volume to type B: openstack volume set --type typeB --retype-policy on-demand <volume>
* Go to compute host running vm and check that the vm is now copying data to the new location e.g.
<disk type='network' device='disk'>
<driver name='qemu' type='raw' cache='none' discard='unmap'/>
<auth username=
<secret type='ceph' uuid='01b65a79-
</auth>
<source protocol='rbd' name='cinder-
<host name='10.5.2.236' port='6789'/>
</source>
<mirror type='network' job='copy'>
<format type='raw'/>
<source protocol='rbd' name='cinder-
<host name='10.5.2.236' port='6789'/>
<auth username=
<secret type='ceph' uuid='e089e27e-
</auth>
</source>
</mirror>
<target dev='vda' bus='virtio'/>
<
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
which will eventually settle and change to:
<disk type='network' device='disk'>
<driver name='qemu' type='raw' cache='none' discard='unmap'/>
<auth username=
<secret type='ceph' uuid='e089e27e-
</auth>
<source protocol='rbd' name='cinder-
<host name='10.5.2.236' port='6789'/>
</source>
<
<target dev='vda' bus='virtio'/>
<
<alias name='virtio-
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
* And lastly a reboot of the vm should be successfull.
[Regression Potential]
Given that the current state is potential data corruption and the patch will fix this by successfully refreshing connection info I do not see a regression potential. It is in fact fixing a regression.
-------
While trying out the volume retype feature in cinder, we noticed that after an instance is
rebooted it will not come back online and be stuck in an error state or if it comes back
online, its filesystem is corrupted.
## Observations
Say there are the two volume types `fast` (stored in ceph pool `volumes`) and `slow`
(stored in ceph pool `volumes.hdd`). Before the retyping we can see that the volume
for example is present in the `volumes.hdd` pool and has a watcher accessing the
volume.
```sh
[ceph: root@mon0 /]# rbd ls volumes.hdd
volume-
[ceph: root@mon0 /]# rbd status volumes.
Watchers:
```
Starting the retyping process using the migration policy `on-demand` for that volume either
via the horizon dashboard or the CLI causes the volume to be correctly transferred to the
`volumes` pool within the ceph cluster. However, the watcher does not get transferred, so
nobody is accessing the volume after it has been transferred.
```sh
[ceph: root@mon0 /]# rbd ls volumes
volume-
[ceph: root@mon0 /]# rbd status volumes/
Watchers: none
```
Taking a look at the libvirt XML of the instance in question, one can see that the `rbd`
volume path does not change after the retyping is completed. Therefore, if the instance is
restarted nova will not be able to find its volume preventing an instance start.
#### Pre retype
```xml
[...]
<source protocol='rbd' name='volumes.
<host name='2001:
<host name='2001:
<host name='2001:
</source>
[...]
```
#### Post retype (no change)
```xml
[...]
<source protocol='rbd' name='volumes.
<host name='2001:
<host name='2001:
<host name='2001:
</source>
[...]
```
### Possible cause
While looking through the code that is responsible for the volume retype we found a function
`swap_volume` volume which by our understanding should be responsible for fixing the association
above. As we understand cinder should use an internal API path to let nova perform this action.
This doesn't seem to happen.
(`_swap_volume`: https:/
## Further observations
If one tries to regenerate the libvirt XML by e.g. live migrating the instance and rebooting the
instance after, the filesystem gets corrupted.
## Environmental Information and possibly related reports
We are running the latest version of TripleO Wallaby using the hardened (whole disk)
overcloud image for the nodes.
Cinder Volume Version: `openstack-
### Possibly related
- https:/
(might want to paste the above to a markdown file for better readability)
CVE References
Changed in cinder: | |
importance: | Medium → Critical |
Changed in cinder: | |
assignee: | nobody → Eric Harney (eharney) |
summary: |
- [RBD] Retyping of in-use boot volumes renders instances unusable + [SRU][RBD] Retyping of in-use boot volumes renders instances unusable (possible data corruption) |
description: | updated |
Changed in cinder (Ubuntu Mantic): | |
status: | New → In Progress |
Changed in cinder (Ubuntu Lunar): | |
status: | New → Won't Fix |
Hello Alexander Käb,
To clarify:
- (double check) Are instances created from volumes, or are volumes attached to an instance? Can you share the command you are using to do this (steps).
- Is the data on the volumes encrypted?
- Have you encountered any errors in the cinder c-vol logs? Could you share the c-vol log?
Thanks!