r85072 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85071‎ | r85072 | r85073 >
Date:17:26, 31 March 2011
Author:laner
Status:deferred
Tags:
Comment:
* Added more information about instances to be added into templates.
* Added documentation for openstackmanager-deletedinstance-faileddns message
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.i18n.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaController.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaInstance.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php
@@ -340,6 +340,7 @@
341341 'openstackmanager-member' => '{{Identical|Member}}',
342342 'openstackmanager-projectlist' => 'Page title',
343343 'openstackmanager-deleteproject' => 'Page title',
 344+ 'openstackmanager-deletedinstance-faileddns' => 'Tells the user an instance was deleted, but the DNS entry was not. $1 is the specific dns name.'
344345 );
345346
346347 /** Belarusian (Taraškievica orthography) (‪Беларуская (тарашкевіца)‬)
Index: trunk/extensions/OpenStackManager/OpenStackNovaInstance.php
@@ -136,6 +136,16 @@
137137 }
138138
139139 /**
 140+ * Return the host this instance is running on
 141+ *
 142+ * @return string
 143+ */
 144+ function getInstanceHost() {
 145+ $info = explode( ' ', (string)$this->instance->instancesSet->item->keyName );
 146+ return str_replace( array(',',')'), '', $info[2] );
 147+ }
 148+
 149+ /**
140150 * Return the availability zone this instance is associated with
141151 * @return string
142152 */
@@ -181,6 +191,7 @@
182192 */
183193 function editArticle() {
184194 global $wgOpenStackManagerCreateResourcePages;
 195+ global $wgOpenStackManagerNovaAdminKeys;
185196
186197 if ( ! $wgOpenStackManagerCreateResourcePages ) {
187198 return;
@@ -197,7 +208,11 @@
198209 |Private IP=%s
199210 |Public IP=%s
200211 |Instance State=%s
 212+|Instance Host=%s
201213 |Instance Type=%s
 214+|RAM Size=%s
 215+|Number of CPUs=%s
 216+|Amount of Storage=%s
202217 |Image Id=%s
203218 |Project=%s
204219 |Availability Zone=%s
@@ -226,6 +241,8 @@
227242 $puppetvars .= $key . '=' . $val . ',';
228243 }
229244 }
 245+ $adminNova = new OpenStackNovaController( $wgOpenStackManagerNovaAdminKeys );
 246+ $instanceType = $adminNova->getInstanceType( $this->getInstanceType() );
230247 $text = sprintf( $format,
231248 $this->getInstanceName(),
232249 $this->getReservationId(),
@@ -233,7 +250,11 @@
234251 $this->getInstancePublicIP(),
235252 // Since instance state is somewhat dynamic, is this useful?
236253 $this->getInstanceState(),
 254+ $this->getInstanceHost(),
237255 $this->getInstanceType(),
 256+ $instanceType->getMemorySize(),
 257+ $instanceType->getNumberOfCPUs(),
 258+ $instanceType->getStorageSize(),
238259 $this->getImageId(),
239260 $this->getOwner(),
240261 $this->getAvailabilityZone(),
Index: trunk/extensions/OpenStackManager/OpenStackNovaController.php
@@ -83,7 +83,20 @@
8484 /**
8585 * @return array
8686 */
87 - function getInstanceTypes() {
 87+ function getInstanceType( $instanceType ) {
 88+ $this->getInstanceTypes( false );
 89+ if ( isset( $this->instanceTypes["$instanceType"] ) ) {
 90+ return $this->instanceTypes["$instanceType"];
 91+ } else {
 92+ return null;
 93+ }
 94+ }
 95+
 96+ /**
 97+ * @param $sort
 98+ * @return array
 99+ */
 100+ function getInstanceTypes( $sort = true ) {
88101 global $wgOpenStackManagerNovaResourcePrefix;
89102 global $wgOpenStackManagerNovaAdminResourcePrefix;
90103
@@ -96,7 +109,9 @@
97110 $this->instanceTypes["$instanceTypeName"] = $instanceType;
98111 }
99112 $this->novaConnection->set_resource_prefix( $wgOpenStackManagerNovaResourcePrefix );
100 - OpenStackNovaInstanceType::sort( $this->instanceTypes );
 113+ if ( $sort ) {
 114+ OpenStackNovaInstanceType::sort( $this->instanceTypes );
 115+ }
101116 return $this->instanceTypes;
102117 }
103118

Status & tagging log