Closed Iristyle closed 11 years ago
+1 on the hyper-v support.
+1 on the hyper-v support.
+1 on the hyper-v support.
+1 on the hyper-v support.
+1 on a hyper-v provider!
+1
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.
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.
The other reason this is compelling would be for server provisioning. Vagrant isn't just for setting up a development environment.
@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 ?
@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.
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.
@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.
+1 and here is the list of posh ver 3.0 cmdlets for Hyper-V http://technet.microsoft.com/en-us/library/hh848559.aspx.
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.
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
I'm swamped and haven't had time yet...
+1
We will also take a look at contributing or doing this if there is time too. Powershell route suggested by am11 seems a possibility
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/
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.
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.
@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
@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?
Anyone got any movement on this?
+1 on the hyper-v support. Please...
I found this: https://github.com/anurse/vagrant-hyperv/
Any other works in progress out there?
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.
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.
I've also started work on this, along with the other thousand GitHub residents. I have basics so far, i.e: listing all vm's known by hyper-v, creating a new VM + Managing its power states (havent decided on a box format yet, will have to read the docs). For now i'm aiming at something simple that shares a few folders and forwards some ports as that is all I will need to get dev happening on windows.
Still getting my head around how to best structure a Vagrant plugin.
Guys I have found another set of cmdlets (Start, Stop, Restart, Configure, Create, List, Suspend, Resume, Connect) for Hyper-V. http://technet.microsoft.com/en-us/library/hh831705.aspx
These work on Windows 8, 8.1, 2012 and 2012 R2 (although the documentation doesn't mention that).
Hopefully, it will help the folks still working on it. :)
I lost interest in this a while back, too busy with other projects and my personal life. Hope someone else does it, though.
@kernel-io, I found the included plugins very helpful in figuring that out. Check out the virtual box provider.
Would be nice to have support for hyperv (mainly because of fantastic IO performance)
However, hyperv not being a user-level hypervisor, it doesn't have any NAT support (don't even think about doing anything with internet connection sharing, it blows) and no shared folders for linux. Anyone know if those can/will be fixed?
@ionelmc,
If it ain't broke, don't fix it.
You can certainly enable NAT'ed internet with Hyper-V on Windows 2008, 2008-R2, 8, 8.1, 2012 and 2012-R2.
http://technet.microsoft.com/en-us/video/nat-hyper-v.aspx http://blog.areflyen.no/2012/10/10/setting-up-internet-access-for-hyper-v-with-nat-in-windows-8/
You can also share folder with internal connection like a regular sharing on network with UNC path (I wonder why do you think it would blow?). If you want Internet access with internal connection (an obvious use case), you may have multiple connections in Virtual Switch Manager assigned to a VM, say first one is internal (local only) and the second is external with the Internet access.
For the windows folder's permissions, you can grant to Everyone and then mount its UNC path to /vagrant
in Linux. Or if you want to retain/respect the file system's permissions, you can simply mount the UNC path (lets say //windows-pc/doodlebug
for C:\Users\user1\Documents\GitHub\doodlebug\
) to /vagrant
using:
mount -t cifs -o username=window-pc\user1 //windows-pc/doodlebug /vagrant
If you want elaborated method, you may preemptively install Samba package in your box, configure a domain user and then grant the suitable permissions in Windows to this user. For instance, headless-ubuntu
is the vm name on network and sudev
is your user you configured with Samba, you can grant full permission to headless-ubuntu/sudev
on the folder to share in Windows or the entire volume. Finally, mount UNC path to /vagrant
using Samba (for NTML authentication). But I guess Samba won't be necessary for merely mounting folder between host and guest OSes.
Well I don't want to leave you wondering :smiley:
Here are my woes with ICS:
Now, why use NAT in the first place, when you can bridge your vm ? It's not that hard to put a firewall in the vm ...
Well, basically: god damn VPNs. You cannot share a vpn connection to a bridged vm. This blows, and some people don't have a choice :(
And shared folders ? cifs and samba are a joke. Try running git status
on that and then run in despair.
I mean virtualbox's shared folders is SLOW: takes 10 second to run git status on some project of mine. Do you seriously expect people to use something couple orders of magnitude slower ?!
@ionelmc, well some people follow different workflow:
Some even put everything running on vagrant box while keeping the host OS clean (don't use /vagrant
at all). The whole idea is to isolate the dev environment(s) from the host.
Once we have vagrant working with Hyper-V, we can then worry about the performance comparisons.
All I am saying, its possible to automate the process of hooking host's folder with guest using HV. In addition to VMware and VirtualBox, if we have a HV adapter in vagrant (even at the expense of allegedly slow performance), it would be considered as a value added feature for many devs running new version of Windows host.
Not sure if it helps or not, but looking at the forks of anurse/vagrant-hyperv, it looks like @Sauraus did a bunch of work in July in the ROBLOX/vagrant-hyperv fork
https://github.com/ROBLOX/vagrant-hyperv/commits/master
@Sauraus - is this something that's already up and working, and/or something others could help you with?
Thanks!!
I am at the point where I can build new base boxes using veewee, the next step it to figure out how to do Vagrant. HyperV has some significant differences to all other hypervisors which make it a real PITA to do any kind of rapid development work on it.
The biggest problem to resolve is the fact that VMs running on HyperV have no access to the local storage system, eg. shared folders between the Host & Guest are impossible.
+1 for Hyper-V!!
+1520 for Hyper-V support! But unless Microsoft doesn't support file explicit sharing option, its not possible.
Nonetheless, Gavin Gear from Extreme Windows Blog stated: "While what you describe is not currently supported, you can achieve basically the same thing with enhanced session mode and drive redirection, albeit only with VM images that support enhanced session mode (see list in this article)." - (comment @ http://blogs.windows.com/windows/b/extremewindows/archive/2013/12/05/overview-client-hyper-v-enhanced-session-mode-in-windows-8-1.aspx)
Please don't think of this as merely an alternative to locally hosted VirtualBox VMs. (This is directed towards the complains about local storage sharing and local NAT)
Yes, you certainly could use Hyper-V in lieu of VirtualBox for local dev work, but that's not really the main use case for the alternative providers in Vagrant.
The awesome thing about Vagrant providers is the ability to:
I've been an advocate of XenServer for several years, but Hyper-V in 2012 R2 is looking like it may be the better option right now for small/medium sized private-cloud type setups. Vagrant support would make it much better.
+1 available for every windows developer
+1 for Hyper-V!!
A quick update from my side, I am currently able to build and export 'veewee' built VMs on HyperV, that's the good news, now for the bad.
Unfortunately due to HyperV's security architecture shared folders between host and guest are only supported using Kerberos authentication which is more than just small problem when dealing with dynamic VMs being created on a HyperV host that is part of a domain.
If anyone knows of an easier way to share folders between a HyperV guest & host (or workstation) then please reply to this thread.
@Sauraus Regarding Kerberos authentication:
Is the problem with Kerberos that you don't have the libraries available on linux? or from the ruby script environment?
My understanding of how Kerberos authentication works in a Windows Domain is that it requires both source & target host to be registered in the domain tree, which is not an impossible problem but I have to yet meet the first AD admin who is happy with me adding and deleting hosts on a continuous basis to there AD tree. ;)
Can you elaborate a bit on the Kerberos requirement? Any references ? Are you referring here to the nfs support in the windows enterprise version ?
Thanks, -- Ionel M.
On Wed, Jan 22, 2014 at 12:15 AM, Antek Baranski notifications@github.comwrote:
A quick update from my side, I am currently able to build and export 'veewee' built VMs on HyperV, that's the good news, now for the bad.
Unfortunately due to HyperV's security architecture shared folders between host and guest are only supported using Kerberos authentication which is more than just small problem when dealing with dynamic VMs being created on a HyperV host that is part of a domain.
If anyone knows of an easier way to share folders between a HyperV guest & host (or workstation) then please reply to this thread.
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/1244#issuecomment-32970122 .
There are several threads on MS' TechNet about shared folders between Guest & Host using HyperV and how Kerberos fits into that.
I'm sure there are. Can you please add some links to them ?
Thanks, -- Ionel M.
On Wed, Jan 22, 2014 at 1:13 AM, Antek Baranski notifications@github.comwrote:
There are several threads on MS' TechNet about shared folders between Guest & Host using HyperV and how Kerberos fits into that.
— Reply to this email directly or view it on GitHubhttps://github.com/mitchellh/vagrant/issues/1244#issuecomment-32975320 .
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.