Beispiel #1
0
 public function restore_ok($uuid, $ok)
 {
     $c = new Criteria();
     $c->add(EtvaNodePeer::UUID, $uuid);
     $etva_node = EtvaNodePeer::doSelectOne($c);
     $ok_array = (array) $ok;
     $message = 'Node restore ok';
     //notify system log
     sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($etva_node->getName(), 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::INFO)));
     /*
      * check if is an appliance restore operation...it should be...
      */
     $apli = new Appliance();
     $action = $apli->getStage(Appliance::RESTORE_STAGE);
     if ($action) {
         $apli->setStage(Appliance::RESTORE_STAGE, Appliance::VA_COMPLETED);
         $apli->disable(false);
     }
     // remove backup VA file
     $apli->del_backupconf_file(Appliance::VA_ARCHIVE_FILE, $etva_node->getUuid(), 'VA');
     return array('success' => true);
 }
Beispiel #2
0
 public function executeSoapRestore(sfWebRequest $request)
 {
     if (sfConfig::get('sf_environment') == 'soap') {
         $macaddr = $request->getParameter('macaddr');
         $ok = $request->getParameter('ok');
         /*
          * restore ok...
          */
         $c = new Criteria();
         $c->add(EtvaNetworkPeer::MAC, $macaddr);
         $etva_network = EtvaNetworkPeer::doSelectOne($c);
         if (!$etva_network) {
             $error_msg = sprintf('Object etva_network does not exist (%s).', $macaddr);
             $error = array('success' => false, 'error' => $error_msg);
             return $error;
         }
         $etva_server = $etva_network->getEtvaServer();
         $agent = $etva_server->getAgentTmpl();
         $message = "MA {$agent} restore ok";
         //notify system log
         sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($etva_server->getName(), 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::INFO)));
         /*
          * check if is an appliance restore operation...it should be...
          */
         $apli = new Appliance();
         $action = $apli->getStage(Appliance::RESTORE_STAGE);
         if ($action) {
             $apli->setStage(Appliance::RESTORE_STAGE, Appliance::MA_COMPLETED);
         }
         // remove backup MA file
         $apli->del_backupconf_file(Appliance::MA_ARCHIVE_FILE, $etva_server->getUuid(), $etva_server->getAgentTmpl());
         return array('success' => true);
     }
 }