diff --git a/pkg/cloudprovider/resources.go b/pkg/cloudprovider/resources.go index a0cf5cd3ca..208e31a1cc 100644 --- a/pkg/cloudprovider/resources.go +++ b/pkg/cloudprovider/resources.go @@ -320,6 +320,11 @@ type ICloudVM interface { GetError() error SetMetadata(tags map[string]string, replace bool) error + + CreateInstanceSnapshot(ctx context.Context, name string, desc string) (ICloudInstanceSnapshot, error) + GetInstanceSnapshot(idStr string) (ICloudInstanceSnapshot, error) + GetInstanceSnapshots() ([]ICloudInstanceSnapshot, error) + ResetToInstanceSnapshot(ctx context.Context, idStr string) error } type ICloudNic interface { @@ -431,6 +436,13 @@ type ICloudSnapshot interface { Delete() error } +type ICloudInstanceSnapshot interface { + IVirtualResource + + GetDescription() string + Delete() error +} + type ICloudSnapshotPolicy interface { IVirtualResource diff --git a/pkg/multicloud/instance_base.go b/pkg/multicloud/instance_base.go index 391f3da666..1eb06a6c4f 100644 --- a/pkg/multicloud/instance_base.go +++ b/pkg/multicloud/instance_base.go @@ -14,7 +14,11 @@ package multicloud -import "yunion.io/x/onecloud/pkg/cloudprovider" +import ( + "context" + + "yunion.io/x/onecloud/pkg/cloudprovider" +) type SInstanceBase struct { SResourceBase @@ -44,3 +48,19 @@ func (instance *SInstanceBase) LiveMigrateVM(hostId string) error { func (instance *SInstanceBase) SetMetadata(tags map[string]string, replace bool) error { return cloudprovider.ErrNotImplemented } + +func (instance *SInstanceBase) GetInstanceSnapshot(idStr string) (cloudprovider.ICloudInstanceSnapshot, error) { + return nil, cloudprovider.ErrNotImplemented +} + +func (instance *SInstanceBase) GetInstanceSnapshots() ([]cloudprovider.ICloudInstanceSnapshot, error) { + return nil, cloudprovider.ErrNotImplemented +} + +func (instance *SInstanceBase) CreateInstanceSnapshot(ctx context.Context, name string, desc string) (cloudprovider.ICloudInstanceSnapshot, error) { + return nil, cloudprovider.ErrNotImplemented +} + +func (instance *SInstanceBase) ResetToInstanceSnapshot(ctx context.Context, idStr string) error { + return cloudprovider.ErrNotImplemented +}