qemu_vm: don't wait 1 second before first check

There's no need to wait 1 second before the first check for
status=paused, just used the default values for th wait_for() 'first'
and 'step' parameters.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: introduce wait_for_status() method

A helper to wait until VM status changed to specific value.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: introduce wait_until_paused() method

Just a helper for code that needs to wait until the VM is paused.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: introduce wait_until_dead() helper

Makes the code that waits until VM is dead simpler.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: introduce graceful_shutdown() method

This will help isolate the destroy() code that uses the shutdown command
from the rest of the VM-killing code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: isolate code that waits for guest shut down

The code is trivial by now, but it will be extended once we start using
-no-shutdown.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: wait until VM is paused in case -no-shutdown is being used

This should help us in the main use case of the kill_vm_only_when_paused
code: to make the shutdown code wait until the VM is paused instead of
waiting until the VM is killed, when -no-shutdown is used.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: eliminate kill_vm_only_when_paused option

The option is not necessary anymore, as we have code specific for
-no-shutdown in the graceful-shutdown code path.

Other code that needs to wait until VM is paused outside
graceful_shutdown() may simply call wait_for_shutdown() or
wait_until_paused() directly.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
qemu_vm: Fix mistake in commit 3e911b6

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
qemu_vm: Fixing coding style (docstring and line spacing)

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
qemu_vm: Fix logging for destroy()

Do a better job at logging which VM is being killed,
and which method to kill it was used. Other parts of
the VM classes need cleanup, but let's start with this
method.

Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>