Xen And The Art of Hypervisor Maintenance
In the last part of this series that I had originally intended to only have one part (and be primarily about Linux and its virtualisation capabilities, talk about getting carried away), we’ll create the virtual machine with a virtual DVD in the form of a Windows 7 Pro 64-bit ISO.
To start with, we need to create a virtual switch to allow the VM to access the external network and the internet. Its not vital as its only a demo/test but we’ll do it for completeness, and ‘cos its fun to learn. As of v4.3, Xen supports a similar system called Open vSwitch (I tend to refer to the MS virtual switch as the vSwitch in this article, just to confuse everyone).
To create the virtual switch, right-click on the virtual machine name, select ‘New‘ in the menu and then click on ‘Virtual Switch Manager‘. This will display the Virtual Switch Manager:
As you can see, there are 3 types of vSwitch: External: which allows VM’s to connect to each other, the host and the external physical network (internet etc); Internal: which allows VM’s to connect to each other and the host only; Private: which allows the VM’s to connect to each other only.
In this set up we’ll use an external vSwitch to allow the VM to connect to the internet and the external machine. Select this in the right hand list and click “Create Virtual Switch“.
Give the switch a name, anything will do but I tend to use a descriptive name so that I know what is doing what.
As this will be an external switch, select the interface that it will use. The option to allow the management OS to share the NIC should be ticked. If you are using this VM on a VLAN, you can specify a VLAN ID. For now, leave this blank. Once the switch options have been set, then click ‘Apply‘. You will receive a warning about network disruption. Click ‘Yes‘. You’ll see the ‘Applying Changes’ indicator. Once this has finished, click ‘OK‘.
Now the hard drive and vSwitch have been created, its time to create the actual VM itself.
The Virtual Machine:
Please Note: I’m not going to use screen shots for the next section as it should be fairly self-explanatory.
Once again, right-click on the Hyper-V server name, select ‘New‘ and then ‘Virtual Machine‘. This will bring up the ‘New Virtual Machine Wizard‘. In this instance, due to limitations of the hardware, I’m going to create a VM with a custom configuration (click ‘Next‘. Do this after every instruction).
Give the machine a name. I’ve called mine “Win7Pro“. Leave the location as the default.
On the next screen, I’ve chosen a Generation 1 VM. This is because I’m using Win7. If you are using Win8 or Win10 (64-bit) you can choose Gen 2. Select carefully as you cannot change this later.
Next, we set the memory. This will depend on the type of OS and how much RAM was allocated to the Hyper-V hypervisor via Xen (don’t forget, this is a virtualised hypervisor). As I only assigned 4Gb to Hyper-V, I’m going to assign 2Gb (2048 Mb) to the VM, which is the minimum that Win7 needs to run with any semblance of speed.
Then, we need to select which vSwitch to connect the virtual NIC to. As this set up only has one, that should be an easy choice.
Now we come to the virtual hard drive. You can create one via this screen but, we created one earlier (or ‘Blue Peter’d it, if you’re in the UK) so we’ll use that one. Select ‘Use an existing virtual hard disk‘ then click ‘Browse‘. You should then see the drive that was created. Select it then click ‘Open‘.
Lastly, you will be presented with the summary. Check that everything is correct then click ‘Finish‘. The Hyper-V Manager should look something like this:
Before the VM is started, we need to connect the ISO for the DVD. To do this, select ‘Settings‘ in the bottom right-hand panel. The VM settings manager will be displayed. In the left-hand column you should see the IDE controllers 0 & 1. Controller 1 is the DVD drive. Select the DVD drive itself. This gives us the properties of the DVD drive:
You will see that we are able to select either no drive, an image file (.ISO) or the host machine’s physical drive. For now, select ‘Image File‘. Then browse for the location of the image file you want to use.
Note: You will need to upload the .iso file to the Hyper-V server before selecting it as it is not accessible from the local file system on the Win2k12 server (eg, Holly, in this case). As this is a VM hypervisor, it’s easier to create a shared folder on the Hyper-V server, mount it in the Linux host and upload it that way.
Here, I’ve created a mount point ‘/media/canderson/mnt‘ for a Windows share on 192.168.0.11 (Hyperv-vm) called ‘upload‘.
I can then copy the Win7Pro64.iso file to the Hyper-V server ready to attach to the DVD.
Once the .iso file has been copied and attached, click ‘OK’, then right-click the VM name in the VM list and click ‘Refresh’. The VM should now appear in the top-central panel. The VM can now be started. In the bottom-right frame of the Hyper-V Manager click ‘Connect‘.
Houston, We have a problem:
We certainly do. Unfortunately, it appears that the VM in Hyper-V will not start. After much investigation, supported by the entire Columbian annual coffee output, Google, Microsoft and Xen forums, it turns out that Hyper-V is not being supplied with the correct CPU features by the Xen Hypervisor (the CPU does have all the required features to run Hyper-V, I’ve checked).
This means that the hypervisor itself will run, as we have seen but, no matter what else, any VM’s created within Hyper-V will not run. I have tried re-mapping the CPUID to provide the correct features but to no avail (Hyper-V seems to ignore the CPUID option in the .cfg file, except when its so wrong it causes a boot cycle!).
So, for the moment, this is where the story pauses. I’m not going to give up (I’m too bloody-minded, pig-headed, stubborn, tenacious, take your pick). I may have to break out the big server and try it out on there and see where that leads me. I will keep this blog updated with what I find out.
As an experiment, I’m going to download the 2016 versions of both servers and see if there is any difference. I will let you know.
For now, I will leave you with the error message to ponder…..