本文整理汇总了PHP中DBFarmRole::isOpenstack方法的典型用法代码示例。如果您正苦于以下问题:PHP DBFarmRole::isOpenstack方法的具体用法?PHP DBFarmRole::isOpenstack怎么用?PHP DBFarmRole::isOpenstack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBFarmRole
的用法示例。
在下文中一共展示了DBFarmRole::isOpenstack方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
break;
}
}
return $volumeConfig;
}
示例2: 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);
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);
} 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);
if ($volumeConfig->volumeType == 'io1') {
$volumeConfig->iops = $this->dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_EBS_IOPS);
}
}
}
}
}
return $volumeConfig;
}