From 8da40d66eebd294e7b5defc6dcc0c0fff943f736 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Fri, 1 Apr 2022 13:19:03 +0800 Subject: [PATCH] fix: fail to snapshot and clone due to mismatch class metadata (#13856) Co-authored-by: Qiu Jian --- pkg/compute/models/instance_snapshots.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/instance_snapshots.go b/pkg/compute/models/instance_snapshots.go index c5105c9ae9..c7d0144d37 100644 --- a/pkg/compute/models/instance_snapshots.go +++ b/pkg/compute/models/instance_snapshots.go @@ -391,7 +391,11 @@ func (manager *SInstanceSnapshotManager) CreateInstanceSnapshot(ctx context.Cont instanceSnapshot.MemoryFileHostId = guest.HostId err := manager.TableSpec().Insert(ctx, instanceSnapshot) if err != nil { - return nil, err + return nil, errors.Wrap(err, "Insert") + } + err = db.Inherit(ctx, guest, instanceSnapshot) + if err != nil { + return nil, errors.Wrap(err, "Inherit ClassMetadata") } return instanceSnapshot, nil }