MCPcopy Create free account
hub / github.com/78/tenbox / StopVm

Method StopVm

src/daemon/runtime_manager.cpp:516–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

514}
515
516bool RuntimeManager::StopVm(const std::string& vm_id, std::string* error) {
517 auto session = FindSession(vm_id);
518 if (!session) {
519 if (error) *error = "VM is not running";
520 return false;
521 }
522 if (session->process_pid > 0) {
523 session->stop_requested = true;
524 ::kill(session->process_pid, SIGTERM);
525 }
526 session->info.state = VmState::kStopping;
527 session->info.guest_agent_connected = false;
528 store_.UpdateRuntime(vm_id, session->info);
529 NotifyStateChanged(vm_id, session->info);
530 return true;
531}
532
533bool RuntimeManager::RebootVm(const std::string& vm_id, std::string* error) {
534 auto session = FindSession(vm_id);

Callers 3

HandleRequestMethod · 0.45
DeleteVmMethod · 0.45
HandleRequestMethod · 0.45

Calls 1

UpdateRuntimeMethod · 0.80

Tested by

no test coverage detected