Jump to: navigation, search

Difference between revisions of "Heat/explode-resource-list"

(Example Output)
(Example Output)
 
Line 11: Line 11:
 
     {
 
     {
 
       "resource_name": "db",  
 
       "resource_name": "db",  
       "links": [{"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3/resources/db", "rel": "self"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3", "rel": "stack"}],  
+
       "links": [...],  
 
       "logical_resource_id": "db",  
 
       "logical_resource_id": "db",  
 
       "resource_status_reason": "state changed",  
 
       "resource_status_reason": "state changed",  
Line 23: Line 23:
 
     {
 
     {
 
       "resource_name": "lb",  
 
       "resource_name": "lb",  
       "links": [{"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3/resources/lb", "rel": "self"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3", "rel": "stack"}],  
+
       "links": [...],  
 
       "logical_resource_id": "lb",  
 
       "logical_resource_id": "lb",  
 
       "resource_status_reason": "state changed",  
 
       "resource_status_reason": "state changed",  
Line 35: Line 35:
 
     {
 
     {
 
       "resource_name": "web_nodes",  
 
       "resource_name": "web_nodes",  
       "links": [{"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3/resources/web_nodes", "rel": "self"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3", "rel": "stack"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1-web_nodes-2n4dnfr4fsjs/c3a46e6f-f999-4f9b-a797-3043031d381a", "rel": "nested"}],  
+
       "links": [...],  
 
       "logical_resource_id": "web_nodes",  
 
       "logical_resource_id": "web_nodes",  
 
       "resource_status_reason": "state changed",  
 
       "resource_status_reason": "state changed",  
Line 47: Line 47:
 
     {
 
     {
 
       "resource_name": "web_node1",  
 
       "resource_name": "web_node1",  
       "links": [{"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3/resources/web_nodes", "rel": "self"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3", "rel": "stack"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1-web_nodes-2n4dnfr4fsjs/c3a46e6f-f999-4f9b-a797-3043031d381a", "rel": "nested"}],  
+
       "links": [...],  
 
       "logical_resource_id": "web_node1",  
 
       "logical_resource_id": "web_node1",  
 
       "resource_status_reason": "state changed",  
 
       "resource_status_reason": "state changed",  
Line 60: Line 60:
 
     {
 
     {
 
       "resource_name": "web_node2",  
 
       "resource_name": "web_node2",  
       "links": [{"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3/resources/web_nodes", "rel": "self"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1/a7102c1b-e273-417b-a745-98820df6ecf3", "rel": "stack"}, {"href": "https://ord.orchestration.api.rackspacecloud.com/v1/663051/stacks/timswp1-web_nodes-2n4dnfr4fsjs/c3a46e6f-f999-4f9b-a797-3043031d381a", "rel": "nested"}],  
+
       "links": [...],  
 
       "logical_resource_id": "web_node2",  
 
       "logical_resource_id": "web_node2",  
 
       "resource_status_reason": "state changed",  
 
       "resource_status_reason": "state changed",  

Latest revision as of 19:11, 19 May 2014

Use Case

Currently, resource-list only returns top-level resources of a given stack, this does not include resources that are inside of an existing nested stack. When deleting a stack, the user should be presented with a flat list of ALL resources associated with a given stack to avoid confusion about what and why certain resources were deleted due to a stack delete.

Implementation

The most efficient implementation to solve this use-case would be to pass an optional flag to the resource-list api endpoint that would indicate to the heat engine to recurse through all of the nested stacks and flatten the data structure as well as attach the original nested stack id to each resource to maintain the relationship between resource and nested stack.

Example Output

{"resources": 
 [
   {
     "resource_name": "db", 
     "links": [...], 
     "logical_resource_id": "db", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:23:35Z", 
     "required_by": ["web_nodes"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "4974985c-da78-444b-aeb3-9a80baccdd1a", 
     "resource_type": "OS::Trove::Instance"
     
   }, 
   {
     "resource_name": "lb", 
     "links": [...], 
     "logical_resource_id": "lb", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:30:52Z", 
     "required_by": [], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "229145", 
     "resource_type": "Rackspace::Cloud::LoadBalancer"
     
   }, 
   {
     "resource_name": "web_nodes", 
     "links": [...], 
     "logical_resource_id": "web_nodes", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:25:10Z", 
     "required_by": ["lb"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "c3a46e6f-f999-4f9b-a797-3043031d381a", 
     "resource_type": "OS::Heat::ResourceGroup"
     
   }, 
   {
     "resource_name": "web_node1", 
     "links": [...], 
     "logical_resource_id": "web_node1", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:25:10Z", 
     "required_by": ["lb"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "c3a46e6f-f999-4f9b-a797-3043031d3811", 
     "resource_type": "Rackspace::Cloud::Server",
     "parent": "web_nodes",
     "nested_stack_id": "1234512345"
   }, 
   {
     "resource_name": "web_node2", 
     "links": [...], 
     "logical_resource_id": "web_node2", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:25:10Z", 
     "required_by": ["lb"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "c3a46e6f-f999-4f9b-a797-3043031d3822", 
     "resource_type": "Rackspace::Cloud::Server",
     "parent": "web_nodes",
     "nested_stack_id": "1234512345"
   }
 ]
}