示例#1
0
 private function check_pvs(EtvaNode $etva_node)
 {
     $node_response = $etva_node->soapSend('getpvs_arr', array('force' => 1));
     if (!$node_response['success']) {
         $errors = $node_response['error'];
         Etva::getLogMessage(array('info' => ''), EtvaPhysicalvolumePeer::_ERR_INCONSISTENT_);
         //$etva_node->setErrorMessage(EtvaPhysicalvolume_VA::LVINIT);
         $message = $this->getContext()->getI18N()->__(EtvaPhysicalvolumePeer::_ERR_SOAPUPDATE_, array('%info%' => $node_response['info']));
         sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($etva_node->getName(), 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::ERR)));
         $response = array('success' => false, 'error' => $message, 'agent' => $etva_node->getName());
         $return = $this->setJsonError($response);
         return $this->renderText($return);
     }
     //verify if cluster has any logical volume that belongs to another cluster...
     $cluster_id = $etva_node->getClusterId();
     $my_pvs = $node_response['response'];
     $my_pvs = (array) $my_pvs;
     foreach ($my_pvs as $my_pv) {
         $pv_info = (array) $my_pv;
         if ($pv_info['type'] == EtvaPhysicalvolume::STORAGE_TYPE_LOCAL_MAP) {
             continue;
         }
         $c_uuid = new criteria();
         $c_uuid->add(EtvaPhysicalvolumePeer::UUID, $pv_info['uuid']);
         $c_uuid->addAnd(EtvaPhysicalvolumePeer::CLUSTER_ID, $cluster_id, Criteria::NOT_EQUAL);
         $e_pv = EtvaPhysicalvolumePeer::doSelectOne($c_uuid);
         if ($e_pv) {
             $c_c = new Criteria();
             $c_c->add(EtvaClusterPeer::ID, $e_pv->getClusterId());
             $etva_cluster = EtvaClusterPeer::doSelectOne($c_c);
             $msg_i18n = $this->getContext()->getI18N()->__(EtvaPhysicalvolumePeer::_ERR_INIT_OTHER_CLUSTER_, array('%name%' => $etva_cluster->getName()));
             $response = array('success' => false, 'agent' => sfConfig::get('config_acronym'), 'error' => $msg_i18n, 'info' => $msg_i18n);
             $return = $this->setJsonError($response);
             return $this->renderText($return);
         }
     }
 }