Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
clh: Fix version check
Browse files Browse the repository at this point in the history
Add support for new version format from clh.

Fixes: #2489

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
  • Loading branch information
jcvenegas committed Feb 20, 2020
1 parent feac664 commit 2033229
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions virtcontainers/clh.go
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,9 @@ func (clh *cloudHypervisor) getAvailableVersion() error {

}

// Remove 'v' prefix if has one
clh.Logger().Error("DEBUG :", versionSplit[0])
versionSplit[0] = strings.TrimLeft(versionSplit[0], "v")
major, err := strconv.ParseUint(versionSplit[0], 10, 64)
if err != nil {
return err
Expand All @@ -685,10 +688,14 @@ func (clh *cloudHypervisor) getAvailableVersion() error {
return err

}
revision, err := strconv.ParseUint(versionSplit[2], 10, 64)

revisionStr := strings.SplitN(versionSplit[2], "-", -1)
if len(revisionStr) < 1 {
return errors.Errorf("Failed parse clh revision %s", versionSplit[2])
}
revision, err := strconv.ParseUint(revisionStr[0], 10, 64)
if err != nil {
return err

}

clh.version = CloudHypervisorVersion{
Expand Down

0 comments on commit 2033229

Please sign in to comment.