public function send_unassign(EtvaNode $etva_node) { $etva_server = $this->etva_server; $etva_server->setUnassigned(1); // mark server as unassigned $params = $etva_server->_VA(); // remove vm from source $params = array('uuid' => $etva_server->getUuid(), 'keep_fs' => 1); $response = $etva_node->soapSend(self::SERVER_REMOVE, $params); if (!$response['success']) { $result = $response; $msg_i18n = sfContext::getInstance()->getI18N()->__(EtvaServerPeer::_ERR_UNASSIGNED_, array('%name%' => $server_name, '%info%' => $response['info'], '%node%' => $etva_node->getName())); $result['error'] = $msg_i18n; //notify event log $message = Etva::getLogMessage(array('name' => $server_name, 'node' => $etva_node->getName(), 'info' => $response['info']), EtvaServerPeer::_ERR_UNASSIGNED_); sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($response['agent'], 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::ERR))); return $result; } //update agent free memory only if is running if ($etva_server->isRunning()) { $cur_avail = $etva_node->getMemfree(); $cur_free = $cur_avail - Etva::MB_to_Byteconvert($etva_server->getMem()); $etva_node->setMemfree($cur_free); $etva_node->save(); } // force the server to stop $etva_server->setVmState(EtvaServer::STATE_STOP); $etva_server->setState(0); $etva_server->save(); $msg_i18n = sfContext::getInstance()->getI18N()->__(EtvaServerPeer::_OK_UNASSIGNED_, array('%name%' => $etva_server->getName(), '%node%' => $etva_node->getName())); $result = array('success' => true, 'agent' => $response['agent'], 'response' => $msg_i18n); //notify event log $message = Etva::getLogMessage(array('name' => $etva_server->getName(), 'node' => $etva_node->getName()), EtvaServerPeer::_OK_UNASSIGNED_); sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($response['agent'], 'event.log', array('message' => $message))); return $result; }