-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cloud updates
- Loading branch information
Showing
13 changed files
with
931 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
namespace OpenXdmod\Setup; | ||
|
||
use DateTime; | ||
use CCR\Log; | ||
use ETL\Utilities; | ||
/** | ||
* Federation Instance setup. | ||
*/ | ||
class SetFederatedRole extends SetupItem | ||
{ | ||
|
||
/** | ||
* Main federation setup | ||
* | ||
* @var FederatedSetup | ||
*/ | ||
protected $parent; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function __construct(Console $console, FederatedSetup $parent) | ||
{ | ||
parent::__construct($console); | ||
$this->parent = $parent; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function handle() | ||
{ | ||
$settings = $this->loadIniConfig('portal_settings', 'federated'); | ||
$this->console->displaySectionHeader('Set Federation Role'); | ||
$this->console->displayBlankLine(); | ||
$role = strtolower( | ||
$this->console->prompt( | ||
'Is this a federation `hub` or `instance`?', | ||
$settings['federated_role'] | ||
) | ||
); | ||
if($role !== $settings['federated_role']) | ||
{ | ||
switch($role){ | ||
case 'instance': | ||
$url = $this->console->prompt('What is the url for the hub?', $settings['federated_huburl']); | ||
if (empty($url)) { | ||
$this->console->displayMessage("Error, instance URL is required!"); | ||
} | ||
else{ | ||
if($settings['federated_role'] === 'hub'){ | ||
$this->patchOpenXdmod(true); | ||
} | ||
$settings['federated_role'] = 'instance'; | ||
$settings['federated_huburl'] = $url; | ||
$this->saveIniConfig($settings, 'portal_settings', 'federated'); | ||
} | ||
break; | ||
case 'hub': | ||
$settings['federated_role'] = 'hub'; | ||
$this->saveIniConfig($settings, 'portal_settings', 'federated'); | ||
$this->patchOpenXdmod(); | ||
break; | ||
default: | ||
$this->console->displayMessage("Error, no role specified!"); | ||
$this->console->prompt('Press ENTER to continue.'); | ||
} | ||
} | ||
} | ||
function patchOpenXdmod($reverse = false){ | ||
$directionOption = '--forward'; | ||
$patchPath = DATA_DIR . '/patches/federated/'; | ||
if($reverse){ | ||
$directionOption = '--reverse'; | ||
} | ||
$this->executeCommand('patch --quiet ' . $directionOption . ' -up1 --directory=/usr/share/xdmod/ < ' . $patchPath . 'usr-share-xdmod.diff'); | ||
$this->executeCommand('patch --quiet ' . $directionOption . ' -up2 --directory=/etc/xdmod/ < ' . $patchPath . 'configuration.diff'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[federated] | ||
version = "8.1.2" | ||
role = | ||
huburl = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
When running a federation HUB you will need the following changes made to the OpenXDMoD code. | ||
**NOTE** This is done automatically as part of `xdmod-setup` when setting the federation type to `hub` | ||
|
||
patch -up1 --directory=/usr/share/xdmod/ < patches/cloud/usr-share-xdmod.diff | ||
patch -up2 --directory=/etc/xdmod/ < patches/cloud/configuration.diff | ||
|
||
If you have no jobs data use the following as well to remove Jobs related information. | ||
|
||
patch -up1 --directory=/usr/share/xdmod/ < patches/cloud/nojobs-usr-share-xdmod.diff | ||
patch -up2 --directory=/etc/xdmod/ < patches/cloud/nojobs-configuration.diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
diff --git a/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json b/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json | ||
index f2fc4bd5..de5b4f7f 100644 | ||
--- a/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json | ||
+++ b/configuration/etl/etl_action_defs.d/cloud_common/cloud_metrics_aggregation.json | ||
@@ -27,7 +27,8 @@ | ||
"year": "${:YEAR_VALUE}", | ||
"${AGGREGATION_UNIT}": "${:PERIOD_VALUE}", | ||
"host_resource_id": "sr.resource_id", | ||
- "account_id": "instance.account_id", | ||
+ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", | ||
+ "account_id": "ca.primaryid", | ||
"person_id": "sr.person_id", | ||
"systemaccount_id": "sr.systemaccount_id", | ||
"processorbucket_id": "(SELECT id FROM ${SOURCE_SCHEMA}.processor_buckets pb WHERE sr.num_cores BETWEEN pb.min_processors AND pb.max_processors)", | ||
@@ -71,6 +72,13 @@ | ||
"schema": "${UTILITY_SCHEMA}", | ||
"alias": "task_resource", | ||
"on": "task_resource.id = sr.resource_id" | ||
+ }, | ||
+ { | ||
+ "#": "THE FOLLOWING IS ADDED BY THE FEDERATION MODULE", | ||
+ "name":"account", | ||
+ "alias":"ca", | ||
+ "schema": "${SOURCE_SCHEMA}", | ||
+ "on": "ca.resource_id = instance.resource_id AND ca.account_id = instance.account_id" | ||
} | ||
], | ||
"where": [ | ||
diff --git a/configuration/etl/etl_action_defs.d/cloud_common/session_records.json b/configuration/etl/etl_action_defs.d/cloud_common/session_records.json | ||
index 1ce31ca7..63f12522 100644 | ||
--- a/configuration/etl/etl_action_defs.d/cloud_common/session_records.json | ||
+++ b/configuration/etl/etl_action_defs.d/cloud_common/session_records.json | ||
@@ -11,7 +11,8 @@ | ||
"end_event_type_id": "e.end_event_id", | ||
"resource_id": "it.resource_id", | ||
"instance_type": "itt.instance_type", | ||
- "instance_type_id": "itt.instance_type_id", | ||
+ "#": "THE FOLLOWING WAS MODIFIFED BY THE FEDERATION MODULE", | ||
+ "instance_type_id": "itt.primaryid", | ||
"num_cores": "itt.num_cores", | ||
"memory_mb": "itt.memory_mb", | ||
"disk_gb": "itt.disk_gb", | ||
diff --git a/configuration/etl/etl_tables.d/cloud_common/account.json b/configuration/etl/etl_tables.d/cloud_common/account.json | ||
index b89f3f44..0d18fe83 100644 | ||
--- a/configuration/etl/etl_tables.d/cloud_common/account.json | ||
+++ b/configuration/etl/etl_tables.d/cloud_common/account.json | ||
@@ -14,7 +14,7 @@ | ||
"name": "account_id", | ||
"type": "int(11)", | ||
"nullable": false, | ||
- "extra": "auto_increment", | ||
+ "#": "Auto-increment REMOVED FROM THIS COLUMN BY THE FEDERATION", | ||
"comment": "Unknown = 1" | ||
}, | ||
{ | ||
@@ -29,9 +29,17 @@ | ||
"nullable": true, | ||
"default": null, | ||
"comment": "What to show the user" | ||
+ }, | ||
+ { | ||
+ "#": "THIS HAS BEEN ADDED BY THE FEDERATION", | ||
+ "name": "primaryid", | ||
+ "type": "bigint(20) unsigned", | ||
+ "nullable": false, | ||
+ "extra": "auto_increment", | ||
+ "comment": "Added by federation" | ||
} | ||
], | ||
- | ||
+ "#": "THE FOLLOWING IS NOT VALID ON A FEDERATION HUB", | ||
"#": "Note that the primary key is (resource, account) rather than account_id so we can", | ||
"#": "take advantage of ON DUPLICATE KEY UPDATE to update existing entries and still use", | ||
"#": "auto_increment for new entries.", | ||
@@ -45,15 +53,16 @@ | ||
|
||
"indexes": [ | ||
{ | ||
+ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", | ||
"name": "PRIMARY", | ||
"columns": [ | ||
- "resource_id", | ||
- "provider_account" | ||
+ "primaryid" | ||
], | ||
"is_unique": true | ||
}, | ||
{ | ||
- "name": "autoincrement_key", | ||
+ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", | ||
+ "name": "uniq", | ||
"columns": [ | ||
"resource_id", | ||
"account_id" | ||
diff --git a/configuration/etl/etl_tables.d/cloud_common/instance_type.json b/configuration/etl/etl_tables.d/cloud_common/instance_type.json | ||
index f7d4e39e..0f769bbf 100644 | ||
--- a/configuration/etl/etl_tables.d/cloud_common/instance_type.json | ||
+++ b/configuration/etl/etl_tables.d/cloud_common/instance_type.json | ||
@@ -16,7 +16,7 @@ | ||
"name": "instance_type_id", | ||
"type": "int(11)", | ||
"nullable": false, | ||
- "extra": "auto_increment", | ||
+ "#": "Auto-increment REMOVED FROM THIS COLUMN BY THE FEDERATION", | ||
"comment": "Auto-increment relative to resource_id. Unknown = 1" | ||
}, | ||
{ | ||
@@ -69,7 +69,15 @@ | ||
"nullable": true, | ||
"default": null, | ||
"comment": "End time for this configuration as a unix timestamp to the microsecond., NULL if it is still in effect." | ||
- } | ||
+ }, | ||
+ { | ||
+ "#": "THIS HAS BEEN ADDED BY THE FEDERATION", | ||
+ "name": "primaryid", | ||
+ "type": "bigint(20) unsigned", | ||
+ "nullable": false, | ||
+ "extra": "auto_increment", | ||
+ "comment": "Added by federation" | ||
+ } | ||
], | ||
|
||
"#": "Note that the primary key is (resource, instance_type, num_cores, memory_mb, disk_gb)", | ||
@@ -78,7 +86,14 @@ | ||
|
||
"indexes": [ | ||
{ | ||
- "name": "PRIMARY", | ||
+ "#": "THE FOLLOWING HAS BEEN ADDED BY THE FEDERATION MODULE", | ||
+ "name": "PRIMARY", | ||
+ "columns": [ | ||
+ "primaryid" | ||
+ ] | ||
+ },{ | ||
+ "#": "THE FOLLOWING HAS BEEN CHANGED BY THE FEDERATION MODULE", | ||
+ "name": "uniq", | ||
"columns": [ | ||
"resource_id", | ||
"instance_type", | ||
@@ -89,6 +104,7 @@ | ||
"is_unique": true | ||
}, | ||
{ | ||
+ "#": "THE FOLLOWING IS NOT VALID ON A FEDERATION HUB", | ||
"#": "For MyISAM tables, you can specify AUTO_INCREMENT on a secondary column in a", | ||
"#": "multiple-column index. In this case, the generated value for the AUTO_INCREMENT column", | ||
"#": "is calculated as MAX(auto_increment_column) + 1 WHERE prefix=given-prefix. This is", |
Oops, something went wrong.