You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by er...@apache.org on 2015/02/03 20:28:15 UTC
libcloud git commit: [google compute] fixing node status
Repository: libcloud
Updated Branches:
refs/heads/trunk 5395ccf83 -> 3139b738a
[google compute] fixing node status
Closes #445
Signed-off-by: Eric Johnson <er...@google.com>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3139b738
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3139b738
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3139b738
Branch: refs/heads/trunk
Commit: 3139b738ae0b042112e5237f4f9ac6488c776a7b
Parents: 5395ccf
Author: Eric Johnson <er...@google.com>
Authored: Tue Feb 3 13:49:49 2015 +0000
Committer: Eric Johnson <er...@google.com>
Committed: Tue Feb 3 19:26:31 2015 +0000
----------------------------------------------------------------------
libcloud/compute/drivers/gce.py | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3139b738/libcloud/compute/drivers/gce.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/gce.py b/libcloud/compute/drivers/gce.py
index 1f29601..9cfad4d 100644
--- a/libcloud/compute/drivers/gce.py
+++ b/libcloud/compute/drivers/gce.py
@@ -790,13 +790,23 @@ class GCENodeDriver(NodeDriver):
type = Provider.GCE
website = 'https://cloud.google.com/'
+ # Google Compute Engine node states are mapped to Libcloud node states
+ # per the following dict. GCE does not have an actual 'stopped' state
+ # but instead uses a 'terminated' state to indicate the node exists
+ # but is not running. In order to better match libcloud, GCE maps this
+ # 'terminated' state to 'STOPPED'.
+ # Also, when a node is deleted from GCE, it no longer exists and instead
+ # will result in a ResourceNotFound error versus returning a placeholder
+ # node in a 'terminated' state.
+ # For more details, please see GCE's docs,
+ # https://cloud.google.com/compute/docs/instances#checkmachinestatus
NODE_STATE_MAP = {
"PROVISIONING": NodeState.PENDING,
"STAGING": NodeState.PENDING,
"RUNNING": NodeState.RUNNING,
- "STOPPED": NodeState.TERMINATED,
- "STOPPING": NodeState.TERMINATED,
- "TERMINATED": NodeState.TERMINATED
+ "STOPPING": NodeState.PENDING,
+ "TERMINATED": NodeState.STOPPED,
+ "UNKNOWN": NodeState.UNKNOWN
}
AUTH_URL = "https://www.googleapis.com/auth/"
@@ -5028,7 +5038,7 @@ n
private_ips = []
extra = {}
- extra['status'] = node.get('status')
+ extra['status'] = node.get('status', "UNKNOWN")
extra['statusMessage'] = node.get('statusMessage')
extra['description'] = node.get('description')
extra['zone'] = self.ex_get_zone(node['zone'])