From 41fd940a44a3f0c33eca89a101597498971d2a50 Mon Sep 17 00:00:00 2001 From: ioito Date: Tue, 25 Jan 2022 14:45:53 +0800 Subject: [PATCH] fix(region): nutanix instance vcpu --- pkg/multicloud/nutanix/instance.go | 2 +- pkg/multicloud/nutanix/nutanix.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/multicloud/nutanix/instance.go b/pkg/multicloud/nutanix/instance.go index 43cf621220..ae44422fcd 100644 --- a/pkg/multicloud/nutanix/instance.go +++ b/pkg/multicloud/nutanix/instance.go @@ -334,7 +334,7 @@ func (self *SInstance) GetVNCInfo(input *cloudprovider.ServerVncInput) (*cloudpr } func (self *SInstance) GetVcpuCount() int { - return self.NumVcpus * self.NumVcpus + return self.NumCoresPerVcpu * self.NumVcpus } func (self *SInstance) GetVmemSizeMB() int { diff --git a/pkg/multicloud/nutanix/nutanix.go b/pkg/multicloud/nutanix/nutanix.go index 2c958f8b1e..6cdaf1d3a8 100644 --- a/pkg/multicloud/nutanix/nutanix.go +++ b/pkg/multicloud/nutanix/nutanix.go @@ -237,7 +237,7 @@ func (self *SNutanixClient) wait(taskId string) (string, error) { func (self *SNutanixClient) update(res, id string, body jsonutils.JSONObject, retVal interface{}) error { resp, err := self._update(res, id, body) if err != nil { - return errors.Wrapf(err, "update %s/%s", res, id) + return errors.Wrapf(err, "update %s/%s %v", res, id, body) } task := struct { TaskUUID string @@ -258,7 +258,7 @@ func (self *SNutanixClient) update(res, id string, body jsonutils.JSONObject, re func (self *SNutanixClient) post(res string, body jsonutils.JSONObject, retVal interface{}) error { resp, err := self._post(res, body) if err != nil { - return errors.Wrapf(err, "post %s", res) + return errors.Wrapf(err, "post %s %v", res, body) } if retVal != nil { if resp.Contains("entities") { @@ -355,7 +355,7 @@ func (self *sNutanixError) ParseErrorFromJsonResponse(statusCode int, body jsonu func _jsonRequest(cli *http.Client, method httputils.THttpMethod, url string, header http.Header, body jsonutils.JSONObject, debug bool) (jsonutils.JSONObject, error) { client := httputils.NewJsonClient(cli) - req := httputils.NewJsonRequest(method, url, nil) + req := httputils.NewJsonRequest(method, url, body) ne := &sNutanixError{} _, resp, err := client.Send(context.Background(), req, ne, debug) return resp, err