extend-node-status

add 'disabled_reason' filed into 'ComputeNode' resource, to distinguish
which nodes are disabled by Watcher and which are not by Watcher.

Implements:blueprint extend-node-status

Change-Id: I7175f14870834a4582e45309529d7e8d9fbb2e6f
This commit is contained in:
suzhengwei
2017-05-15 15:40:18 +08:00
parent eaa09a4cfc
commit 74bc31e562
14 changed files with 58 additions and 23 deletions

View File

@@ -139,7 +139,8 @@ class ModelBuilder(object):
"disk_capacity": node.local_gb,
"vcpus": node.vcpus,
"state": node.state,
"status": node.status}
"status": node.status,
"disabled_reason": compute_service.disabled_reason}
compute_node = element.ComputeNode(**node_attributes)
# compute_node = self._build_node("physical", "compute", "hypervisor",

View File

@@ -36,8 +36,8 @@ class ComputeNode(compute_resource.ComputeResource):
"id": wfields.NonNegativeIntegerField(),
"hostname": wfields.StringField(),
"status": wfields.StringField(default=ServiceState.ENABLED.value),
"disabled_reason": wfields.StringField(nullable=True),
"state": wfields.StringField(default=ServiceState.ONLINE.value),
"memory": wfields.NonNegativeIntegerField(),
"disk": wfields.IntegerField(),
"disk_capacity": wfields.NonNegativeIntegerField(),

View File

@@ -122,11 +122,15 @@ class NovaNotification(base.NotificationEndpoint):
node_status = (
element.ServiceState.DISABLED.value
if node_data['disabled'] else element.ServiceState.ENABLED.value)
disabled_reason = (
node_data['disabled_reason']
if node_data['disabled'] else None)
node.update({
'hostname': node_data['host'],
'state': node_state,
'status': node_status,
'disabled_reason': disabled_reason,
})
def create_compute_node(self, node_hostname):