mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #322 in YUNIONIO/onecloud from ~LIZEXI/onecloud:release/2.1.0 to release/2.1.0
* commit '0c46305d8e37758e687bc4fa01145138b1ac14af': fix: kvm find vnc port index out of range
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"yunion.io/x/jsonutils"
|
||||
"yunion.io/x/log"
|
||||
@@ -48,10 +48,9 @@ func (self *SKVMGuestDriver) DoGuestCreateDisksTask(ctx context.Context, guest *
|
||||
}
|
||||
|
||||
func findVNCPort(results string) int {
|
||||
reg := regexp.MustCompile(`(\d+\.\d+\.\d+\.\d+):([\d]+)`)
|
||||
finds := reg.FindStringSubmatch(results)
|
||||
log.Debugf("finds=%s", finds)
|
||||
port, _ := strconv.Atoi(finds[2])
|
||||
vncInfo := strings.Split(results, "\n")
|
||||
addrParts := strings.Split(vncInfo[1], ":")
|
||||
port, _ := strconv.Atoi(addrParts[len(addrParts)-1])
|
||||
return port
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user