Scalr\Modules\PlatformFactory::getOpenstackBasedPlatforms PHP Method

getOpenstackBasedPlatforms() public static method

Gets the list of OpenStack based clouds
public static getOpenstackBasedPlatforms ( ) : array
return array Returns the list of OpenStack based clouds
    public static function getOpenstackBasedPlatforms()
    {
        return array(SERVER_PLATFORMS::OPENSTACK, SERVER_PLATFORMS::OCS, SERVER_PLATFORMS::NEBULA, SERVER_PLATFORMS::MIRANTIS, SERVER_PLATFORMS::VIO, SERVER_PLATFORMS::VERIZON, SERVER_PLATFORMS::CISCO, SERVER_PLATFORMS::HPCLOUD, SERVER_PLATFORMS::RACKSPACENG_UK, SERVER_PLATFORMS::RACKSPACENG_US);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Performs upgrade literally for the stage ONE.
  *
  * Implementation of this method performs update steps needs to be taken
  * to accomplish upgrade successfully.
  *
  * If there are any error during an execution of this scenario it must
  * throw an exception.
  *
  * @param   int  $stage  optional The stage number
  * @throws  \Exception
  */
 protected function run1($stage)
 {
     $environments = $this->db->Execute("SELECT id FROM client_environments WHERE status='Active'");
     while ($env = $environments->FetchRow()) {
         $environment = \Scalr_Environment::init()->loadById($env['id']);
         foreach (PlatformFactory::getOpenstackBasedPlatforms() as $platform) {
             if ($platform == \SERVER_PLATFORMS::RACKSPACENG_UK || $platform == \SERVER_PLATFORMS::RACKSPACENG_US) {
                 continue;
             }
             try {
                 if ($environment->isPlatformEnabled($platform)) {
                     $os = $environment->openstack($platform);
                     //It throws an exception on failure
                     $zones = $os->listZones();
                     $zone = array_shift($zones);
                     $os = $environment->openstack($platform, $zone->name);
                     // Check SG Extension
                     $pars[$this->getOpenStackOption($platform, 'EXT_SECURITYGROUPS_ENABLED')] = (int) $os->servers->isExtensionSupported(ServersExtension::securityGroups());
                     // Check Floating Ips Extension
                     $pars[$this->getOpenStackOption($platform, 'EXT_FLOATING_IPS_ENABLED')] = (int) $os->servers->isExtensionSupported(ServersExtension::floatingIps());
                     // Check Cinder Extension
                     $pars[$this->getOpenStackOption($platform, 'EXT_CINDER_ENABLED')] = (int) $os->hasService('volume');
                     // Check Swift Extension
                     $pars[$this->getOpenStackOption($platform, 'EXT_SWIFT_ENABLED')] = (int) $os->hasService('object-store');
                     // Check LBaas Extension
                     $pars[$this->getOpenStackOption($platform, 'EXT_LBAAS_ENABLED')] = $os->hasService('network') ? (int) $os->network->isExtensionSupported('lbaas') : 0;
                     $environment->setPlatformConfig($pars);
                 }
             } catch (\Exception $e) {
                 $this->console->out("Update settings for env: {$env['id']} failed: " . $e->getMessage());
             }
         }
     }
 }
All Usage Examples Of Scalr\Modules\PlatformFactory::getOpenstackBasedPlatforms