Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyper-V support #1244

Closed
Iristyle opened this issue Dec 4, 2012 · 77 comments
Closed

Hyper-V support #1244

Iristyle opened this issue Dec 4, 2012 · 77 comments

Comments

@Iristyle
Copy link

Iristyle commented Dec 4, 2012

I see an issue for VMWare here.. but I don't see any mention of Hyper-V.

I see the list mentioned in the blog post here as well... but also no Hyper-V.

Hyper-V support would be great to see on the roadmap.

@awildeep
Copy link

+1 on the hyper-v support.

3 similar comments
@Elufimov
Copy link

+1 on the hyper-v support.

@marianposaceanu
Copy link

+1 on the hyper-v support.

@Atchuu
Copy link

Atchuu commented Feb 25, 2013

+1 on the hyper-v support.

@blackjid
Copy link

+1 on a hyper-v provider!

@kevinkbush
Copy link

+1

@marianposaceanu
Copy link

Is this even feasible ? I mean does it have any clear benefits compared to VirtualBox ? Performance wise I reckon it should be more or less the same as most of us just use it to clone production environments that don't use any graphical env. and if you have your VHD on a SSD the IO bottleneck goes away; CPU wise even a 20-30% delta can go under the radar when you use an i5 or i7 cpu.

@Iristyle
Copy link
Author

Well, let's put it this way... A few members of my team were working off of a Hyper-V VM, but I decided to move us all over to a custom VeeWee-built VritualBox basebox, plus a Vagrant package with Puppet customizations for things we care to version bump across the team (Riak, ElasticSearch and Redis). This made it more manageable for me to make sure everyone is using the same version of everything, etc.

We've had nothing but issues with VirtualBox -- frankly, I think it's a gigantic POS compared to Hyper-V or VMWare. One of my biggest gripes is that it's not setup to run as a system service, so if you happen to reboot and forget to vagrant halt or vagrant suspend, then you risk corrupting your VM. They recently added service like support to some operating systems, but not Windows.

We're also seeing a lot of weirdness with the VirtualBox gui tools -- with 4.2.10 and Vagrant 1.0.6, once Vagrant has touched the VM, the VirtualBox GUI tools crash on startup. Unless you're familiar with VBoxManage, it can be hard to know what is / isn't running. I've also had issues where Vagrant reports that the VM isn't running, but I can see the VM running in the GUI tools -- not sure if that's an issue with Vagrant or with VirtualBox. I end up having to manually shut the VM down, then reboot... for Vagrant to start seeing it again.

As far as the performance goes, I think it's pretty well established that VirtualBox lags the others by quite a bit. If you Google around, you should be able to find benchmarks.

Windows 8 now ships with Hyper-V in the box, and it's integrated quite nicely. No need to install buggy VirtualBox, or purchase a VMware license. To me, that reason alone is compelling.

My 2c.

@awildeep
Copy link

The other reason this is compelling would be for server provisioning. Vagrant isn't just for setting up a development environment.

@marianposaceanu
Copy link

@Iristyle I don't really use the VirtualBox GUI and had no issues whatsoever yet I do agree that the integration in Windows 8 of Hyper-V sweetens the need for this feature with the added bonus of Hyper-V running in ring 0.

@awildeep server provisioning ? what about puppet/chef ?

@Iristyle
Copy link
Author

@dakull I generally don't use the GUI either. However, some of the devs on the team don't know where to look for the Vagrantfile, etc -- so to shut down things, its easier to hop into the GUI and shut it down (as mentioned, this can also become necessary if Vagrant can't connect to the running VM, which has happened to me many many times).

I just want to give them a VM with services / ports that just works. One thing that would help a bit here is a global registry of Vagrantfile / .vagrant to running VM. Something like box list, but for running VMs -- so you don't have to be in the proper directory at the console to control running VMs.

@marianposaceanu
Copy link

This might help : http://www.virtualbox.org/manual/ch08.html#vboxmanage-list you can then have a script that checks for rogue VMs.

Regarding the sanity of the VMs I think that depends on ones workflow : I like to keep things idempotent so when something breaks I can easily recreate the vagrant env. and just do a git clone of my app source.

@Iristyle
Copy link
Author

@dakull sure, you can use VBoxManage. But the point is that I think that should be part of Vagrants responsibility... especially so if you're using Vagrant to normalize the underlying VM tools in VirtualBox / VMWare.

@am11
Copy link

am11 commented Apr 1, 2013

+1 and here is the list of posh ver 3.0 cmdlets for Hyper-V http://technet.microsoft.com/en-us/library/hh848559.aspx.

@mitchellh
Copy link
Contributor

Custom providers can now be made! http://docs.vagrantup.com/v2/plugins/providers.html

I have no short term plans to officially support Hyper-V, but I'd love to in the future.

@Iristyle
Copy link
Author

Iristyle commented Apr 8, 2013

So in other words...

Basic class definition -> https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/plugin/v2/provider.rb
VirtualBox 4.2, for instance -> https://github.com/mitchellh/vagrant/blob/master/plugins/providers/virtualbox/driver/version_4_2.rb

Doesn't look too difficult, but I don't have the cycles at the moment -- any takers? ;0

@Iristyle
Copy link
Author

I'm swamped and haven't had time yet...

@factormystic
Copy link

+1

@julezman
Copy link

We will also take a look at contributing or doing this if there is time too. Powershell route suggested by am11 seems a possibility

@ultimape
Copy link

I would love to work on this, but I don't know where to start. Can someone with more experience break down what needs to get done? I want to get discourse running on my hyper-v cluster using their vagrant configuration: http://blog.discourse.org/2013/04/discourse-as-your-first-rails-app/

@am11
Copy link

am11 commented Apr 24, 2013

I guess the first step would be to detect if client's hardware supports Second Level Address Translation (SLAT); a pre-requisite of Hyper-V to run VM and an advanced virtualization technology refers to Intel's EPT (Extended Page Tables) or AMD's RVI (Rapid Virtualization Indexing). Here is a good read on it and a way to detect its support in OS using coreinfo.exe.

After that, our corresponding base class may look something similar to:

def initialize
    if Vagrant::Util::Platform.windows? && slat_supported?
       #SLAT is supported, continue checking Hyper-V availability
    end
end

def slat_supported?
   #Assuming coreinfo.exe is available in ruby's bin dir
   slat_dump = `coreinfo -v`
   slat_marker = slat_dump.slice(-45, 1) 

    # slat_marker = '*' means slat is available, slat_marker = '-' means unavailable
   return slat_marker == '*'
end

Unless there is an explicit way to detect SLAT support via syscall, this approach will confirm that the installed Hyper-V feature is eligible to create VM.

@am11
Copy link

am11 commented Apr 24, 2013

I've found another way of checking SLAT support, using PowerShell. The method suggested in the aforementioned blog is querying Selected.System.Management.ManagementObject and returning the desired value using pipeline approach, which also provides access to members using dot (. as in .NET way!).

Our slat_supported? method may look like:

def slat_supported?
  return `powershell "(gwmi win32_processor).SecondLevelAddressTranslationExtensions"`.include? "True"
end

So the dependency on coreinfo.exe is gone resulting in cleaner code.

@factormystic
Copy link

@am11 No need to shell out to run a WMI query...

https://gist.github.com/factormystic/5452265

require 'win32ole'

wmi = WIN32OLE.connect('winmgmts://')
result = wmi.ExecQuery('select SecondLevelAddressTranslationExtensions from Win32_Processor').to_enum.first

if result && result.SecondLevelAddressTranslationExtensions
  puts 'SLAT Available'
else
  puts 'SLAT Not Available'
end

@am11
Copy link

am11 commented Apr 29, 2013

@factormystic, thanks for the simplicity. Next step in initializer function would be to identify if Hyper-V is installed. I couldn't find a better/native way of detecting that. So, I started with this PowerShell script to test of Start-VM cmdlet exists:

Function CmdletExists ($cmdName) 
{ 
    if (Get-Command $cmdName -errorAction SilentlyContinue -CommandType Cmdlet)
    { 
        return 1; 
    } 
    return 0;
}

# call CmdletExists on Start-VM
CmdletExists "Start-VM";

from irb >

`powershell Function CmdletExists ($cmdName) { if (Get-Command $cmdName -errorAction SilentlyContinue -CommandType Cmdlet) { return 1; } return 0;}; CmdletExists('Start-VM');`.to_i

I tested on two machines running Windows 8 Pro. One with SLAT and Virtualization capability and one without (only Hyper-V management and remote control is visible to connect to remote VMs or VM-servers). I was hoping that that the aforementioned script would return 1 only when Hyper-V management has the ability to host VM locally. But unfortunately, it returns 1 on the both machines.

So I moved on to Service test. In the machine where I had the ability to host VMs locally, there was a service Hyper-V Virtual Machine Management, which wasn't present in the other system. Here is the PS script to identify if service is installed:

Function TestServiceExists ($ServiceName) 
{
    if (Get-Service $ServiceName -ErrorAction SilentlyContinue)
    {
        return 1;
    }
    return 0;
}

TestServiceExists("Hyper-V Virtual Machine Management");

from irb >

`powershell Function TestServiceExists ($ServiceName)  { if (Get-Service $ServiceName -ErrorAction SilentlyContinue) { return 1;} return 0; }; TestServiceExists('Hyper-V Virtual Machine Management');`.to_i

Do you know any better way to check if service exists from Win32OLE OR to detect the Hyper-V exists and it has the ability to host VMs locally?

@supernovae
Copy link

Anyone got any movement on this?

@alexsandro-xpt
Copy link

+1 on the hyper-v support.
Please...

@rhbecker
Copy link

I found this: https://github.com/anurse/vagrant-hyperv/

Any other works in progress out there?

@rahmit
Copy link

rahmit commented Jun 22, 2013

The project at https://github.com/anurse/vagrant-hyperv/ is just a skeleton - the project is created but nothing is implemented.

+1 and still looking for Hyper-V support.

@heartpunk
Copy link

I've started work on this over here, and will keep working on it as I can find time.

If you want to support work on it, I've got a project up on BountySource to get an alpha version of this ready for an $1,100 goal. Seems we might be able to hit such a goal.

@SorraTheOrc
Copy link

Here at MS Open Tech we have been following this issue with interest. We'd love to hear more about the work done so far and the blocks being hit. If the problems being faced can be expanded upon I'll see if I can get a good answer for you. Alternatively, is this work available in a public repo anywhere?

@Sauraus
Copy link

Sauraus commented Jan 21, 2014

@rgardler this thread has some of the details although the title is misleading I have to admit: http://social.technet.microsoft.com/Forums/windowsserver/en-US/3f2528f3-3948-42e3-8d8a-bf9e95dce30e/hyperv-virtual-machine-management-service-not-start-with-domain-user-account?forum=winserverhyperv#a249845f-4aed-439a-aec0-2d9b88273b33

But the easiest way for you to repo the issue is to install VirtualBox and Vagrant on your desktop and take it for a spin and then to observe how files are presented to the guest OS from the host when provisioning the guest OS using something like Chef.

VirtualBox is able to access a folder on the host machines from the guest OS through their integration services. AFAIK using HyperV this is only possible using 'constrained delegation' which depends on Kerberos.

@ghost
Copy link

ghost commented Jan 23, 2014

@rgardler, does it mean no more PUTTY and we will finally get SSH support natively in Windows too (as vagrant requires ssh)? Vagrant requires SSH and it is proven to be a most common protocol in server-client/host-guest environments. Denying this fact over a decade is not helping anyone.

@supernovae
Copy link

@jasonwilliams200OK

Can't we just make a Cygwin requirement? Windows + Cygwin pretty much answers the tool chain requirement.. There are wrappers such as CopSSH to make it easier to manage.

@SorraTheOrc
Copy link

@saurus Thanks for the info. I've asked one of the team exploring the Vagrant options to look into the problem you are facing. Hopefully I'll be able to provide a constructive response soon.

@ferventcoder
Copy link

w00t! There are some folks I know that would like to see some Hyper-V love. Appreciate you taking point @rgardler :)

@ghost
Copy link

ghost commented Jan 24, 2014

@supernovae, now why would we do that? Unless we are killing birds with canons.

Cygwin is like an instance of headless linux, with tons of utilities which windows already provides (especially in powershell). Vagrant just require ONE missing util; SSH.

Remember, here the target platform is Windows 8+ (client), which support Hyper-V management and those systems usually come with edge version of PowerShell and WMI installed.

@supernovae
Copy link

@jasonwilliams200OK
It's all about the tools. I'm not sure why anyone would want to exclude Cygwin. If Cygwin keeps this with more parity along the lines of the unix counterparts, to me, that is a positive thing. I agree, embrace powershell and cool stuff like that but don't be afraid of Cygwin, its awesome.

@ghost
Copy link

ghost commented Jan 25, 2014

@supernovae,

I agree that Cygwin is awesome, so is minGW.

The whole point of vagrant is to install less dev related applications on host system and more on portable vagrant instances. You won't be deprived of Unix counterpart anyway when you are running Ubuntu via vagrant.

SSH (a small utility vs huge Cygwin/MinGW packs) is the only thing missing in fresh windows 8x PC (of course with VirtualBox/VMware installed), which is preventing users native CLIs (cmd and powershell). Not to mention other benefits of SSH, SCP etc.

Putty is the light-weight solution, but still not integrable with native shell prompt. Having native ssh support in Windows would be a great welcoming addition.

@ferventcoder
Copy link

I tend to use Bitvise SSH. It has native shell/user environment support and
works with powershell prompts.

I javen't yet tried out the choco pkg for it but you can find it at
http://chocolatey.org/packages/winsshd

On Saturday, January 25, 2014, Jason Williams
<notifications@github.com<javascript:_e({}, 'cvml',
'notifications@github.com');>>
wrote:

@supernovae https://github.com/supernovae,

I agree that Cygwin is awesome, so is minGW.

The whole point of vagrant is to install less dev related applications on
host system and more on portable vagrant instances. You won't be deprived
of Unix counterpart anyway when you are running Ubuntu via vagrant.

SSH (a small utility vs huge Cygwin/MinGW packs) is the only thing
missing in fresh windows 8x PC (of course with VirtualBox/VMware
installed), which is preventing users native CLIs (cmd and powershell). Not
to mention other benefits of SSH, SCP etc.

Putty is the light-weight solution, but still not integrable with native
shell prompt. Having native ssh support in Windows would be a great
welcoming addition.

Reply to this email directly or view it on GitHubhttps://github.com//issues/1244#issuecomment-33283596
.

Rob
"Be passionate in all you do"

http://devlicio.us/blogs/rob_reynolds
http://ferventcoder.com
http://twitter.com/ferventcoder

@jachin84
Copy link

jachin84 commented Feb 6, 2014

I've got some time to spend on this and have significant experience on the Windows and Hyper-V side. Where are we targeting our efforts?

@ionelmc
Copy link

ionelmc commented Feb 25, 2014

Looks like there a new feature in later hyperv: "guest services" that allows out of band file sharing - http://blogs.technet.com/b/keithmayer/archive/2013/11/22/why-r2-guest-services-in-windows-server-2012-r2-hyper-v.aspx

Not sure about support in linux - anyone have any idea here ?

@am11
Copy link

am11 commented Feb 25, 2014

@ionelmc, thanks for the headsup.

Here is the information on Linux support http://technet.microsoft.com/en-us/library/dn282278.aspx#bkmk_linux.

Separately; will it make copy of each file on VMBus we want to share between host and guest? Or just add its reference in an xml file, so we don't have multiple copies? If its latter, then its sane.

@ionelmc
Copy link

ionelmc commented Feb 25, 2014

@am11 Unfortunately they don't appear to have anything on the linux feature grid about the "out of band files sharing" thing.

Looks like it would require developing some integration service/filesystem kernel module for Linux - I wonder if @rgardler has any input on this ...

@SorraTheOrc
Copy link

MS Open Tech just released initial code for a Hyper-V provider for Vagrant. See blog at http://msopentech.com/blog/2014/02/25/vagrant-and-hyper-v-provides-managed-devops-work-environments/ or code at https://github.com/MSOpenTech/vagrant/

We would love to have feedback (and code where appropriate) from folks interested in Hyper-V support.

@Iristyle
Copy link
Author

@rgardler great news!

@ntwb
Copy link

ntwb commented Feb 25, 2014

Cool news... Repo is at https://github.com/MSOpenTech/vagrant/

@SorraTheOrc
Copy link

Thanks @ntwb, I just updated my original comment as I had a cut and paste error on the code link

@alexsandro-xpt
Copy link

Really nice news :D

@jachin84
Copy link

jachin84 commented Mar 5, 2014

Sweet, testing now!

@SorraTheOrc
Copy link

Awesome - our Hyper-V support is now in the 1.5 release - you don't need to checkout our provider separately.

@ntwb
Copy link

ntwb commented Mar 10, 2014

@ghost
Copy link

ghost commented Mar 11, 2014

This is awesome news.

But how does it solve the sharing problem? With VirtualBox, we get a bi-directional folder share without even connecting to network. Can we do the same with Hyper-V's SMB? Is SMB share as swift as VirtualBox share?

In other words, what is NOT supported with Hyper-V SMB share when compared to VirtualBox's sharing? As there are number of complains on shortcomings of Hyper-V, previously posted in this thread! Anyone?

@SorraTheOrc
Copy link

There does need to be a connection between the host and the guest, but that need not be connected to the outside world.

I've not done exhaustive performance testing myself but the docs say "SMB is built-in to Windows machines and provides a higher performance alternative to some other mechanisms such as VirtualBox shared folders." http://docs.vagrantup.com/v2/synced-folders/smb.html

@ghost
Copy link

ghost commented Mar 20, 2014

@rgardler , thanks! BTW, Windows 8 also comes with Hyper-V per-installed. What is missing in 8's Hyper-V which renders 8.1, the minimum OS requirement? Some systems are not updated to 8.1 at our workplace (yet). The list of missing features would help convincing our IT folks to schedule update soon.

@SorraTheOrc
Copy link

@jasonwilliams200OK for Windows guests we needed Windows 8.1 for remote PowerShell execution. Linux guests should work fine on Windows 8, but we are not testing that (would good to hear from anyone trying it out)

@brizzbane
Copy link

Does this for sure not work on windows server 2008 R2? Have been using Hyper-V with windows servers for quite a while, and really wanted to start using Hyper-V.

Windows 8.1 is only version of windows that works, or will later windows server versions work?

It's hanging at checking for hyper-v for me (Windows 2008 R2 Standard)

(Trying to spin up instances using vagrant on a windows server--don't want to spin up windows server machines)

@hashicorp hashicorp locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests