Two-phase Instance deployment support
Currently the provisioning of VM Instances is done by calls of the 'deploy' method of 'io.murano.resources.Instance' class. This method generates the snippet of Heat template describing the VM and its resources, merges this snippet into the global template of the environment and then pushes this template to Heat API. Thus the provisioning of N instances can currently be done only with N updates of the Heat stack, i.e. with N calls of the Heat API, each followed by a significant wait interval. The proper way to do this would be to generate a single Snippet for all the VMs at once, then execute a single Heat Stack update - and then process its output also for all the VMs at once. To allow application developers to implement such a behavior, the 'deploy' method of Instance class is split into two parts: generation of the heat template snippet and the actual pushing of the snippet into the Heat API. These two phases are implemented as 'beginDeploy' and 'endDeploy' methods of the Instance class. These methods are supposed to be properly called by the application code willing to provision multiple instances at once, while the old 'deploy' method just calls them sequentially and is left for backwards compatibility. Similar approach is implemented for releaseResources routine. Change-Id: I985883816bbe9dcc23b05a4170d22acd4af9222d Targets-blueprint: scalable-application-framework
This commit is contained in:
parent
c32db7eab8
commit
a0670b6941
@ -103,7 +103,7 @@ Methods:
|
||||
Body:
|
||||
$.sharedIps: $ips
|
||||
|
||||
deploy:
|
||||
beginDeploy:
|
||||
Body:
|
||||
- $.validateBootSource()
|
||||
- $securityGroupName: coalesce(
|
||||
@ -162,6 +162,9 @@ Methods:
|
||||
# Any additional template preparation
|
||||
- $.instanceTemplate: $.prepareStackTemplate($.instanceTemplate)
|
||||
- $.environment.stack.updateTemplate($.instanceTemplate)
|
||||
|
||||
endDeploy:
|
||||
Body:
|
||||
- $.environment.stack.push()
|
||||
- $outputs: $.environment.stack.output()
|
||||
- $.ipAddresses: $outputs.get(format('{0}-assigned-ips', $this.name)).values().flatten().distinct()
|
||||
@ -173,6 +176,11 @@ Methods:
|
||||
Then: $.setAttr(fipAssigned, true)
|
||||
- $.environment.instanceNotifier.trackCloudInstance($this)
|
||||
|
||||
deploy:
|
||||
Body:
|
||||
- $this.beginDeploy()
|
||||
- $this.endDeploy()
|
||||
|
||||
detectPrimaryNetwork:
|
||||
Body:
|
||||
- $._primaryNetwork: null
|
||||
@ -283,7 +291,7 @@ Methods:
|
||||
device_type: $blockDevice.deviceType
|
||||
boot_index: $blockDevice.bootIndex
|
||||
|
||||
releaseResources:
|
||||
beginReleaseResources:
|
||||
Body:
|
||||
- $template: $.environment.stack.current()
|
||||
- If: bool($template.resources) and bool($template.outputs)
|
||||
@ -301,6 +309,12 @@ Methods:
|
||||
- $template.outputs: $template.outputs.deleteAll($outputsToDelete)
|
||||
|
||||
- $.environment.stack.setTemplate($template)
|
||||
|
||||
endReleaseResources:
|
||||
Body:
|
||||
- $template: $.environment.stack.current()
|
||||
- If: bool($template.resources) and bool($template.outputs)
|
||||
Then:
|
||||
- $.environment.stack.push()
|
||||
- $.setAttr(instanceResources, [])
|
||||
- $.setAttr(instanceOutputs, [])
|
||||
@ -309,6 +323,11 @@ Methods:
|
||||
- $.ipAddresses: []
|
||||
- $.floatingIpAddress: null
|
||||
|
||||
releaseResources:
|
||||
Body:
|
||||
- $this.beginReleaseResources()
|
||||
- $this.endReleaseResources()
|
||||
|
||||
validateBootSource:
|
||||
Body:
|
||||
- If: $.image = null and len($.blockDevices) = 0
|
||||
@ -347,4 +366,4 @@ Methods:
|
||||
getRef:
|
||||
Body:
|
||||
Return:
|
||||
get_resource: $.name
|
||||
get_resource: $.name
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- >
|
||||
Instance.deploy() can now be split into two phases: beginDeploy() and
|
||||
endDeploy(). This allows the application developer to provision multiple
|
||||
instances at once without the need to push the stack for each instance.
|
Loading…
x
Reference in New Issue
Block a user