void VMUniverseMgr::freeVM(pid_t s_pid) { VMStarterInfo *info = findVMStarterInfoWithStarterPid(s_pid); if( !info ) { return; } MyString pid_dir; Directory execute_dir(info->m_execute_dir.Value(), PRIV_ROOT); pid_dir.formatstr("dir_%ld", (long)s_pid); if( execute_dir.Find_Named_Entry( pid_dir.Value() ) ) { // starter didn't exit cleanly, // maybe it seems to be killed by startd. // So we need to make sure that VM is really destroyed. killVM(info); } m_vm_used_memory -= info->m_memory; m_vm_starter_list.Delete(info); delete info; if( !m_vm_starter_list.Number() && m_needCheck ) { // the last vm job is just finished // if m_needCheck is true, we need to call docheckVMUniverse docheckVMUniverse(); } }
void VMUniverseMgr::checkVMUniverse(void) { dprintf( D_ALWAYS, "VM-gahp server reported an internal error\n"); if( numOfRunningVM() == 0 ) { // There is no running VM job. // So test vm universe right now. docheckVMUniverse(); return; } // There are running VM jobs. // We need to wait for all jobs to be finished // When all jobs are finished, we will call docheckVMUniverse function m_needCheck = true; }
void VMUniverseMgr::checkVMUniverse( bool warn ) { // This might be better as detect, where detect never sets m_needCheck // because it should be an error for there to be running VMs on startup. if( warn ) { dprintf( D_ALWAYS, "VM-gahp server reported an internal error\n"); } if( numOfRunningVM() == 0 ) { // There is no running VM job. // So test vm universe right now. docheckVMUniverse(); return; } // There are running VM jobs. // We need to wait for all jobs to be finished // When all jobs are finished, we will call docheckVMUniverse function m_needCheck = true; }