mirror of https://github.com/containers/podman.git
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:
parent
2aad385b51
commit
c62c74970f
|
@ -32,6 +32,9 @@ func Get() (vmconfigs.VMProvider, error) {
|
||||||
case define.WSLVirt:
|
case define.WSLVirt:
|
||||||
return new(wsl.WSLStubber), nil
|
return new(wsl.WSLStubber), nil
|
||||||
case define.HyperVVirt:
|
case define.HyperVVirt:
|
||||||
|
if !wsl.HasAdminRights() {
|
||||||
|
return nil, fmt.Errorf("hyperv machines require admin authority")
|
||||||
|
}
|
||||||
return new(hyperv.HyperVStubber), nil
|
return new(hyperv.HyperVStubber), nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
return nil, fmt.Errorf("unsupported virtualization provider: `%s`", resolvedVMType.String())
|
||||||
|
|
|
@ -308,7 +308,7 @@ func checkAndInstallWSL(reExec bool) (bool, error) {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
admin := hasAdminRights()
|
admin := HasAdminRights()
|
||||||
|
|
||||||
if !IsWSLFeatureEnabled() {
|
if !IsWSLFeatureEnabled() {
|
||||||
return false, attemptFeatureInstall(reExec, admin)
|
return false, attemptFeatureInstall(reExec, admin)
|
||||||
|
|
|
@ -96,7 +96,7 @@ func winVersionAtLeast(major uint, minor uint, build uint) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasAdminRights() bool {
|
func HasAdminRights() bool {
|
||||||
var sid *windows.SID
|
var sid *windows.SID
|
||||||
|
|
||||||
// See: https://coolaj86.com/articles/golang-and-windows-and-admins-oh-my/
|
// See: https://coolaj86.com/articles/golang-and-windows-and-admins-oh-my/
|
||||||
|
|
Loading…
Reference in New Issue