When the backup cannot find an available service, update the volume status to none

Bug #1926412 reported by ZhaoYixin
26
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Medium
ZhaoYixin

Bug Description

When backing up by snapshot, the status of the volume will not change, so previous_status is none.
```
previous_status = volume['status']
......
if snapshot_id:
 snapshot = objects.Snapshot.get_by_id(context, snapshot_id)
 data_timestamp = snapshot.created_at
 self.db.snapshot_update(
  context, snapshot_id,
  {'status': fields.SnapshotStatus.BACKING_UP})
else:
 self.db.volume_update(context, volume_id,
         {'status': 'backing-up',
          'previous_status': previous_status})
```
However, when the scheduler found that there was no service available, it did not judge whether it was backed up by snapshot, and directly updated the status of the volume to previous_status, causing the status of the volume to become none.
```
def create_backup(self, context, backup):
 volume_id = backup.volume_id
 volume = self.db.volume_get(context, volume_id)
 try:
  host = self.driver.get_backup_host(volume)
  backup.host = host
  backup.save()
  self.backup_api.create_backup(context, backup)
 except exception.ServiceNotFound:
  self.db.volume_update(context, volume_id,
         {'status': volume['previous_status'],
          'previous_status': volume['status']})
  msg = "Service not found for creating backup."
  LOG.error(msg)
  vol_utils.update_backup_error(backup, msg)
```
The process:
1.create a snapshot
2.no available backup services
3.create backup by snapshot

1.cinder snapshot-create 1a5cdc41-372b-483f-a139-75275701d9ce --name bm8h34
2.cinder service-list
+------------------+-------------+------+----------+-------+----------------------------+---------+-----------------+---------------+
| Binary | Host | Zone | Status | State | Updated_at | Cluster | Disabled Reason | Backend State |
+------------------+-------------+------+----------+-------+----------------------------+---------+-----------------+---------------+
| cinder-backup | stor01 | nova | enabled | down | 2021-04-28T08:16:01.000000 | - | - | |
| cinder-scheduler | ctl01 | nova | enabled | up | 2021-04-28T08:15:57.000000 | - | - | |
| cinder-volume | stor01@ceph | nova | enabled | up | 2021-04-28T08:15:58.000000 | - | - | up |
+------------------+-------------+------+----------+-------+----------------------------+---------+-----------------+---------------+
3.cinder backup-create 1a5cdc41-372b-483f-a139-75275701d9ce --snapshot-id d0c07f8d-5978-4c9b-aeb3-b63aa1a947f8 --name 3gh8g34
4.cinder show 1a5cdc41-372b-483f-a139-75275701d9ce
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | None |
| updated_at | 2021-04-28T08:17:40.000000 |

ZhaoYixin (zhaoyixin)
Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/797380

Changed in cinder:
importance: Undecided → Medium
assignee: nobody → ZhaoYixin (zhaoyixin)
summary: - When the backup cannot find a available service, update the volume
+ When the backup cannot find an available service, update the volume
status to none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/880275

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

Other bug subscribers

Remote bug watches

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