fix(region): aliyun vnc addr (#23883)

This commit is contained in:
屈轩
2025-12-03 14:04:11 +08:00
committed by GitHub
parent 6af0bd4b03
commit f48a23cbfa
6 changed files with 11 additions and 19 deletions

2
go.mod
View File

@@ -98,7 +98,7 @@ require (
k8s.io/cri-api v0.28.15
k8s.io/klog/v2 v2.20.0
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251130090640-988b91734be4
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251202110347-66e60ae88e4f
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0
yunion.io/x/jsonutils v1.0.1-0.20250507052344-1abcf4f443b1
yunion.io/x/log v1.0.1-0.20240305175729-7cf2d6cd5a91

4
go.sum
View File

@@ -1661,8 +1661,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251130090640-988b91734be4 h1:FsVs00YbXgtIAkG5vKlsuv3SJXFLQpyqRvRlaY4sc4I=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251130090640-988b91734be4/go.mod h1:aWRX5Phwz3nbHUNnIAm1oVogjguXPYDDgCOy/9Hnnvk=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251202110347-66e60ae88e4f h1:XbF3dPkwrLs9ndX8QP23EGFljbnkII76UjPDKeIJvhA=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251202110347-66e60ae88e4f/go.mod h1:aWRX5Phwz3nbHUNnIAm1oVogjguXPYDDgCOy/9Hnnvk=
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0 h1:msG4SiDSVU7CrXH06WuHlNEZXIooTcmNbfrIGHuIHBU=
yunion.io/x/executor v0.0.0-20250518005516-5402e9e0bed0/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=

View File

@@ -30,7 +30,7 @@ type WebConsoleOptions struct {
IpmitoolPath string `help:"ipmitool binary path used to connect baremetal sol" default:"/usr/bin/ipmitool"`
EnableAutoLogin bool `help:"allow webconsole to log in directly with the cloudroot public key" default:"false"`
ApsaraConsoleAddr string `help:"Apsara console addr" default:"https://xxxx.com.cn/module/ecs/vnc/index.html"`
AliyunConsoleAddr string `help:"Aliyun vnc addr" default:"https://ecs.console.aliyun.com/vnc/index.htm"`
AliyunConsoleAddr string `help:"Aliyun vnc addr" default:"https://g.alicdn.com/aliyun/ecs-console-vnc2/0.0.8/index.html"`
SshSessionTimeoutMinutes int `help:"ssh timeout session" default:"-1"`
RdpSessionTimeoutMinutes int `help:"rdp timeout session" default:"-1"`

View File

@@ -19,6 +19,7 @@ import (
"fmt"
"net/url"
"os/exec"
"strings"
"yunion.io/x/cloudmux/pkg/cloudprovider"
"yunion.io/x/jsonutils"
@@ -172,16 +173,14 @@ func (info *RemoteConsoleInfo) getQcloudURL() (string, error) {
func (info *RemoteConsoleInfo) getAliyunURL() (string, error) {
isWindows := "false"
if info.OsName == "Windows" {
if strings.EqualFold(info.OsName, "windows") {
isWindows = "true"
}
params := url.Values{
"vncUrl": {info.Url},
"instanceId": {info.InstanceId},
"isWindows": {isWindows},
"password": {info.Password},
vncUrl, err := url.QueryUnescape(info.Url)
if err != nil {
return "", errors.Wrap(err, "url.QueryUnescape")
}
return info.getConnParamsURL(options.Options.AliyunConsoleAddr, params), nil
return fmt.Sprintf("%s?vncUrl=%s&instanceId=%s&isWindows=%s", options.Options.AliyunConsoleAddr, vncUrl, info.InstanceId, isWindows), nil
}
func (info *RemoteConsoleInfo) getCloudpodsURL() (string, error) {

2
vendor/modules.txt vendored
View File

@@ -2243,7 +2243,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251130090640-988b91734be4
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20251202110347-66e60ae88e4f
## explicit; go 1.24
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing

View File

@@ -29,7 +29,6 @@ import (
"yunion.io/x/pkg/util/billing"
"yunion.io/x/pkg/util/imagetools"
"yunion.io/x/pkg/util/osprofile"
"yunion.io/x/pkg/util/seclib"
"yunion.io/x/pkg/utils"
billing_api "yunion.io/x/cloudmux/pkg/apis/billing"
@@ -444,14 +443,8 @@ func (self *SInstance) GetVNCInfo(input *cloudprovider.ServerVncInput) (*cloudpr
if err != nil {
return nil, err
}
passwd := seclib.RandomPassword(6)
err = self.host.zone.region.ModifyInstanceVNCUrlPassword(self.InstanceId, passwd)
if err != nil {
return nil, err
}
ret := &cloudprovider.ServerVncOutput{
Url: url,
Password: passwd,
Protocol: "aliyun",
InstanceId: self.InstanceId,
Hypervisor: api.HYPERVISOR_ALIYUN,