本文整理汇总了PHP中Scalr_Role_Behavior::extendMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Scalr_Role_Behavior::extendMessage方法的具体用法?PHP Scalr_Role_Behavior::extendMessage怎么用?PHP Scalr_Role_Behavior::extendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scalr_Role_Behavior
的用法示例。
在下文中一共展示了Scalr_Role_Behavior::extendMessage方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->router = $this->getConfiguration($dbServer);
}
return $message;
}
示例2: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->cfCloudController = new stdClass();
$message->cfCloudController->volumeConfig = $this->getVolumeConfig($dbServer->GetFarmRoleObject(), $dbServer);
break;
}
return $message;
}
示例3: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->rabbitmq = new stdClass();
$message->rabbitmq->cookie = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_COOKIE_NAME);
$message->rabbitmq->volumeConfig = $this->getVolumeConfig($dbServer->GetFarmRoleObject(), $dbServer);
$message->rabbitmq->nodeType = $this->getNodeType($dbServer->GetFarmRoleObject(), $dbServer);
$message->rabbitmq->password = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_PASSWORD);
$dbServer->SetProperty(self::SERVER_NODE_TYPE, $message->rabbitmq->nodeType);
break;
}
return $message;
}
示例4: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message);
try {
$dbFarmRole = $dbServer->GetFarmRoleObject();
} catch (Exception $e) {
}
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$dbMsrInfo = Scalr_Db_Msr_Info::init($dbFarmRole, $dbServer, $this->behavior);
$message->addDbMsrInfo($dbMsrInfo);
break;
case "Scalr_Messaging_Msg_DbMsr_PromoteToMaster":
$dbMsrInfo = Scalr_Db_Msr_Info::init($dbFarmRole, $dbServer, $this->behavior);
$message->addDbMsrInfo($dbMsrInfo);
break;
case "Scalr_Messaging_Msg_DbMsr_NewMasterUp":
$dbMsrInfo = Scalr_Db_Msr_Info::init($dbFarmRole, $dbServer, $this->behavior);
$message->addDbMsrInfo($dbMsrInfo);
break;
}
return $message;
}
示例5: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->mongodb = $this->getConfiguration($dbServer);
break;
case "Scalr_Messaging_Msg_HostDown":
case "Scalr_Messaging_Msg_HostUp":
case "Scalr_Messaging_Msg_HostInit":
case "Scalr_Messaging_Msg_BeforeHostTerminate":
$message->mongodb = new stdClass();
$message->mongodb->replicaSetIndex = $dbServer->GetProperty(self::SERVER_REPLICA_SET_INDEX);
$message->mongodb->shardIndex = $dbServer->GetProperty(self::SERVER_SHARD_INDEX);
break;
}
return $message;
}
示例6: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
try {
$dbFarmRole = $dbServer->GetFarmRoleObject();
$storageType = $dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_ENGINE);
$storageGeneration = $storageType == 'lvm' ? 2 : 1;
} catch (Exception $e) {
}
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$dbMsrInfo = Scalr_Db_Msr_Info::init($dbFarmRole, $dbServer, $this->behavior);
$message->addDbMsrInfo($dbMsrInfo);
$config = $dbFarmRole->GetServiceConfiguration2($this->behavior);
if (!empty($config)) {
$message->{$this->behavior}->preset = array();
foreach ($config as $filename => $cfg) {
$file = new stdClass();
$file->file = new stdClass();
$file->file->name = $filename;
$file->file->settings = array();
foreach ($cfg as $k => $v) {
$setting = new stdClass();
$setting->setting = new stdClass();
$setting->setting->name = $k;
$setting->setting->value = $v;
$file->file->settings[] = $setting;
}
$message->{$this->behavior}->preset[] = $file;
}
}
if ($storageGeneration == 2) {
$message->volumeConfig = null;
$message->snapshotConfig = null;
$message->{$this->behavior}->volumeConfig = null;
$message->{$this->behavior}->snapshotConfig = null;
// Create volume configuration
$message->{$this->behavior}->volume = new stdClass();
$message->{$this->behavior}->volume->type = 'lvm';
if ($dbFarmRole->isOpenstack()) {
$diskType = 'loop';
} else {
switch ($dbFarmRole->Platform) {
case SERVER_PLATFORMS::EC2:
$diskType = 'ec2_ephemeral';
break;
case SERVER_PLATFORMS::GCE:
$diskType = 'gce_ephemeral';
break;
}
}
$message->{$this->behavior}->volume->pvs = array();
if ($diskType == 'loop') {
$message->{$this->behavior}->volume->pvs[] = array('type' => $diskType, 'size' => '75%root');
} else {
$volumes = $dbFarmRole->GetSetting(self::ROLE_DATA_STORAGE_LVM_VOLUMES);
$v = json_decode($volumes);
foreach ($v as $name => $size) {
$message->{$this->behavior}->volume->pvs[] = array('type' => $diskType, 'name' => $name);
}
}
$fs = $dbFarmRole->GetSetting(Scalr_Db_Msr::DATA_STORAGE_FSTYPE);
if (!$fs) {
$fs = 'ext3';
}
$message->{$this->behavior}->volume->vg = $this->behavior;
$message->{$this->behavior}->volume->name = 'data';
$message->{$this->behavior}->volume->size = '100%VG';
$message->{$this->behavior}->volume->fstype = $fs;
// Add restore configuration
$restore = $this->db->GetRow("SELECT manifest FROM storage_restore_configs WHERE farm_roleid = ? ORDER BY id DESC LIMIT 1", array($dbFarmRole->ID));
if ($restore) {
$message->{$this->behavior}->restore = new stdClass();
$message->{$this->behavior}->restore->type = 'xtrabackup';
$message->{$this->behavior}->restore->cloudfsSource = $restore['manifest'];
}
if ($dbFarmRole->isOpenstack()) {
$driver = 'swift';
} else {
switch ($dbFarmRole->Platform) {
case SERVER_PLATFORMS::EC2:
$driver = 's3';
break;
case SERVER_PLATFORMS::GCE:
$driver = 'gcs';
break;
}
}
// Add backup configuration
if (!$message->{$this->behavior}->restore) {
$message->{$this->behavior}->backup = new stdClass();
$message->{$this->behavior}->backup->type = 'xtrabackup';
$message->{$this->behavior}->backup->backupType = 'full';
$message->{$this->behavior}->backup->compressor = $dbFarmRole->GetSetting(self::ROLE_DATA_BUNDLE_COMPRESSION);
$message->{$this->behavior}->backup->cloudfsTarget = sprintf("%s://scalr-%s-%s-%s/data-bundles/%s/%s/", $driver, SCALR_ID, $dbServer->envId, $dbServer->GetCloudLocation(), $dbServer->farmId, $this->behavior);
}
}
break;
case "Scalr_Messaging_Msg_DbMsr_PromoteToMaster":
$dbMsrInfo = Scalr_Db_Msr_Info::init($dbFarmRole, $dbServer, $this->behavior);
//.........这里部分代码省略.........
示例7: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message);
$dbFarmRole = $dbServer->GetFarmRoleObject();
$chefServerId = $dbFarmRole->GetSetting(self::ROLE_CHEF_SERVER_ID);
$runListId = $dbFarmRole->GetSetting(self::ROLE_CHEF_RUNLIST_ID);
if (!$chefServerId || !$runListId) {
return $message;
}
$chefRunListInfo = $this->db->GetRow("SELECT * FROM services_chef_runlists WHERE id=?", array($runListId));
$chefServerInfo = $this->db->GetRow("SELECT * FROM services_chef_servers WHERE id=?", array($chefRunListInfo['chef_server_id']));
$chefServerInfo['v_auth_key'] = trim($this->getCrypto()->decrypt($chefServerInfo['v_auth_key'], $this->cryptoKey));
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->chef = new stdClass();
$message->chef->serverUrl = $chefServerInfo['url'];
$message->chef->role = $dbFarmRole->GetSetting(self::ROLE_CHEF_ROLE_NAME);
$message->chef->validatorName = $chefServerInfo['v_username'];
$message->chef->validatorKey = $chefServerInfo['v_auth_key'];
$message->chef->environment = $chefRunListInfo['chef_environment'];
break;
}
return $message;
}
示例8: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->router = new stdClass();
// Set scalr address
$message->router->scalrAddr = \Scalr::config('scalr.endpoint.scheme') . "://" . \Scalr::config('scalr.endpoint.host');
// Set scalr IPs whitelist
$message->router->whitelist = \Scalr::config('scalr.aws.ip_pool');
// Set CIDR
$message->router->cidr = '10.0.0.0/8';
}
return $message;
}
示例9: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$config = $this->getConfiguration($dbServer);
if ($config->serverUrl || $config->cookbookUrl) {
$message->chef = $config;
}
break;
}
return $message;
}
示例10: extendMessage
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message);
switch (get_class($message)) {
case "Scalr_Messaging_Msg_HostInitResponse":
$message->mongodb = new stdClass();
$message->mongodb->keyfile = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_KEYFILE);
$message->mongodb->volumeConfig = $this->getVolumeConfig($dbServer->GetFarmRoleObject(), $dbServer);
$message->mongodb->snapshotConfig = $this->getSnapshotConfig($dbServer->GetFarmRoleObject(), $dbServer);
$message->mongodb->password = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_PASSWORD);
$message->mongodb->replicaSetIndex = $dbServer->GetProperty(self::SERVER_REPLICA_SET_INDEX);
$message->mongodb->shardIndex = $dbServer->GetProperty(self::SERVER_SHARD_INDEX);
$message->mongodb->shardsTotal = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_SHARDS_COUNT);
$message->mongodb->replicasPerShard = $dbServer->GetFarmRoleObject()->GetSetting(self::ROLE_REPLICAS_COUNT);
break;
case "Scalr_Messaging_Msg_HostDown":
case "Scalr_Messaging_Msg_HostUp":
case "Scalr_Messaging_Msg_HostInit":
case "Scalr_Messaging_Msg_BeforeHostTerminate":
$message->mongodb = new stdClass();
$message->mongodb->replicaSetIndex = $dbServer->GetProperty(self::SERVER_REPLICA_SET_INDEX);
$message->mongodb->shardIndex = $dbServer->GetProperty(self::SERVER_SHARD_INDEX);
break;
}
return $message;
}
示例11: extendMessage
/**
* {@inheritdoc}
* @see Scalr_Role_Behavior::extendMessage()
*/
public function extendMessage(Scalr_Messaging_Msg $message, DBServer $dbServer)
{
$message = parent::extendMessage($message, $dbServer);
switch (get_class($message)) {
case 'Scalr_Messaging_Msg_HostInitResponse':
$config = $this->getConfiguration($dbServer);
if (!empty($config->serverUrl) || !empty($config->cookbookUrl)) {
$message->chef = $config;
$message->chef->scriptName = '[Scalr built-in] Chef bootstrap';
$message->chef->executionId = Scalr::GenerateUID();
$message->chef->eventName = 'HostInit';
}
break;
}
return $message;
}