Add extractVMDriverVersion documentation

pull/4676/head
josedonizetti 2019-07-04 10:01:26 -03:00
parent d7a30e118f
commit 5f84ae3cd2
1 changed files with 5 additions and 0 deletions

View File

@ -891,6 +891,11 @@ func validateDriverVersion(vmDriver string) {
}
}
// extractVMDriverVersion extracts the driver version.
// KVM and Hyperkit drivers support the `version` command, that display the information as:
// version: vX.X.X
// commit: XXXX
// This method returns the version 'vX.X.X' or empty if the version isn't found.
func extractVMDriverVersion(s string) string {
versionRegex := regexp.MustCompile(`version:(.*)`)
matches := versionRegex.FindStringSubmatch(s)