def vm_shutdown(request, vm_id): logging.info("VM %s shutdown by %s", vm_id, request.user_uniq) vm = VirtualMachine.objects.get(pk=vm_id) servers.start_action(vm, 'STOP') servers_backend.shutdown_instance(vm) account = vm.userid return HttpResponseRedirect(reverse('helpdesk-details', args=(account,)))
def shutdown(request, vm, args): # Normal Response Code: 202 # Error Response Codes: serviceUnavailable (503), # itemNotFound (404) log.info("Shutdown VM %s", vm) if args: raise faults.BadRequest('Malformed Request.') backend.shutdown_instance(vm) return HttpResponse(status=202)
def stop(server_id, shutdown_timeout=None, credentials=None, atomic_context=None): with commands.ServerCommand( "STOP", server_id, credentials, atomic_context) as vm: log.info("Stopping VM %s", vm) job_id = backend.shutdown_instance( vm, shutdown_timeout=shutdown_timeout) vm.record_job(job_id) return vm
def stop(server_id, shutdown_timeout=None, credentials=None, atomic_context=None): with commands.ServerCommand("STOP", server_id, credentials, atomic_context) as vm: log.info("Stopping VM %s", vm) job_id = backend.shutdown_instance(vm, shutdown_timeout=shutdown_timeout) vm.record_job(job_id) return vm
def stop(vm, shutdown_timeout=None): log.info("Stopping VM %s", vm) return backend.shutdown_instance(vm, shutdown_timeout=shutdown_timeout)