Scalr_Role_Behavior::getListForFarmRole PHP Method

getListForFarmRole() public static method

..
public static getListForFarmRole ( DBFarmRole $farmRole ) : Scalr_Role_Behavior[]
$farmRole DBFarmRole
return Scalr_Role_Behavior[]
    public static function getListForFarmRole(DBFarmRole $farmRole)
    {
        return self::getListForRole($farmRole->GetRoleObject());
    }

Usage Example

Esempio n. 1
0
 public function OnHostDown(\HostDownEvent $event)
 {
     $dbServer = $event->DBServer;
     if ($dbServer->farmRoleId != 0) {
         try {
             $dbFarmRole = $dbServer->GetFarmRoleObject();
         } catch (\Exception $e) {
             return false;
         }
         foreach (\Scalr_Role_Behavior::getListForFarmRole($dbFarmRole) as $bObj) {
             $bObj->onHostDown($dbServer, $event);
         }
         //Storage
         if (!$event->isSuspended) {
             try {
                 $storage = new FarmRoleStorage($dbFarmRole);
                 $storageConfigs = $storage->getConfigs();
                 if (empty($storageConfigs)) {
                     return true;
                 }
                 foreach ($storageConfigs as $config) {
                     //Check for existing volume
                     $dbVolume = FarmRoleStorageDevice::getByConfigIdAndIndex($config->id, $dbServer->index);
                     if ($dbVolume && !$config->reUse) {
                         $dbVolume->status = FarmRoleStorageDevice::STATUS_ZOMBY;
                         $dbVolume->save();
                     }
                 }
             } catch (\Exception $e) {
                 $this->logger->error(new \FarmLogMessage($dbServer, "Marking storage for disposal failed: {$e->getMessage()}"));
             }
         }
     }
 }
All Usage Examples Of Scalr_Role_Behavior::getListForFarmRole