Merge pull request #13581 from zexi/instance-snapshot-reset-validate

fix(region): instance snapshot reset should match self guest
This commit is contained in:
Zexi Li
2022-03-03 16:18:40 +08:00
committed by GitHub
+4
View File
@@ -4790,6 +4790,10 @@ func (self *SGuest) PerformInstanceSnapshotReset(ctx context.Context, userCred m
instanceSnapshot := obj.(*SInstanceSnapshot)
if instanceSnapshot.GuestId != self.GetId() {
return nil, httperrors.NewBadRequestError("instance snapshot %q not belong server %q", instanceSnapshot.GetName(), self.GetId())
}
if instanceSnapshot.Status != api.INSTANCE_SNAPSHOT_READY {
return nil, httperrors.NewBadRequestError("Instance sanpshot not ready")
}