vmtypes names cannot be used as machine names

florent found a bug where he used "applehv" as a machine name.  it turns out when we use a vmtype name, esp. the active type, it really messes up directory structures for configuration and images alike.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2023-11-17 11:36:34 -06:00
parent 71aac2f430
commit d32f61d91b
3 changed files with 14 additions and 1 deletions

View File

@ -346,6 +346,7 @@ const (
WSLVirt
AppleHvVirt
HyperVVirt
UnknownVirt
)
func (v VMType) String() string {
@ -383,7 +384,7 @@ func ParseVMType(input string, emptyFallback VMType) (VMType, error) {
case "":
return emptyFallback, nil
default:
return QemuVirt, fmt.Errorf("unknown VMType `%s`", input)
return UnknownVirt, fmt.Errorf("unknown VMType `%s`", input)
}
}