[Libvir] [patch] qemu/kvm: use_system_powerdown instead of killing the vm hard

Daniel P. Berrange berrange at redhat.com
Tue Jan 8 18:34:36 UTC 2008


On Tue, Jan 08, 2008 at 05:55:45PM +0100, Guido Guenther wrote:
> On Tue, Jan 08, 2008 at 04:37:02PM +0000, Daniel P. Berrange wrote:
> > On Tue, Jan 08, 2008 at 12:15:56PM +0100, Guido Guenther wrote:
> > > Hi,
> > > currently domainShutdown kills qemu/kvm instances hard which is not very
> > > filesystem friendly. However recent kvm git acquired system_powerdown to
> > > shutdown the system gracefully by simulating an acpi power button press.
> > > We can now use this in libvirt: 
> > 
> > Excellant, although we still need to use the 'kill' approach for any VMs
> > which don't support the 'system_powerdown' monitor command. We should
> > probably try 'system_powerdown' and if that gets rejected then fallback
> > to just killing it. Figuring out if its rejected could be fun though;
> > Would have to look at the returned 'info' for an error message - hopefully
> > QEMU has one.
> No, there's no error code or output since the drop in code in qemu is
> (and was since ages):
> 
> #define qemu_system_powerdown() do{}while(0)
> 
> I don't think that's a problem though. As far as I understand things a
> shutdown simply signals the VM to powerdown. We can't rely on the
> machine actually stopping (say the machine hangs on unmounting something
> or simply stops heaps of services or whatever). So any sane script or
> cluster manager will have to do a domainDestroy() anyways after a
> reasonable timeout (what's "reasonable" depends pretty much on the usage
> case). Relying on domainShutdown() ever succeeding is probably wrong in
> the first place.

Fair enough. Any idea if the 'system_reboot' command is also wired up
in KVM yet ?  We should probably just add code to call it anyway since
it'll be near identical code to that which you used for shutdown, and
its better than leaving domainReboot driver method as a no-op.


Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 




More information about the libvir-list mailing list