From 9eca0250ae6f28a66eec9058c75258bb7407c9b4 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 10 Jan 2019 12:21:42 +0800 Subject: [PATCH] region: isolated_devices purge action --- pkg/compute/models/isolated_devices.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/compute/models/isolated_devices.go b/pkg/compute/models/isolated_devices.go index 53a0a047c1..91f81b74ec 100644 --- a/pkg/compute/models/isolated_devices.go +++ b/pkg/compute/models/isolated_devices.go @@ -530,6 +530,14 @@ func (self *SIsolatedDevice) RealDelete(ctx context.Context, userCred mcclient.T return self.ClearSchedDescCache() } +func (self *SIsolatedDevice) AllowPerformPurge(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) bool { + return db.IsAdminAllowPerform(userCred, self, "purge") +} + +func (self *SIsolatedDevice) PerformPurge(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) { + return nil, self.CustomizeDelete(ctx, userCred, query, data) +} + func (self *SIsolatedDevice) CustomizeDelete(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) error { if len(self.GuestId) > 0 { if !jsonutils.QueryBoolean(data, "purge", false) {