hyperv: error if not admin

creating vsocks in windows requires admin privileges.  there could be
some workarounds made in the future,but the general deal has
always been, you need to be admin.  lets enforce this with an error
until those work-arounds can be implemented.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2024-03-25 10:43:48 -05:00
parent 2aad385b51
commit c62c74970f
3 changed files with 5 additions and 2 deletions

View File

@ -32,6 +32,9 @@ func Get() (vmconfigs.VMProvider, error) {
case define.WSLVirt:
return new(wsl.WSLStubber), nil
case define.HyperVVirt:
if !wsl.HasAdminRights() {
return nil, fmt.Errorf("hyperv machines require admin authority")
}
return new(hyperv.HyperVStubber), nil
default:
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())