mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-01 07:47:15 +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"
|
||||
clhSerial = "serial-tty.log"
|
||||
supportedMajorVersion = 0
|
||||
supportedMinorVersion = 3
|
||||
supportedMinorVersion = 5
|
||||
defaultClhPath = "/usr/local/bin/cloud-hypervisor"
|
||||
virtioFsCacheAlways = "always"
|
||||
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)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -687,10 +689,15 @@ func (clh *cloudHypervisor) getAvailableVersion() error {
|
||||
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 {
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
clh.version = CloudHypervisorVersion{
|
||||
|
Loading…
Reference in New Issue
Block a user