From e5d801657bf865a1b367dc4442fd7ac1501855d1 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 3 Mar 2022 15:05:13 +0800 Subject: [PATCH] fix(region): instance snapshot reset should match self guest --- pkg/compute/models/guest_actions.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/compute/models/guest_actions.go b/pkg/compute/models/guest_actions.go index aafdbc2efe..340d49288b 100644 --- a/pkg/compute/models/guest_actions.go +++ b/pkg/compute/models/guest_actions.go @@ -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") }