Skip to content

Commit

Permalink
fix(region): check disk is deleted on delete snapshot (#21372)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanyaoqi authored Oct 9, 2024
1 parent 900e7da commit c9a74da
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pkg/compute/storagedrivers/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,16 @@ func (self *SBaseStorageDriver) RequestDeleteSnapshot(ctx context.Context, snaps
if err != nil && err != sql.ErrNoRows {
return errors.Wrap(err, "get disk by snapshot")
}
sDisk, _ := disk.(*models.SDisk)
if sDisk.IsEncrypted() {
if encryptInfo, err := sDisk.GetEncryptInfo(ctx, task.GetUserCred()); err != nil {
return errors.Wrap(err, "faild get encryptInfo")
} else {
params.Set("encrypt_info", jsonutils.Marshal(encryptInfo))
if disk != nil {
sDisk, _ := disk.(*models.SDisk)
if sDisk.IsEncrypted() {
if encryptInfo, err := sDisk.GetEncryptInfo(ctx, task.GetUserCred()); err != nil {
return errors.Wrap(err, "faild get encryptInfo")
} else {
params.Set("encrypt_info", jsonutils.Marshal(encryptInfo))
}
}
}

if !snapshot.OutOfChain {
if convertSnapshot != nil {
params.Set("convert_snapshot", jsonutils.NewString(convertSnapshot.Id))
Expand Down

0 comments on commit c9a74da

Please sign in to comment.