mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-06-02 05:52:00 +08:00
fix: add password info to server vnc info (#14861)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -303,29 +303,29 @@ type ServerVncInput struct {
|
||||
|
||||
// +onecloud:model-api-gen
|
||||
type ServerVncOutput struct {
|
||||
Id string
|
||||
Id string `json:"id"`
|
||||
|
||||
// baremetal
|
||||
HostId string
|
||||
Zone string
|
||||
HostId string `json:"host_id"`
|
||||
Zone string `json:"zone"`
|
||||
|
||||
// kvm host ip
|
||||
Host string
|
||||
Protocol string
|
||||
Port int64
|
||||
Host string `json:"host"`
|
||||
Protocol string `json:"protocol"`
|
||||
Port int64 `json:"port"`
|
||||
|
||||
Url string
|
||||
InstanceId string
|
||||
InstanceName string
|
||||
Password string
|
||||
VncPassword string
|
||||
Url string `json:"url"`
|
||||
InstanceId string `json:"instance_id"`
|
||||
InstanceName string `json:"instance_name"`
|
||||
Password string `json:"password"`
|
||||
VncPassword string `json:"vnc_password"`
|
||||
|
||||
OsName string
|
||||
OsName string `json:"os_name"`
|
||||
|
||||
// cloudpods
|
||||
ApiServer string
|
||||
ConnectParams string
|
||||
Session string
|
||||
ApiServer string `json:"api_server"`
|
||||
ConnectParams string `json:"connect_params"`
|
||||
Session string `json:"session"`
|
||||
|
||||
Hypervisor string
|
||||
Hypervisor string `json:"hypervisor"`
|
||||
}
|
||||
|
||||
@@ -204,11 +204,14 @@ func (self *SKVMGuestDriver) GetGuestVncInfo(ctx context.Context, userCred mccli
|
||||
port = findVNCPort(results)
|
||||
}
|
||||
|
||||
password := guest.GetMetadata(ctx, "__vnc_password", userCred)
|
||||
|
||||
result := &cloudprovider.ServerVncOutput{
|
||||
Host: host.AccessIp,
|
||||
Protocol: guest.GetVdi(),
|
||||
Port: int64(port),
|
||||
Hypervisor: api.HYPERVISOR_KVM,
|
||||
Password: password,
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ import (
|
||||
|
||||
func (self *SGuest) GetDetailsVnc(ctx context.Context, userCred mcclient.TokenCredential, input *cloudprovider.ServerVncInput) (*cloudprovider.ServerVncOutput, error) {
|
||||
ret := &cloudprovider.ServerVncOutput{}
|
||||
if utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM}) {
|
||||
if utils.IsInStringArray(self.Status, []string{api.VM_RUNNING, api.VM_BLOCK_STREAM, api.VM_MIGRATING}) {
|
||||
host, err := self.GetHost()
|
||||
if err != nil {
|
||||
return nil, httperrors.NewInternalServerError(errors.Wrapf(err, "GetHost").Error())
|
||||
|
||||
Reference in New Issue
Block a user