While reading articles about Microsoft Hyper-V, I found that Hyper-V seemed to have different states for virtual machines from VMware vSphere. The virtual machine in Hyper-V is represented by the Msvm_ComputerSystem class. If you are familiar with VMware vSphere, you know the equivalent in vSphere is VirtualMachine. At first sight, the Hyper-V APIs may not look straight-forward. The Hyper-V APIs is actually based on Windows Management Instrumentation (WMI), which is essentially CIM from DMTF.
The Msvm_ComputerSystem class defineds the RequestStateChange method that can be used to set the state to one of these:
Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.
|Hyper-V VM States||Action||Equivalent vSphere States VirtualMachinePowerState|
|Enabled 2||Turns the VM on.||Powered on|
|Disabled 3||Turns the VM off.||Powered off|
|Reboot 10||A hard reset of the VM.||Similar to resetVM_Task() method|
|Reset 11||For future use.||NA|
|DMTF Reserved 13–32767||Reserved.||NA|
|Paused 32768||Pauses the VM.||NA|
|Suspended 32769||Saves the state of the VM.||Suspended|
|Vendor Reserved 32770–65535||Reserved.||NA|
As you can tell, there are good mappings between these two. After all, both are virtual machines. Somehow, the Hyper-V APIs mixes the real states and actions together. Requesting a state change results in actions that deliver the change. VMware vSphere APIs uses the real methods for state changes, for example, powerOnVM_Task(), powerOffVM_Task(), resetVM_Task().
The real difference is the paused state, which does not have equivalent in vSphere. Coming from VMware world, I was at little confused about the paused and suspended at first. Then I found this link offers pretty good explanation of the difference:
“…You can also pause or save a virtual machine in a given state. When you pause or save a virtual machine, it stays in its current state for as long as you want.
Although pausing a virtual machine does not free up the memory that is allocated to that virtual machine, it frees up main processor resources. Saving a virtual machine frees up memory and main processor resources so that they can be used by other virtual machines or by the virtualization server.”
It’s worthwhile to point out that the GUI from Microsoft has a different terminology – it uses saving instead of suspending. If you are familiar with Windows terms, the pausing is like sleep while saving like hibernate.
With the difference clear, the question is whether the extra paused state is useful or not. As described earlier, the key difference between paused and suspended is memory. Having the memory in place can surely speed up the resuming of a virtual machine, especially when the virtual machine has big memory footprint. At the same time, the allocated memory cannot be used by other virtual machines.
If you need instant recover of virtual machines, pausing them may be helpful. You may wonder why not keep them always running because the difference of paused and powered on is whether the virtual machine gets CPU allocation. If a virtual machine does not use much CPU power, it’s probably not worthwhile to pause it – just keep it running. I think the best use cases of pausing feature is for virtual machines that 1. use little memory. 2. consume many CPU cycles while idle. 3. need to resume instantly.