From 46c555cbe990cae37345aff66845d8d9341a0de9 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Thu, 28 Jul 2022 14:44:52 +0800 Subject: [PATCH] fix(region): baremetal host ping forbidden --- pkg/compute/models/hosts.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index 4d41e39bd2..d284d7291d 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -4038,6 +4038,9 @@ func (self *SHost) StartSyncAllGuestsStatusTask(ctx context.Context, userCred mc } func (self *SHost) PerformPing(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, input api.SHostPingInput) (jsonutils.JSONObject, error) { + if self.HostType == api.HOST_TYPE_BAREMETAL { + return nil, httperrors.NewNotSupportedError("ping host type %s not support", self.HostType) + } if input.WithData { // piggyback storage stats info log.Debugf("host ping %s", jsonutils.Marshal(input))