当前位置: 首页>>代码示例>>PHP>>正文


PHP DBServer::getAwsTags方法代码示例

本文整理汇总了PHP中DBServer::getAwsTags方法的典型用法代码示例。如果您正苦于以下问题:PHP DBServer::getAwsTags方法的具体用法?PHP DBServer::getAwsTags怎么用?PHP DBServer::getAwsTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBServer的用法示例。


在下文中一共展示了DBServer::getAwsTags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getVolumeConfig

 public function getVolumeConfig(DBFarmRole $dbFarmRole, DBServer $dbServer)
 {
     try {
         $volume = Scalr_Storage_Volume::init()->loadByFarmRoleServer($dbFarmRole->ID, $dbServer->index, $this->behavior);
         $volumeConfig = $volume->getConfig();
     } catch (Exception $e) {
     }
     if (!$volumeConfig) {
         $volumeConfig = new stdClass();
         $volumeConfig->type = $dbFarmRole->GetSetting(static::ROLE_DATA_STORAGE_ENGINE);
         switch ($volumeConfig->type) {
             case MYSQL_STORAGE_ENGINE::EPH:
                 if ($dbFarmRole->Platform == SERVER_PLATFORMS::RACKSPACE) {
                     $storageProvider = 'cf';
                     $volumeConfig->disk = new stdClass();
                     $volumeConfig->disk->type = 'loop';
                     $volumeConfig->disk->size = '75%root';
                 } elseif ($dbFarmRole->isOpenstack()) {
                     $storageProvider = 'swift';
                     $volumeConfig->disk = new stdClass();
                     $volumeConfig->disk->type = 'loop';
                     $volumeConfig->disk->size = '75%root';
                 } elseif ($dbFarmRole->Platform == SERVER_PLATFORMS::GCE) {
                     $storageProvider = 'gcs';
                     $volumeConfig->disk = array('type' => 'gce_ephemeral', 'name' => 'ephemeral-disk-0');
                     $volumeConfig->size = "80%";
                 } elseif ($dbFarmRole->Platform == SERVER_PLATFORMS::EC2) {
                     /*
                      * NOT SUPPORTED
                     $storageProvider = 's3';
                     
                     $volumeConfig->disk = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EPH_DISK);
                     $volumeConfig->size = "80%";
                     */
                 }
                 $volumeConfig->snap_backend = sprintf("%s://scalr-%s-%s/data-bundles/%s/%s", $storageProvider, $dbFarmRole->GetFarmObject()->EnvID, $dbFarmRole->CloudLocation, $dbFarmRole->FarmID, $this->behavior);
                 $volumeConfig->vg = $this->behavior;
                 break;
             default:
                 $volumeConfig->size = $dbFarmRole->GetSetting(static::ROLE_DATA_STORAGE_EBS_SIZE);
                 $volumeConfig->tags = $dbServer->getAwsTags();
                 break;
         }
     }
     return $volumeConfig;
 }
开发者ID:mheydt,项目名称:scalr,代码行数:46,代码来源:RabbitMQ.php

示例2: getVolumesConfigs

 public function getVolumesConfigs(\DBServer $dbServer, $isHostInit = true)
 {
     $volumes = array();
     $configs = $this->getConfigs();
     foreach ($configs as $config) {
         //Check for existing volume
         $createFreshConfig = true;
         $volume = null;
         $dbVolume = FarmRoleStorageDevice::getByConfigIdAndIndex($config->id, $dbServer->index);
         if ($dbVolume) {
             $volume = $dbVolume->config;
             $createFreshConfig = false;
             $volume->mpoint = $config->mount == 1 ? $config->mountPoint : null;
         }
         if ($createFreshConfig || $config->rebuild) {
             $volumeConfigTemplate = new \stdClass();
             $volumeConfigTemplate->scalrStorageId = $config->id;
             $volumeConfigTemplate->type = stristr($config->type, "raid.") ? FarmRoleStorageConfig::TYPE_RAID : $config->type;
             $volumeConfigTemplate->fstype = $config->fs;
             $volumeConfigTemplate->mpoint = $config->mount == 1 ? $config->mountPoint : null;
             if ($config->fs == 'ntfs' && $config->mount == 1 && !empty($config->label)) {
                 $volumeConfigTemplate->label = $config->label;
             }
             switch ($config->type) {
                 case FarmRoleStorageConfig::TYPE_EC2_EPHEMERAL:
                     $volumeConfigTemplate->name = $config->settings[FarmRoleStorageConfig::SETTING_EC2_EPHEMERAL_NAME];
                     $volumeConfigTemplate->size = $config->settings[FarmRoleStorageConfig::SETTING_EC2_EPHEMERAL_SIZE];
                     break;
                 case FarmRoleStorageConfig::TYPE_GCE_EPHEMERAL:
                     $volumeConfigTemplate->size = $config->settings[FarmRoleStorageConfig::SETTING_GCE_EPHEMERAL_SIZE];
                     $volumeConfigTemplate->name = $config->settings[FarmRoleStorageConfig::SETTING_GCE_EPHEMERAL_NAME];
                     break;
                 case FarmRoleStorageConfig::TYPE_CINDER:
                     $volumeConfigTemplate->size = $config->settings[FarmRoleStorageConfig::SETTING_CINDER_SIZE];
                     if ($config->settings[FarmRoleStorageConfig::SETTING_CINDER_VOLUME_TYPE]) {
                         $volumeConfigTemplate->volumeType = $config->settings[FarmRoleStorageConfig::SETTING_CINDER_VOLUME_TYPE];
                     }
                     // SNAPSHOT
                     if ($config->settings[FarmRoleStorageConfig::SETTING_CINDER_SNAPSHOT] != '') {
                         $volumeConfigTemplate->snap = new \stdClass();
                         $volumeConfigTemplate->snap->type = FarmRoleStorageConfig::TYPE_CINDER;
                         $volumeConfigTemplate->snap->id = $config->settings[FarmRoleStorageConfig::SETTING_CINDER_SNAPSHOT];
                     }
                     break;
                 case FarmRoleStorageConfig::TYPE_CSVOL:
                     $volumeConfigTemplate->diskOfferingId = $config->settings[FarmRoleStorageConfig::SETTING_CSVOL_DISK_OFFERING];
                     $volumeConfigTemplate->diskOfferingType = $config->settings[FarmRoleStorageConfig::SETTING_CSVOL_DISK_OFFERING_TYPE];
                     if ($volumeConfigTemplate->diskOfferingType == 'custom' || !$volumeConfigTemplate->diskOfferingId) {
                         $volumeConfigTemplate->size = $config->settings[FarmRoleStorageConfig::SETTING_CSVOL_SIZE];
                     }
                     // SNAPSHOT
                     if ($config->settings[FarmRoleStorageConfig::SETTING_CSVOL_SNAPSHOT] != '') {
                         $volumeConfigTemplate->snap = new \stdClass();
                         $volumeConfigTemplate->snap->type = FarmRoleStorageConfig::TYPE_CSVOL;
                         $volumeConfigTemplate->snap->id = $config->settings[FarmRoleStorageConfig::SETTING_CSVOL_SNAPSHOT];
                     }
                     break;
                 case FarmRoleStorageConfig::TYPE_GCE_PD:
                     $volumeConfigTemplate->size = $config->settings[FarmRoleStorageConfig::SETTING_GCE_PD_SIZE];
                     if ($config->settings[FarmRoleStorageConfig::SETTING_GCE_PD_TYPE]) {
                         $volumeConfigTemplate->diskType = $config->settings[FarmRoleStorageConfig::SETTING_GCE_PD_TYPE];
                     }
                     // SNAPSHOT
                     if ($config->settings[FarmRoleStorageConfig::SETTING_GCE_PD_SNAPSHOT] != '') {
                         $volumeConfigTemplate->snap = new \stdClass();
                         $volumeConfigTemplate->snap->type = FarmRoleStorageConfig::TYPE_GCE_PD;
                         $volumeConfigTemplate->snap->id = $config->settings[FarmRoleStorageConfig::SETTING_GCE_PD_SNAPSHOT];
                     }
                     break;
                 case FarmRoleStorageConfig::TYPE_EBS:
                     $volumeConfigTemplate->size = $config->settings[FarmRoleStorageConfig::SETTING_EBS_SIZE];
                     $volumeConfigTemplate->encrypted = !empty($config->settings[FarmRoleStorageConfig::SETTING_EBS_ENCRYPTED]) ? 1 : 0;
                     $volumeConfigTemplate->tags = $dbServer->getAwsTags();
                     // IOPS
                     $volumeConfigTemplate->volumeType = $config->settings[FarmRoleStorageConfig::SETTING_EBS_TYPE];
                     if ($volumeConfigTemplate->volumeType == 'io1') {
                         $volumeConfigTemplate->iops = $config->settings[FarmRoleStorageConfig::SETTING_EBS_IOPS];
                     }
                     if ($config->settings[FarmRoleStorageConfig::SETTING_EBS_KMS_KEY_ID]) {
                         $volumeConfigTemplate->kmsKeyId = $config->settings[FarmRoleStorageConfig::SETTING_EBS_KMS_KEY_ID];
                     }
                     // SNAPSHOT
                     if ($config->settings[FarmRoleStorageConfig::SETTING_EBS_SNAPSHOT] != '') {
                         $volumeConfigTemplate->snap = new \stdClass();
                         $volumeConfigTemplate->snap->type = FarmRoleStorageConfig::TYPE_EBS;
                         $volumeConfigTemplate->snap->id = $config->settings[FarmRoleStorageConfig::SETTING_EBS_SNAPSHOT];
                     }
                     break;
                 case FarmRoleStorageConfig::TYPE_RAID_CSVOL:
                 case FarmRoleStorageConfig::TYPE_RAID_CINDER:
                 case FarmRoleStorageConfig::TYPE_RAID_EBS:
                 case FarmRoleStorageConfig::TYPE_RAID_GCE_PD:
                     $volumeConfigTemplate->level = $config->settings[FarmRoleStorageConfig::SETTING_RAID_LEVEL];
                     $volumeConfigTemplate->vg = $config->id;
                     $volumeConfigTemplate->disks = array();
                     for ($i = 1; $i <= $config->settings[FarmRoleStorageConfig::SETTING_RAID_VOLUMES_COUNT]; $i++) {
                         $disk = new \stdClass();
                         if ($config->type == FarmRoleStorageConfig::TYPE_RAID_EBS) {
                             $disk->size = $config->settings[FarmRoleStorageConfig::SETTING_EBS_SIZE];
                             $disk->encrypted = !empty($config->settings[FarmRoleStorageConfig::SETTING_EBS_ENCRYPTED]) ? 1 : 0;
//.........这里部分代码省略.........
开发者ID:mheydt,项目名称:scalr,代码行数:101,代码来源:FarmRoleStorage.php

示例3: getFreshVolumeConfig

 protected function getFreshVolumeConfig()
 {
     $volumeConfig = new stdClass();
     $volumeConfig->type = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_ENGINE);
     $fsType = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_FSTYPE);
     if ($fsType) {
         $volumeConfig->fstype = $fsType;
     }
     $type = $volumeConfig->type;
     // For any Block storage APIs
     if (in_array($volumeConfig->type, array(MYSQL_STORAGE_ENGINE::RAID_EBS, MYSQL_STORAGE_ENGINE::RAID_GCE_PERSISTENT))) {
         $volumeConfig->type = 'raid';
         $volumeConfig->vg = $this->databaseType;
         $volumeConfig->level = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_RAID_LEVEL);
         $volumeConfig->disks = array();
         for ($i = 1; $i <= $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_RAID_DISKS_COUNT); $i++) {
             $dsk = new stdClass();
             $dsk->size = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_RAID_DISK_SIZE);
             if ($type == MYSQL_STORAGE_ENGINE::RAID_EBS) {
                 $dsk->type = MYSQL_STORAGE_ENGINE::EBS;
             } else {
                 if ($type == MYSQL_STORAGE_ENGINE::RAID_GCE_PERSISTENT) {
                     $dsk->type = MYSQL_STORAGE_ENGINE::GCE_PERSISTENT;
                 }
             }
             $dsk->volumeType = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_RAID_EBS_DISK_TYPE);
             $dsk->tags = $this->dbServer->getAwsTags();
             if ($dsk->volumeType == 'io1') {
                 $dsk->iops = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_RAID_EBS_DISK_IOPS);
             }
             $volumeConfig->disks[] = $dsk;
         }
         $volumeConfig->snapPv = new stdClass();
         $volumeConfig->snapPv->type = $dsk->type;
         $volumeConfig->snapPv->size = 1;
     } else {
         if ($volumeConfig->type == MYSQL_STORAGE_ENGINE::CINDER) {
             $volumeConfig->size = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_CINDER_SIZE);
         } else {
             if ($volumeConfig->type == MYSQL_STORAGE_ENGINE::GCE_PERSISTENT) {
                 $volumeConfig->size = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_GCED_SIZE);
                 $volumeConfig->diskType = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_GCED_TYPE);
             } else {
                 if ($volumeConfig->type == MYSQL_STORAGE_ENGINE::EPH) {
                     if ($this->dbFarmRole->Platform == SERVER_PLATFORMS::RACKSPACE) {
                         $storageProvider = 'cf';
                         $volumeConfig->disk = new stdClass();
                         $volumeConfig->disk->type = 'loop';
                         $volumeConfig->disk->size = '75%root';
                     } elseif ($this->dbFarmRole->isOpenstack()) {
                         $storageProvider = 'swift';
                         $volumeConfig->disk = new stdClass();
                         $volumeConfig->disk->type = 'loop';
                         $volumeConfig->disk->size = '75%root';
                     } elseif ($this->dbFarmRole->Platform == SERVER_PLATFORMS::GCE) {
                         $storageProvider = 'gcs';
                         $volumeConfig->disk = array('type' => 'gce_ephemeral', 'name' => 'ephemeral-disk-0');
                         $volumeConfig->size = "80%";
                     } elseif ($this->dbFarmRole->Platform == SERVER_PLATFORMS::EC2) {
                         $storageProvider = 's3';
                         $disk = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EPH_DISK);
                         if ($disk) {
                             $volumeConfig->disk = $disk;
                         } else {
                             $disks = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EPH_DISKS);
                             if ($disks) {
                                 $diskType = 'ec2_ephemeral';
                                 $v = json_decode($disks);
                                 foreach ($v as $name => $size) {
                                     $volumeConfig->disks[] = array('type' => $diskType, 'name' => $name);
                                 }
                             }
                         }
                         $volumeConfig->size = "80%";
                     }
                     $volumeConfig->snap_backend = sprintf("%s://scalr-%s-%s/data-bundles/%s/%s", $storageProvider, $this->dbFarmRole->GetFarmObject()->EnvID, $this->dbFarmRole->CloudLocation, $this->dbFarmRole->FarmID, $this->databaseType);
                     $volumeConfig->vg = $this->databaseType;
                 } else {
                     $volumeConfig->size = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EBS_SIZE);
                     $volumeConfig->volumeType = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EBS_TYPE);
                     $volumeConfig->encrypted = (int) $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EBS_ENCRYPTED);
                     $volumeConfig->tags = $this->dbServer->getAwsTags();
                     if ($volumeConfig->volumeType == 'io1') {
                         $volumeConfig->iops = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EBS_IOPS);
                     }
                 }
             }
         }
     }
     return $volumeConfig;
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:91,代码来源:Info.php


注:本文中的DBServer::getAwsTags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。