Пример #1
0
 private function removeLogicalVolumes(EtvaNode $etva_node, $server_lvs = null)
 {
     if (!$server_lvs) {
         $server_lvs = $this->etva_server->getEtvaLogicalvolumes();
     }
     foreach ($server_lvs as $logicalvol) {
         $node = $etva_node;
         if ($logicalvol->getStorageType() != EtvaLogicalvolume::STORAGE_TYPE_LOCAL_MAP) {
             $node = EtvaNodePeer::ElectNode($etva_node);
         }
         $lvdevice = $logicalvol->getLvdevice();
         $etva_vg = $logicalvol->getEtvaVolumegroup();
         $vgname = $etva_vg->getVg();
         // send soap request
         $response = $node->soapSend(EtvaLogicalvolume_VA::LVREMOVE, array('lv' => $lvdevice, 'vg' => $vgname));
         if (!$response['success']) {
             Etva::makeNotifyLogMessage($response['agent'], EtvaLogicalvolumePeer::_ERR_REMOVE_, array('name' => $logicalvol->getLv(), 'info' => $response['info']), ServerPeer::_ERR_REMOVE_, array('%name%' => $this->etva_server->getName()));
         }
     }
 }
Пример #2
0
 public static function getOrElectNodeFromArray($arguments)
 {
     // get parameters
     $nid = isset($arguments['node']) ? $arguments['node'] : null;
     $cid = isset($arguments['cluster']) ? $arguments['cluster'] : null;
     $level = isset($arguments['level']) ? $arguments['level'] : null;
     $vg = isset($arguments['volumegroup']) ? $arguments['volumegroup'] : null;
     $dev = isset($arguments['device']) ? $arguments['device'] : null;
     $lv = isset($arguments['logicalvolume']) ? $arguments['logicalvolume'] : null;
     // check level - back compatibility
     if (!$level) {
         $level = 'node';
     }
     if ($level == 'cluster') {
         $etva_cluster = EtvaClusterPeer::retrieveByPK($cid);
         return EtvaNode::getFirstActiveNode($etva_cluster);
     } elseif ($level == 'node') {
         $etva_node = EtvaNodePeer::retrieveByPK($nid);
         if ($lv) {
             $c = new Criteria();
             $c->add(EtvaLogicalvolumePeer::STORAGE_TYPE, EtvaLogicalvolume::STORAGE_TYPE_LOCAL_MAP, Criteria::ALT_NOT_EQUAL);
             $etva_lv = EtvaLogicalvolumePeer::retrieveByLv($lv, $c);
             return $etva_lv ? EtvaNodePeer::ElectNode($etva_node) : $etva_node;
         } elseif ($dev) {
             $c = new Criteria();
             $c->add(EtvaPhysicalvolumePeer::STORAGE_TYPE, EtvaPhysicalvolume::STORAGE_TYPE_LOCAL_MAP, Criteria::ALT_NOT_EQUAL);
             $etva_pv = EtvaPhysicalvolumePeer::retrieveByDevice($dev, $c);
             return $etva_pv ? EtvaNodePeer::ElectNode($etva_node) : $etva_node;
         } elseif ($vg) {
             $c = new Criteria();
             $c->add(EtvaVolumeGroupPeer::STORAGE_TYPE, EtvaVolumeGroup::STORAGE_TYPE_LOCAL_MAP, Criteria::ALT_NOT_EQUAL);
             $etva_vg = EtvaVolumegroupPeer::retrieveByVg($vg, $c);
             return $etva_vg ? EtvaNodePeer::ElectNode($etva_node) : $etva_node;
         } else {
             return $etva_node;
         }
     }
 }