fix get vnc port error

This commit is contained in:
wanyaoqi
2018-11-07 10:55:51 +08:00
parent 89cfced307
commit fb18edce1b
+10 -18
View File
@@ -110,29 +110,21 @@ func (self *SKVMGuestDriver) GetGuestVncInfo(userCred mcclient.TokenCredential,
err = fmt.Errorf("Can't get vnc information from host.")
return nil, err
}
/***
Server:
address: 0.0.0.0:5901
auth: none
Client: none
***/
// info_vnc = result['results'].split('\n')
// port = int(info_vnc[1].split(':')[-1].split()[0])
/*
QEMU 2.12.1 monitor - type 'help' for more information
(qemu) info vnc
info vnc
default:
Server: :::5902 (ipv6)
Auth: none (Sub: none)
Server: 0.0.0.0:5902 (ipv4)
Auth: none (Sub: none)
/* QEMU 2.9.1
info spice QEMU 2.12.1 monitor Server:
Server: (qemu) info vnc address: 0.0.0.0:5901
address: *:5921 info vnc auth: none
migrated: false default: Client: none
auth: spice Server: :::5902 (ipv6)
compiled: 0.13.3 Auth: none (Sub: none)
mouse-mode: server Server: 0.0.0.0:5902 (ipv4)
Channels: none Auth: none (Sub: none)
*/
var port int
if guest.CheckQemuVersion(guest.GetMetadata("__qemu_version", userCred), "2.12.1") {
if guest.CheckQemuVersion(guest.GetMetadata("__qemu_version", userCred), "2.12.1") && strings.HasSuffix(cmd, "vnc") {
port = findVNCPort2(results)
} else {
port = findVNCPort(results)