示例#1
0
 public function executeJsonTestFencing(sfWebRequest $request)
 {
     // create node entry
     $id = $request->getParameter('id');
     if (!($etva_node = EtvaNodePeer::retrieveByPk($id))) {
         return $this->_makeReturnErrorWithNotify(sfConfig::get('config_acronym'), EtvaNodePeer::_ERR_NOTFOUND_ID_, array('id' => $id));
     }
     $fencingconf = $request->getParameter('fencingconf');
     $fencingconf_cmd = $etva_node->getFencingconf_cmd('status', $fencingconf);
     error_log("getFencingconf_cmd " . print_r($fencingconf_cmd, true));
     $command = $fencingconf_cmd;
     error_log("fencingconf_cmd = " . $fencingconf_cmd);
     $path = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . "utils";
     error_log("[INFO] PATH TO SUDOEXEC " . $path . DIRECTORY_SEPARATOR);
     ob_start();
     passthru('echo "' . $command . ' 2>&1 " | sudo /usr/bin/php -f ' . $path . DIRECTORY_SEPARATOR . 'sudoexec.php', $return);
     $result = ob_get_contents();
     # get message
     ob_end_clean();
     if ($return != 0) {
         return $this->_makeReturnErrorWithNotify(sfConfig::get('config_acronym'), 'You get an error executing fencing test with output: %debug%.', array('name' => $etva_node->getName(), 'conf' => $fencingconf, 'cmd' => print_r($fencingconf_cmd, true), 'debug' => $result));
     } else {
         return $this->_makeReturnOKWithNotify($etva_node->getName(), 'Node %name% successfully tested.', array('name' => $etva_node->getName(), 'conf' => $fencingconf, 'cmd' => print_r($fencingconf_cmd, true)));
     }
 }
示例#2
0
 public function executeWizard(sfWebRequest $request)
 {
     $disk_vg = '';
     $this->etva_node = EtvaNodePeer::retrieveByPk($request->getParameter('nid'));
     $etva_cluster = $this->etva_node->getEtvaCluster();
     $this->diskfile = $etva_cluster->countEtvaPhysicalvolumes() > 0 ? false : true;
     $c = new Criteria();
     $c->add(EtvaVolumegroupPeer::VG, sfConfig::get('app_volgroup_disk_flag'));
     $disk_vgs = $this->etva_node->getEtvaNodeVolumegroupsJoinEtvaVolumegroup($c);
     if ($disk_vgs && !$disk_vgs->isEmpty()) {
         $disk_vg = $disk_vgs[0]->getEtvaVolumegroup();
     }
     //if(!$disk_vg) return sfView::NONE;
     $this->max_size_diskfile = $disk_vg ? $disk_vg->getFreesize() : 0;
     // remove session macs for cleanup the wizard
     $this->getUser()->getAttributeHolder()->remove('macs_in_wizard');
 }