snapshotter: vboxmanage poweroff and start (headless)

This commit is contained in:
Przemyslaw Kaminski 2015-09-03 14:14:29 +02:00
parent f1e8b63d7a
commit bd90cbe8f7

View File

@ -63,12 +63,12 @@ def restore(n):
was_running = False
if vminfo['VMState'] == 'running':
click.echo('[{vm}] Running, stopping'.format(vm=vm))
vagrant('suspend', vm)
vboxmanage(['controlvm', vm, 'poweroff'])
was_running = True
click.echo("Restoring %s" % vm)
snap = vboxmanage(['snapshot', vm, 'restore', n])
if was_running:
vagrant('up', vm)
vboxmanage(['startvm', vm, '--type', 'headless'])
click.echo(snap)