Ryan Lane has uploaded a new change for review.
https://gerrit.wikimedia.org/r/71920
Change subject: Show more informative instance status
......................................................................
Show more informative instance status
Nova's api will return a status and a task state, such as:
RESIZE (resize_verify)
This change makes OpenStackManager show both. It also makes the
api action properly return the new instance state after the JS
module makes a reboot call.
Change-Id: I760440620394f0f9dc1815918ea6cc256644bf3f
---
M api/ApiNovaInstance.php
M nova/OpenStackNovaInstance.php
M special/SpecialNovaInstance.php
3 files changed, 22 insertions(+), 3 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager
refs/changes/20/71920/1
diff --git a/api/ApiNovaInstance.php b/api/ApiNovaInstance.php
index 8801ace..73fd52b 100644
--- a/api/ApiNovaInstance.php
+++ b/api/ApiNovaInstance.php
@@ -31,7 +31,10 @@
if ( ! $success ) {
$this->dieUsage( 'Failed to reboot instance.',
'openstackmanager-rebootinstancefailed' );
}
- $this->getResult()->addValue( null,
$this->getModuleName(), array ( 'instancestate' => 'rebooting' ) );
+ $instance = $this->userNova->getInstance(
$this->params['instanceid'] );
+ if ( $instance ) {
+ $this->getResult()->addValue( null,
$this->getModuleName(), array ( 'instancestate' =>
$instance->getInstanceState() ) );
+ }
break;
case 'consoleoutput':
$output = $this->userNova->getConsoleOutput(
$this->params['instanceid'] );
diff --git a/nova/OpenStackNovaInstance.php b/nova/OpenStackNovaInstance.php
index c311924..4b42b77 100644
--- a/nova/OpenStackNovaInstance.php
+++ b/nova/OpenStackNovaInstance.php
@@ -136,7 +136,16 @@
* @return string
*/
function getInstanceState() {
- return OpenStackNovaController::_get_property( $this->instance,
'OS-EXT-STS:vm_state' );
+ return OpenStackNovaController::_get_property( $this->instance,
'status' );
+ }
+
+ /**
+ * Return the task state in which this instance currently exists
+ *
+ * @return string
+ */
+ function getInstanceTaskState() {
+ return OpenStackNovaController::_get_property( $this->instance,
'OS-EXT-STS:task_state' );
}
/**
diff --git a/special/SpecialNovaInstance.php b/special/SpecialNovaInstance.php
index 1fa11dd..5e1c0ec 100644
--- a/special/SpecialNovaInstance.php
+++ b/special/SpecialNovaInstance.php
@@ -528,7 +528,14 @@
$instanceRow = array();
$this->pushResourceColumn( $instanceRow,
$instance->getInstanceName(), array( 'class' => 'novainstancename' ) );
$this->pushRawResourceColumn( $instanceRow,
$this->createResourceLink( $instance->getInstanceId() ), array( 'class' =>
'novainstanceid' ) );
- $this->pushResourceColumn( $instanceRow,
$instance->getInstanceState(), array( 'class' => 'novainstancestate' ) );
+ $state = $instance->getInstanceState();
+ $taskState = $instance->getInstanceTaskState();
+ if ( $taskState ) {
+ $stateDisplay = "$state ($taskState)";
+ } else {
+ $stateDisplay = $state;
+ }
+ $this->pushResourceColumn( $instanceRow, $stateDisplay,
array( 'class' => 'novainstancestate' ) );
$this->pushRawResourceColumn( $instanceRow,
$this->createResourceList( $instance->getInstancePrivateIPs() ) );
$this->pushRawResourceColumn( $instanceRow,
$this->createResourceList( $instance->getInstancePublicIPs() ) );
$this->pushRawResourceColumn( $instanceRow,
$this->createResourceList( $instance->getSecurityGroups() ) );
--
To view, visit https://gerrit.wikimedia.org/r/71920
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I760440620394f0f9dc1815918ea6cc256644bf3f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: master
Gerrit-Owner: Ryan Lane <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits