We now have a working solution for producing regular .vhd images as part of our release process: CBS is now using qemu-img-ev and qemu-kvm-ev from the Virt SIG, instead of the versions in CentOS Linux base. We don't need either VirtualBox or changes in Image Factory.
If anyone has access to Hyper-V on Windows and would be willing to test two Vagrant images, please let me know. I received conflicting test results from Thomas and Michael, and I'd like to have at least an additional test before deciding whether to release them or not.
Thanks, Lauren?iu
I just reached out to a friend on the Hyper-V team at MS to see if we can figure something out. It would be nice to have a way to automate this testing going forward.
-Jeff
I emailed Laurentiu off list to get the boxes for 6.1.1 and 7.1.1.
I'm late to joining this discussion but I'm happy to help. I work on the Hyper-V team and have been doing some testing and improvements to Vagrant and Packer on the side.
re: sparse files - NTFS doesn't support sparse files, but Hyper-V does have dynamically expanding VHD and VHDX files. VHDX allocations are configurable but the default of 32MB is tuned to NTFS which puts all metadata at the beginning of the disk. Dropping VHDX allocations down to 1MB helps reduce the slack space left after each inode. VHD uses smaller allocations so it’s less of an issue. Both images are just over a gig on disk which is about what I’d expect.
If you’re optimizing the template Vagrantfiles in the boxes, it would be very helpful to add differencing_disk = true to avoid copying the full VHD and reduce IO in vagrant up.
Here's what I observed on each image
Centos 6.1.1 - Vagrant didn't find an IP address upon bootup. I logged in via the console and the Hyper-V virtual NIC was on eth1 which didn't have dhclient configured. I ran dhclient manually, then vagrant ssh was able to find the IP
Centos 7.1.1 - Vagrant worked as expected. It found the IP as the VM booted up.
I haven't fully tested everything but wanted to share some of the results. Let me know if there's a list of tests run against the other boxes and I can go through them.
Cheers, Patrick Lang (github.com/patricklang)
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
On 01/05/17 05:37, Patrick Lang wrote:
re: sparse files - NTFS doesn't support sparse files, but Hyper-V does have dynamically expanding VHD and VHDX files. VHDX allocations are configurable but the default of 32MB is tuned to NTFS which puts all metadata at the beginning of the disk. Dropping VHDX allocations down to 1MB helps reduce the slack space left after each inode. VHD uses smaller allocations so it’s less of an issue. Both images are just over a gig on disk which is about what I’d expect.
Image Factory generates VHD images via qemu-img; based on what you write, we can probably leave that as it is.
If you’re optimizing the template Vagrantfiles in the boxes, it would be very helpful to add differencing_disk = true to avoid copying the full VHD and reduce IO in vagrant up.
I saw Vagrant has a boolean "differencing_disk" option, probably defaulting to false. It doesn't mention any disadvantages in having this enabled by default (e.g. the equivalent VirtualBox option requires you to manually delete an additional clone VM, against which the Vagrant boxes create diff images). If this isn't required for Hyper-V, we should probably enable it.
Here's what I observed on each image
Centos 6.1.1 - Vagrant didn't find an IP address upon bootup. I logged in via the console and the Hyper-V virtual NIC was on eth1 which didn't have dhclient configured. I ran dhclient manually, then vagrant ssh was able to find the IP
This is also what Michael reported: eth0 seems to be renamed to eth1 during boot. I assume it's udev doing that; perhaps we have a mismatch between /etc/udev/rules.d/70-persistent-net.rules and /etc/sysconfig/network-scripts/ifcfg-eth0 (probably regarding the MAC of the network card)? We only provide a configuration for eth0, the higher NICs should be enabled by Vagrant (at least in theory, because it actually ignores settings like private_networking on Hyper-V, if I understand correctly).
I haven't fully tested everything but wanted to share some of the results. Let me know if there's a list of tests run against the other boxes and I can go through them.
Our current tests only run 'uname -r' on the boxes, and perhaps a yum update, to make sure networking to the outside works. Another idea would be to add private_networking to the Vagrantfile (if that would work with Hyper-V), install Apache inside the box, and grab the default static webpage from the host via the private_networking IP.
Thanks, Patrick and Jeff!
Best regards, Laurențiu
On 01/05/17 05:37, Patrick Lang wrote:
Centos 6.1.1 - Vagrant didn't find an IP address upon bootup. I logged in via the console and the Hyper-V virtual NIC was on eth1 which didn't have dhclient configured. I ran dhclient manually, then vagrant ssh was able to find the IP
Patrick, would it be possible for you to check the MAC address of the NIC inside the Vagrant box? If you login in a console, "ip addr show dev eth1 scope link" should display it as "link/ether". It should be set to 52:54:00:f8:36:8f for our configuration to work properly. If the MAC happens to be another value like 00:15:5D:01:07:DC, which is the Image Factory default for MacAddress in the generated Hyper-V XML, eth0 would probably be renamed to eth1 - not 100% sure.
You could also try to add 'config.vm.base_mac = "5254008815b6"' to your Vagrantfile before booting the box for the first time (that's only documented for VirtualBox, no idea if it has any effect on Hyper-V boxes).
Thanks, Laurențiu
As it stands today it’s getting a new MAC address from the host’s pool:
($vm | Get-VMNetworkAdapter).MacAddress 00155D16FCF Get-VMHost | fl Mac* MacAddressMaximum : 00155D016FFF MacAddressMinimum : 00155D016F00
Hyper-V does have a MAC parameter https://www.vagrantup.com/docs/hyperv/configuration.html#mac that could be used.
I added this to the Vagrantfile config.vm.provider "hyperv" do |hv| hv.mac = "52:54:00:f8:36:8f" hv.differencing_disk = true end
Once the VM boots, it still doesn’t get an IP. Ifconfig -a shows the right MAC address, but grepping dmesg for eth0 finds “udev: renamed network interface eth0 to eth1”. This is some time after hv_netvsc is loaded and has detected the right MAC.
Can you point me to the scripts used to build the boxes? I'd like to get an idea of what’s there so I can provide PRs or feedback as the Hyper-V provider improves.
Private networks & static IPs aren’t implemented yet in the Hyper-V provider. I’m hoping to implement it at some point but it will be a while before I’m able to get to it. https://github.com/mitchellh/vagrant/issues/8384#issuecomment-287570247
Cheers, Patrick
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows 10
From: Laurentiu Pancescumailto:lpancescu@gmail.com Sent: Tuesday, May 2, 2017 12:27 AM To: centos-devel@centos.orgmailto:centos-devel@centos.org Subject: Re: [CentOS-devel] Vagrant images for Hyper-V
On 01/05/17 05:37, Patrick Lang wrote:
Centos 6.1.1 - Vagrant didn't find an IP address upon bootup. I logged in via the console and the Hyper-V virtual NIC was on eth1 which didn't have dhclient configured. I ran dhclient manually, then vagrant ssh was able to find the IP
Patrick, would it be possible for you to check the MAC address of the NIC inside the Vagrant box? If you login in a console, "ip addr show dev eth1 scope link" should display it as "link/ether". It should be set to 52:54:00:f8:36:8f for our configuration to work properly. If the MAC happens to be another value like 00:15:5D:01:07:DC, which is the Image Factory default for MacAddress in the generated Hyper-V XML, eth0 would probably be renamed to eth1 - not 100% sure.
You could also try to add 'config.vm.base_mac = "5254008815b6"' to your Vagrantfile before booting the box for the first time (that's only documented for VirtualBox, no idea if it has any effect on Hyper-V boxes).
Thanks, Laurențiu _______________________________________________ CentOS-devel mailing list CentOS-devel@centos.org https://lists.centos.org/mailman/listinfo/centos-devel
On 02/05/17 21:00, Patrick Lang wrote:
Once the VM boots, it still doesn’t get an IP. Ifconfig -a shows the right MAC address, but grepping dmesg for eth0 finds “udev: renamed network interface eth0 to eth1”. This is some time after hv_netvsc is loaded and has detected the right MAC.
Perhaps we should seal the Vagrant boxes. [1] I started a build, I'll send you the links off-list.
[1] https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.1/htm...
Can you point me to the scripts used to build the boxes? I'd like to get an idea of what’s there so I can provide PRs or feedback as the Hyper-V provider improves.
We're using Image Factory to build the boxes. It performs a single netinst using KVM, and the resulting disk image is converted from the qemu format to different formats like VMDK, VHD, etc. (this only affects the image format, the files remain untouched as they were when the installation ended - the box should be able to boot correctly). Metadata is then generated for each virtualization type, and everything packed together in Vagrant boxes for each provider we support. For Hyper-V, probably HyperVOVFDescriptor.py is the most interesting part:
https://github.com/redhat-imaging/imagefactory/tree/master/imagefactory_plug...
Best regards, Laurențiu