prepare hibernation/resuming from hibernation file
This commit is contained in:
@@ -39,16 +39,21 @@ def vmm_start(args):
|
||||
print("VM {0} is already running!".format(args.vmid))
|
||||
return
|
||||
|
||||
#TODO: pass ignore hibernation file flag
|
||||
print('Starting VM {0.vmid}.'.format(args))
|
||||
fullpath_manager = os.path.realpath(sys.argv[0])
|
||||
helper.startVM(args.vmid,fullpath_manager)
|
||||
#print("Successfully started: " + ("yes" if helper.process_running(args.vmid) else "no"))
|
||||
|
||||
def vmm_shutdown(args):
|
||||
timeout = SHUTDOWN_TIMEOUT if args.t is None or args.t < 0 else args.t
|
||||
stCallback = lambda vmid, st : print("VM {0}: {1}".format(vmid, stopStatusToMessage[st]))
|
||||
|
||||
helper.shutdownVMs(timeout, args.s is None or args.s < 1, statusCallback=stCallback)
|
||||
|
||||
def vmm_hibernate(args):
|
||||
#TODO: implement ;)
|
||||
|
||||
def vmm_stop(args):
|
||||
if(not helper.process_running(args.vmid)):
|
||||
print("VM {0} is not running!".format(args.vmid))
|
||||
@@ -126,6 +131,7 @@ def main():
|
||||
|
||||
parser_start = subparsers.add_parser('start', help='starts a VM')
|
||||
parser_start.add_argument('vmid', action='store', help='the ID of the VM')
|
||||
parser_start.add_argument('-i', action='count', help='ignore saved VM state')
|
||||
parser_start.set_defaults(func=vmm_start)
|
||||
|
||||
parser_authorized = subparsers.add_parser('gen-auth-keys', help='Regenerates authorized_keys file')
|
||||
@@ -143,6 +149,9 @@ def main():
|
||||
parser_shutdown.add_argument('-s', action='count', help='sequencial mode, timeout for each vm')
|
||||
parser_shutdown.set_defaults(func=vmm_shutdown)
|
||||
|
||||
parser_hibernate = subparsers.add_parser('hibernate', help='Suspend the execution of all VMs and save theire state to disk')
|
||||
parser_hibernate.set_defaults(func=vmm_hibernate)
|
||||
|
||||
parser_status = subparsers.add_parser('status', help='query the status a VM')
|
||||
parser_status.add_argument('-v', action='count', help='increase verbosity')
|
||||
parser_status.add_argument('vmid', action='store', default=0, help='the ID of the VM')
|
||||
|
||||
Reference in New Issue
Block a user