mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-09 03:48:05 +00:00
Merge pull request #2490 from jcvenegas/fix-2489
clh: Fix version check
This commit is contained in:
commit
18b21eb6ca
@ -59,7 +59,7 @@ const (
|
|||||||
virtioFsSocket = "virtiofsd.sock"
|
virtioFsSocket = "virtiofsd.sock"
|
||||||
clhSerial = "serial-tty.log"
|
clhSerial = "serial-tty.log"
|
||||||
supportedMajorVersion = 0
|
supportedMajorVersion = 0
|
||||||
supportedMinorVersion = 3
|
supportedMinorVersion = 5
|
||||||
defaultClhPath = "/usr/local/bin/cloud-hypervisor"
|
defaultClhPath = "/usr/local/bin/cloud-hypervisor"
|
||||||
virtioFsCacheAlways = "always"
|
virtioFsCacheAlways = "always"
|
||||||
maxClhVcpus = uint32(64)
|
maxClhVcpus = uint32(64)
|
||||||
@ -677,6 +677,8 @@ func (clh *cloudHypervisor) getAvailableVersion() error {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove 'v' prefix if has one
|
||||||
|
versionSplit[0] = strings.TrimLeft(versionSplit[0], "v")
|
||||||
major, err := strconv.ParseUint(versionSplit[0], 10, 64)
|
major, err := strconv.ParseUint(versionSplit[0], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -687,10 +689,15 @@ func (clh *cloudHypervisor) getAvailableVersion() error {
|
|||||||
return err
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
revision, err := strconv.ParseUint(versionSplit[2], 10, 64)
|
|
||||||
|
// revision could have aditional commit information separated by '-'
|
||||||
|
revisionSplit := strings.SplitN(versionSplit[2], "-", -1)
|
||||||
|
if len(revisionSplit) < 1 {
|
||||||
|
return errors.Errorf("Failed parse cloud-hypervisor revision %s", versionSplit[2])
|
||||||
|
}
|
||||||
|
revision, err := strconv.ParseUint(revisionSplit[0], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clh.version = CloudHypervisorVersion{
|
clh.version = CloudHypervisorVersion{
|
||||||
|
Loading…
Reference in New Issue
Block a user