BOINC / boinc

Open-source software for volunteer computing and grid computing.
https://boinc.berkeley.edu
GNU Lesser General Public License v3.0
2.03k stars 449 forks source link

Use Hyper-V on Windows? #1974

Closed davidpanderson closed 6 years ago

davidpanderson commented 7 years ago

Is it possible to use Hyper-V instead of Virtualbox on Windows? The advantage is that in some cases it's pre-installed. References:

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v

https://www.groovypost.com/howto/migrate-virtual-box-vms-windows-10-hyper-v/

https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/nested-virtualization

https://superuser.com/questions/1144405/enable-virtualization-for-windows-10-pro-running-inside-virtualbox

ChristianBeer commented 7 years ago

One would need to write a tool like vboxwrapper that is able to manage Hyper-V VMs. It seems Microsoft provides a PowerShell API to interact with existing VMs. I couldn't find documentation on how to automatically create and start a VM via Powershell (but didn't look very close).

Seems like a nice research project for someone new with BOINC.

adamradocz commented 7 years ago

Hyper-V PoweShell commands

Start a VM Syntax: SyStart-VM [-Name] <String[]> [-AsJob] [-ComputerName <String[]> ] [-Passthru] [ ] Example: Start-VM –Name TestVM -AsJob

Create a VM Syntax: New-VM [[-Name] ] [[-MemoryStartupBytes] ] [[-Generation] ] -NewVHDPath -NewVHDSizeBytes [-AsJob] [-BootDevice {CD | Floppy | LegacyNetworkAdapter | IDE | NetworkAdapter | VHD} ] [-ComputerName <String[]> ] [-Path ] [-SwitchName ] [-Confirm] [-WhatIf] [ ] Example: New-VM –Name "TestVM" –MemoryStartupBytes 1GB -Generation 2 –NewVHDPath d:\vhd\base.vhdx

Enable Hyper-V Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

adamradocz commented 7 years ago

If you give the specifications maybe I can help to develop the wrapper. The issue is I can develop only in C#.

AenBleidd commented 7 years ago

Hello Adam,

It is for Windows only so as from my POV C# is OK in this case.

Best regards, Vitalii Koshura

2017-07-26 14:27 GMT+03:00 Adam Radocz notifications@github.com:

If you give the specifications maybe I can help to develop the wrapper. The issue is I can develop only in C#.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/BOINC/boinc/issues/1974#issuecomment-318026189, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFZoUdNoOcKDUg0DH5rF4FohXgMGzQFks5sRyKfgaJpZM4OXp9J .

JuhaSointusalo commented 7 years ago

vboxwrapper looks like it could be extended to other hypervisors relatively easily. I would start by investigating if it really could be done.

vboxwrapper is not entirely low level code interacting with VBox, there is some higher level code too. The benefit of a single vmwrapper is that all of its features would be automatically implemented for all supported hypervisors. New features would have to be written, tested and bug-fixed only once. And I imagine projects would appreciate having to maintain only one application/vm image.

Ferroin commented 7 years ago

Maintaining multiple images may be unavoidable, as virtual hard disks don't have one standardized format that is supported by everything. Hyper-V in particular only has very limited support for various virtual hard disk formats. At minimum, you'll need to bundle some disk image format conversion code (or just bundle a pre-compiled version of the qemu-img command and call that), or the VM based applications will need a revision to update to a format that both Hyper-V and VBox support.

marius311 commented 7 years ago

That's a good point for VM apps that are distributed as a pre-made virtual harddisk. But it doesn't apply if the VM app is just a bootable ISO + input files, which is how boinc2docker works. There, you could really imagine totally transparently having your VM app run on either VBox or Hyper-V, and I think that feature would be awesome!

adamradocz commented 7 years ago

I agree that one VMwrapper should manage all the VMs..

JuhaSointusalo commented 7 years ago

A common image format would be a problem if BOINC were to widely support different hypervisors. According to Wikipedia https://en.wikipedia.org/wiki/Comparison_of_platform_virtualization_software, VHD is supported by Hyper-V, VirtualBox and Xen. VMDK is supported by KVM, VirtualBox and VMWare.

Ferroin commented 7 years ago

Yeah, VHD and VMDK are the two most widely supported, but they have their own issues. I think pushing more towards an approach like boinc2docker like @marius311 mentioned would be better in terms of scalability (and would have the advantage that adding support for other hypervisors should be pretty trivial, it's really easy to boot an ISO on almost any hypervisor).

lfield commented 6 years ago

We have looked into this and found that Hyper V is just a different can of worms. For example it requires different BIOS options to be set.

AenBleidd commented 6 years ago

BTW, this is for Windows only. Using VM mean moving away from platform dependent solutions but I see no reason to invest time both from BOINC side and from Projects side to create and support another one type of VM. Also, as I know, there is no possibility to run both Hyper-V and VirtualBox simultaneously: https://www.virtualbox.org/ticket/16801 So this could be a potential problem to the users who want to run several projects with different types of VMs available because this leads to BSOD.

lfield commented 6 years ago

So as a community we would need to decide to use Hyper-V. I would not be against it if it offered a seamless approach but for now I think it is a case of better the devil you know.

AenBleidd commented 6 years ago

I am also not against it. I just described the possible issues that will appear later and can confuse users.

Ferroin commented 6 years ago

@lfield I don't think the BIOS requirements are likely to be an issue. The 'Hardware Enforced Data Execution Prevention' thing is NX bit support, which all modern x86 systems unconditionally have enabled, and notably it's pretty much always enabled by the firmware on CPU's that meet the hardware requirements (SLAT and VMM/VT-c). The 'Virtualization Technology' thing is AFAIK required for VirtualBox too (at least, it's required if you want good performance), so even though it's generally disabled by default (to mitigate the possibility of a Ring -1 exploit being installed), it's also needed for the current arrangement.

I'd be more worried about the fact that it can't be run on Windows 10 Home Edition, which a majority of regular users are likely to have. Most people aren't likely to be willing to upgrade to Pro (even though they should do so for other reasons) just to run BOINC applications unless they have a very strong interest in the particular project.

lfield commented 6 years ago

I forgot what BIOS setting we found we needed to active but any such requirement is too high for many volunteers. The fact that Hyper-V cannot run on Windows 10 Home Edition is a blocker and I would suggest we close this ticket.

TheAspens commented 6 years ago

@davidpanderson - are you ok with closing this ticket? If so can you close it? It seems like the idea of using a native VM technology is desirable, but given the Windows 10 Home issue and means we would have to support VirtualBox anyway, so might as well stick with VirtualBox vs supporting two virtual machines technologies on windows.