Richard W.M. Jones
2018-Nov-06 13:07 UTC
Re: [Libguestfs] [PATCH v2 2/2] p2v: add a Shutdown action (RHBZ#1642044)
On Tue, Nov 06, 2018 at 12:51:30PM +0100, Pino Toscano wrote:> +static void > +shutdown_clicked (GtkWidget *w, gpointer data) > +{ > + if (!is_iso_environment) > + return; > + > + sync (); > + sleep (2); > + ignore_value (system ("/sbin/shutdown now")); > +}I've tested this and it works but of course it doesn't in fact power off the machine. Would it be better to run "/sbin/poweroff" instead? Anyway, either way ACK series, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Pino Toscano
2018-Nov-06 15:06 UTC
Re: [Libguestfs] [PATCH v2 2/2] p2v: add a Shutdown action (RHBZ#1642044)
On Tuesday, 6 November 2018 14:07:51 CET Richard W.M. Jones wrote:> On Tue, Nov 06, 2018 at 12:51:30PM +0100, Pino Toscano wrote: > > +static void > > +shutdown_clicked (GtkWidget *w, gpointer data) > > +{ > > + if (!is_iso_environment) > > + return; > > + > > + sync (); > > + sleep (2); > > + ignore_value (system ("/sbin/shutdown now")); > > +} > > I've tested this and it works but of course it doesn't in fact power > off the machine. Would it be better to run "/sbin/poweroff" instead?Hm shutdown by default does poweroff, and in my testing the VM was powered off. Do you see the VM still running after the system shutdown? -- Pino Toscano
Richard W.M. Jones
2018-Nov-06 15:29 UTC
Re: [Libguestfs] [PATCH v2 2/2] p2v: add a Shutdown action (RHBZ#1642044)
On Tue, Nov 06, 2018 at 04:06:35PM +0100, Pino Toscano wrote:> On Tuesday, 6 November 2018 14:07:51 CET Richard W.M. Jones wrote: > > On Tue, Nov 06, 2018 at 12:51:30PM +0100, Pino Toscano wrote: > > > +static void > > > +shutdown_clicked (GtkWidget *w, gpointer data) > > > +{ > > > + if (!is_iso_environment) > > > + return; > > > + > > > + sync (); > > > + sleep (2); > > > + ignore_value (system ("/sbin/shutdown now")); > > > +} > > > > I've tested this and it works but of course it doesn't in fact power > > off the machine. Would it be better to run "/sbin/poweroff" instead? > > Hm shutdown by default does poweroff, and in my testing the VM was > powered off. Do you see the VM still running after the system > shutdown?Yup, definitely still powered (although the kernel was shut down). It may be affected by qemu version and flags though. I guess poweroff is safer though, but it's up to you. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Seemingly Similar Threads
- Re: [PATCH v2 2/2] p2v: add a Shutdown action (RHBZ#1642044)
- Re: [PATCH 2/2] p2v: add a Shutdown action (RHBZ#1642044)
- [PATCH 2/2] p2v: add a Shutdown action (RHBZ#1642044)
- [PATCH v2 2/2] p2v: add a Shutdown action (RHBZ#1642044)
- Re: [PATCH v2 2/2] p2v: add a Shutdown action (RHBZ#1642044)