Shutting down a virtual machine
What happens when you use the Virtual PC / Virtual Server / Hyper-V user interface to shut down a virtual machine?
At the simplest level – we send a message over to the virtual machine that asks the guest operating system to shut down, and then we wait.
But this is where things get a little tricky.
We can send a request to shut down the guest operating system, and we can know whether the request to shut down was received or not. But once the shut down process begins – we have no idea what is happening. This comes from two issues:
- Almost no operating system today has a method for reporting shut down progress. They just try to shut down as quickly as possible.
- At some stage during the shut down process the guest operating system will shut down the components that we have running inside the virtual machine that allow us to monitor what is going on.
So instead of trying to monitor the shut down process – we just fake it.
When you select to shut down a virtual machine – we send the request to shut down. Once we receive confirmation that the operating system has started shutting down we display a progress bar in the user interface. This progress bar is 100% fake. All that we are doing is watching to see if the virtual machine turns off, and counting to 5 minutes. We slowly increase the progress of the fake progress bar – and if we see the virtual machine turn off by itself we assume that shut down was successful. We then set the progress bar to 100% and report that shut down was successful.
If the 5 minute timer is met and the virtual machine has not shut down – this can pose another problem for us. It is highly likely that, while the virtual machine machine has failed to shut down, our integration services have been stopped. This means that we may not be able to issue a second request to shut down.
Because of this, if the virtual machine is still running after 5 minutes – we report that shutdown has failed and that you should go and have a look at at. This can lead to a strange experience if the virtual machine takes just over 5 minutes to shut down – as this will result in us displaying an error message moments before success.
We have discussed the idea of simulating an ACPI power off command instead of using an integration service. This would make shutting down a virtual machine with the shut down button equivalent to hitting the power button on a modern computer. The problem with this approach is that you can configure most operating systems to do nothing when the power button is pressed – which would be confusing for the end user.
Cheers,
Ben
Comments
Anonymous
January 12, 2011
The comment has been removedAnonymous
January 20, 2011
VPC07 with .vud guesting DOS 6.22: Since I'm using a differentiating disk, I noticed that when I make substantial data changes, it takes longer to shutdown VPC. perhaps because it has to write the larger .vud file to the .vhd before shutting down VPC. On the flip-side of the VPC shutdown coin, how can I prevent my users from turning off VPC, unless they have exited my INFORMIX-SQL app to the DOS command prompt. On several ocassions, my users have accidentally turned off VPC while the apps SQL engine and tables are still open, thus corrupting the B-tree files.Anonymous
October 13, 2011
Virtual PC is een programma ontwikkeld door Connectix. Het programma werd voor het eerst uitgebracht in 1997. Deze versie was alleen beschikbaar voor Mac OS. Het moest de Mac gebruikers in staat stellen hiermee Windows op hun computer te draaien. Apple gebruikte in die tijd nog processors met de PowerPC architectuur, waardoor instructies van Windows die geschreven zijn voor het x86 platform vertaald moesten worden door de software. In 2001 bracht Connectix ook een Windows-variant op de markt. In 2004 werd de ontwikkelaar Connectix overgenomen door Microsoft. Sindsdien heeft Microsoft besloten Virtual PC actief door te ontwikkelen. De technologie wordt in diverse Microsoft-producten gebruikt, waaronder Virtual Server. Nadat Apple in 2005 bekend maakte dat het overstapt op Intel-processors voor zijn Apple Macintosh-computers, besloot Microsoft een jaar later het programma voor Mac OS X op te schorten. Als reden werd genoemd dat Apple met Boot Camp al zelf aan een alternatief werkte en ook was er al interesse in het Mac OS X platform getoond door VMWare en Parallels.[1]