Shutting down a virtual machine

Shutting down a virtual machine

Rate This
  • Comments 3


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:

  1. Almost no operating system today has a method for reporting shut down progress.  They just try to shut down as quickly as possible.
  2. 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

Leave a Comment
  • Please add 2 and 8 and type the answer here:
  • Post
  • I now use 2 little tricks , ever tried shuting down a pc with services manager open ?

    it wont. so i just open that one in the background got the window make it 4x4 px width at -100

    have a script running that looks at the ownership of the vhd when it is released i close the little service console and this works niceley, well if u keep the power button pressed well... :D

    another way would be is to create a guest acount that is not really logged in but is using one file,lets say regedit orso this way u get the same as when a rdp user want to reboot the warning, if all is ignored well :)

    with my workspace vhds i always run a restore point at startup , and the real important stuff is builded at runtime with my dropbox folder over lan it takes like 2 minutes okay, but this way the real stuff is protected i can live with some data loss, after my kids or my stupid gf kept that button pressed for 15 seconds ;)

  • 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.

  • 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]

Page 1 of 1 (3 items)