diff --git a/pkg/multicloud/zstack/host.go b/pkg/multicloud/zstack/host.go index 21f47ef558..b5ba3201e9 100644 --- a/pkg/multicloud/zstack/host.go +++ b/pkg/multicloud/zstack/host.go @@ -169,7 +169,10 @@ func (host *SHost) Refresh() error { } func (host *SHost) GetHostStatus() string { - return api.HOST_ONLINE + if host.Status == "Connected" { + return api.HOST_ONLINE + } + return api.HOST_OFFLINE } func (host *SHost) GetEnabled() bool { diff --git a/pkg/multicloud/zstack/storagecache.go b/pkg/multicloud/zstack/storagecache.go index 8393007aae..bf0c656821 100644 --- a/pkg/multicloud/zstack/storagecache.go +++ b/pkg/multicloud/zstack/storagecache.go @@ -130,7 +130,7 @@ func (self *SStoragecache) uploadImage(ctx context.Context, userCred mcclient.To return "", err } img.storageCache = self - err = cloudprovider.WaitStatus(img, api.CACHED_IMAGE_STATUS_READY, time.Second*5, time.Minute*10) //windows镜像转换比较慢,等待时间稍微设长一些 + err = cloudprovider.WaitStatus(img, api.CACHED_IMAGE_STATUS_READY, time.Second*5, time.Minute*20) //windows镜像转换比较慢,等待时间稍微设长一些 if err != nil { log.Errorf("waitting for image %s(%s) status ready timeout", img.Name, img.UUID) } diff --git a/pkg/multicloud/zstack/zstack.go b/pkg/multicloud/zstack/zstack.go index dea2f90dad..7f5e72a6e9 100644 --- a/pkg/multicloud/zstack/zstack.go +++ b/pkg/multicloud/zstack/zstack.go @@ -142,7 +142,7 @@ func (cli *SZStackClient) connect() error { "password": fmt.Sprintf("%x", sha512.Sum512([]byte(cli.password))), }, }) - _, resp, err := httputils.JSONRequest(client, context.Background(), "PUT", authURL, header, body, cli.debug) + _, _, err := httputils.JSONRequest(client, context.Background(), "PUT", authURL, header, body, cli.debug) if err != nil { err = cli.testAccessKey() if err == nil { @@ -150,8 +150,7 @@ func (cli *SZStackClient) connect() error { } return errors.Wrapf(err, "connect") } - cli.sessionID, err = resp.GetString("inventory", "uuid") - return err + return fmt.Errorf("password auth has been deprecated, please using ak sk auth") } func (cli *SZStackClient) listAll(resource string, params []string, retVal interface{}) error {