public function retrieveLogicalvolumeByUuid($uuid) { $criteria = new Criteria(); $criteria->add(EtvaNodeLogicalvolumePeer::NODE_ID, $this->getId()); $criteria->addJoin(EtvaNodeLogicalvolumePeer::LOGICALVOLUME_ID, EtvaLogicalvolumePeer::ID); $criteria->add(EtvaLogicalvolumePeer::UUID, $uuid); return EtvaLogicalvolumePeer::doSelectOne($criteria); }
protected function check_lvs(EtvaNode $etva_node) { $node_response = $etva_node->soapSend('getlvs_arr', array('force' => 1)); if (!$node_response['success']) { $errors = $node_response['error']; Etva::getLogMessage(array('info' => ''), EtvaLogicalvolumePeer::_ERR_INCONSISTENT_); $etva_node->setErrorMessage(EtvaLogicalvolume_VA::LVINIT); $message = Etva::getLogMessage(array('info' => $node_response['info']), EtvaLogicalvolumePeer::_ERR_SOAPUPDATE_); sfContext::getInstance()->getEventDispatcher()->notify(new sfEvent($etva_node->getName(), 'event.log', array('message' => $message, 'priority' => EtvaEventLogger::ERR))); $response = array('success' => false, 'error' => $errors); $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_lvs = $node_response['response']; $my_lvs = (array) $my_lvs; foreach ($my_lvs as $my_lv) { $lv_info = (array) $my_lv; if ($lv_info['type'] == EtvaLogicalvolume::STORAGE_TYPE_LOCAL_MAP) { continue; } $c_uuid = new criteria(); $c_uuid->add(EtvaLogicalvolumePeer::UUID, $lv_info['uuid']); $c_uuid->addAnd(EtvaLogicalvolumePeer::CLUSTER_ID, $cluster_id, Criteria::NOT_EQUAL); $e_lv = EtvaLogicalvolumePeer::doSelectOne($c_uuid); if ($e_lv) { $c_c = new Criteria(); $c_c->add(EtvaClusterPeer::ID, $e_lv->getClusterId()); $etva_cluster = EtvaClusterPeer::doSelectOne($c_c); $msg_i18n = $this->getContext()->getI18N()->__(EtvaLogicalvolumePeer::_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); } } }