jenkins-bot has submitted this change and it was merged.
Change subject: Added getDisplayName and getFullyQualifiedDisplayName
......................................................................
Added getDisplayName and getFullyQualifiedDisplayName
This is what newer instances use to identify themselves rather
than the old-school i-xxxx names returned by getHostName().
Change-Id: Ie8afcc61226335c56c0d249650533d619a9b52e2
---
M nova/OpenStackNovaHost.php
1 file changed, 42 insertions(+), 2 deletions(-)
Approvals:
Ryan Lane: Looks good to me, approved
jenkins-bot: Verified
diff --git a/nova/OpenStackNovaHost.php b/nova/OpenStackNovaHost.php
index f75334a..cc147bc 100644
--- a/nova/OpenStackNovaHost.php
+++ b/nova/OpenStackNovaHost.php
@@ -60,12 +60,41 @@
}
/**
- * Return the host's short name
+ *
+ * Return i-<id> style hostname
*
* @return
*/
function getHostName() {
return $this->hostInfo[0]['dc'][0];
+ }
+
+ /**
+ * Return the host's fully qualified display name
+ *
+ * @return string
+ */
+ function getFullyQualifiedDisplayName() {
+ global $wgAuth;
+
+ if ( isset( $this->hostInfo[0]['associateddomain'] ) ) {
+ $domains = $this->hostInfo[0]['associateddomain'];
+ array_shift( $domains );
+ foreach ( $domains as $domain ) {
+ $pieces = explode( '.', $domain );
+ $name = $pieces[0];
+ if ( $name != $this->getHostName() ) {
+ # A leap of faith: There should
+ # be two associated domains, one based
on the id and
+ # one the display name. So, if this
one isn't the id,
+ # it must be the display.
+ return $domain;
+ }
+ }
+ }
+
+ $wgAuth->printDebug( "Error: Unable to determine instancename
of " . $this->searchvalue, NONSENSITIVE );
+ return "";
}
/**
@@ -78,7 +107,18 @@
}
/**
- * Return the host's fully qualified domain name
+ * Return human-readable hostname
+ *
+ * @return string
+ */
+ function getDisplayName() {
+ $pieces = explode( '.', $this->getFullyQualifiedDisplayName() );
+ return $pieces[0];
+ }
+
+ /**
+ *
+ * Return i-xxxxx.<domain>
*
* @return string
*/
--
To view, visit https://gerrit.wikimedia.org/r/64302
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8afcc61226335c56c0d249650533d619a9b52e2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: Andrew Bogott <[email protected]>
Gerrit-Reviewer: DamianZaremba <[email protected]>
Gerrit-Reviewer: Ryan Lane <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits