Commit Graph

34 Commits (4ee754f359e8f7a4ef32df2ca87319c6bc381c47)

Author SHA1 Message Date
Zuul 8643975783 Merge "Eliminate nested stack loading in InstanceGroup/ASG scaling" 5 years ago
rabi 0558b10c48 Remove use of CooldownMixin with scaling policy
Removes the multiple use of the mixin, so that we don't
set metadata for both policy and group. Setting the cooldown
metadata only for group would suffice.

Change-Id: I241a32b52e0708264c80c3eca313a97534927415
Related-Bug: #1555748
5 years ago
Zane Bitter 42b386d8a6 Eliminate nested stack loading in InstanceGroup/ASG scaling
Obtain the current group capacity, and the reference IDs for updating load
balancers (if any) over RPC from a GroupInspector and the nested stack
outputs. Fall back to grouputils (which loads the nested stack in memory)
only if the output containing the reference IDs is not available.

Change-Id: Ic6909e42edf709ba1cd99ba71f2d2f06570a615f
Closes-Bug: #1731349
5 years ago
rabi c89a17bfe3 Refactor CooldownMixin
The present way of comparing timestamp in metadata
+ cooldown with current timestamp can be wrong, if
the policy cooldown is updated in between scaling

Set metadata with the expected cooldown end timestmap
rather than the current timestamp when scaling is finished
and compare it with current timestamp.

Change-Id: I50ddba4c8da3c6ec8b34ebb4768017cb1a446f5f
6 years ago
liyi 8f10215ffd Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.


Change-Id: Ieec8028305099422e1b0f8fc84bc90c9ca6c694f
6 years ago
huangtianhua 197febdb01 Improve resource.NoActionRequired
Log the proper reasons (scaling activity or cooldown)
when scaling is not allowed.

Change-Id: I3a9ed8fe7bff8696551470a9fac0b1a2831eb95c
6 years ago
huangtianhua 5b04acb4e2 To reset metadata for resources when mark unhealthy
Some resources do not work if their metadata is in
a wrong state, .e.g the metadata 'scaling_in_progress'
of scaling group/policy might be always True if engine
restarts while scaling.
This patch adds an interface 'handle_metadata_reset' for
resource, then the plugins can override it if needed.
We reset the metadata while marking resource healthy.

Change-Id: Ibd6c18acf6f3f24cf9bf16a524127850968062bc
Closes-Bug: #1651084
6 years ago
Nguyen Hung Phuong e8f6c36440 Clean imports in code
In some part in the code we import objects.
In the Openstack style guidelines they recommend to import only
We need to fix that.

Change-Id: I9c7481462ac7350bddae78c0a05af1e835a282e2
7 years ago
Jaime Guerrero c789a9837e Ignore NotFound exception in metadata_set
To avoid a race condition when updating a deleted stack, this catches the
NotFound exception specifically and ignores it.  All other exceptions are
allowed to be raised.

Closes bug: 1582236

Change-Id: I23ddb71c806c0db1ed7ed4ee4ef831ca51605d65
7 years ago
Kanagaraj Manickam 080ace0054 Fixes cooldown logic throws ValueError
Change-Id: I2835e8b2b570a82625761aa55ec34e0df4d6ecd5
Closes-bug: #1569273
7 years ago
Rabi Mishra 480271d896 Don't try scaling when no change in size
Don't resize and send notifications when there is no
change in size i.e. max/min has been reached.

This also refactors some exception handling logic.

Change-Id: I1bb226b3067178dbdab2947609c53f3434aff9fe
Related-Bug: #1555748
7 years ago
Omar Soriano 6c25e8302d Avoid cooldown when group size does not change
Cooldown behavior changed in commit:

Restore the cooldown behavior so that when a group does not encounter
scaling activity, a cooldown period is not activated.

Closes-Bug: #1555748
Change-Id: Icf5df6a48afb9f56aa1c3f1622d33b9998aca39c
7 years ago
Peter Razumovsky a2ec480f3c Fix [H405] pep rule in heat/scaling
Implements bp docstring-improvements

Change-Id: If1b98962ce20f28cefd01ccf7d6f88f7e908d0db
8 years ago
Rabi Mishra b336c29589 Move new capacity calculation to scaling library
Change-Id: Ief647b68bcd54adf3c7b2afbd32555a789e4c38c
8 years ago
Zane Bitter 7fb7d765be Handle scaling up in scaling library next_batch() function
Handle the case where targ_capacity > curr_capacity.

Change-Id: I53d6f51a3ff0f7e813720e28f9decfc8ef118a89
Partially-Implements: blueprint scaling-group-common
8 years ago
Zane Bitter 0dff4ba0a5 Allow member_definitions() to customise each member that it defines
This should be useful both for ResourceGroup, which does unspeakable things
to its member definitions in order to substitute in resource names, and for
distributing members across availability zones.

Change-Id: I541168ec947066f06a6a7813d52d1df4020eb4bb
Partially-Implements: blueprint scaling-group-common
8 years ago
Zane Bitter 3109d90ce5 Allow a custom new ID function for member_definitions()
Previously we always used a random short_id, and that is indeed what we
want for Autoscaling groups, but ResourceGroups generally use sequential
IDs, so pass a function that generates them instead of hard-coding it.

By happy accident, this makes the tests a bit nicer too.

Change-Id: I58ce67e4b58378f35d5690d653a113b03ee6e08e
Partially-Implements: blueprint scaling-group-common
8 years ago
Zane Bitter 00196a40ca Clarify name of scaling resource_templates() function
The naming in this function dates from an earlier era, before we had the
ResourceDefinition class. This modifies the function name from
resource_templates() to member_definitions() and also modifies the
parameter/variable names to make their meanings clearer. The documentation
is also improved with a more thorough description of what the function

Change-Id: Ie25a8de380ffc4a6eb4d5934118452b010c1872a
Partially-Implements: blueprint scaling-group-common
8 years ago
Zane Bitter a08262a6b7 Start scaling down in an InstanceGroup rolling update ASAP
When the effective batch size is reduced due to a dwindling number of
resources we need to update, we may be able to reduce the size of the group
prior to the final batch without violating the minimum number of members we
are required to keep in service. This change ensures that any excess nodes
are removed as soon as possible.

Change-Id: Ic7b9544825a92b8720dcff15fe581038dff43582
Partially-Implements: blueprint scaling-group-common
8 years ago
Zane Bitter 661122c256 Split out calculation of the next batch into a separate function
Create a next_batch function in the scaling library that calculates only
what the next batch update should look like. For now, continue to call this
from the get_batches function so that we can verify there is no change in
behaviour. However, this will make it easier to add improvements in the
future, and to reconcile InstanceGroup with ResourceGroup.

Change-Id: I0fe25556de2a678ead14bc64f77c0466fe8f9e92
Partially-Implements: blueprint scaling-group-common
8 years ago
Rabi Mishra cc7e2d6cb3 Use latest stable version for RG & ASG nested templates
Change-Id: I5924db9fa2a49825baef2faf88c533aca76ea081
8 years ago
Peter Razumovsky 2ebb5d1e87 Use ResourceDefinitionCore methods for lbutils
Use ResoruceDefinitionCore methods metadata and deletion_policy
instead of using ResourceDefinition as a dict.

Also, fix wrong ResourceDefinitionCore __repr__ method.

Change-Id: If7d4e77a72115aefc4878257508c1d6270db444f
8 years ago
yanyanhu b76881b8bc ASG scaling account for cooldown timestamp & in-progress
There are cases where it takes a long time to create a new resource as
requested by the scaling operation on an ASG resource, for instance, a
nova server creation followed by a complex SoftwareDeployment. During
this process, additional alarms may come in but failed to be blocked
by the current cooldown checking mechanism because the very first
timestamp has yet to be generated. This is leading to unexpected size
adjustment to the ASG.

This patch augments the existing cooldown checking mechanism with a
scaling-in-progress test so that additional alarms arriving during
the very first scaling operation will be ignored.

Change-Id: Ib8aa83eed366df7097c9cbb9247eca866ae4b620
Closes-Bug: #1375156
8 years ago
Julien Danjou 03a24cabb1 Stop using deprecated oslo_utils.timeutils.strtime()
This function has been deprecated in oslo.utils. Let's replace it with a
proper ISO8601 version.

Change-Id: I1f4c44fc86b1ee45f7e2e3cb6b4347d3c2f91a1a
8 years ago
Tetiana Lashchova 4ace95ad47 Use six.iterkeys(x) instead of x.keys()
Implements: partial blueprint heat-python34-support
Change-Id: I6f1c3091ca65dbef0f36bd6ba7f7fcbf77ff2e40
8 years ago
Angus Salkeld e3950a4e72 Pass the environment into the Template class and not Stack
When we moved parameters from the stack table to the template table
we did it in a "flexible" way, but this led to some difficult to
diagnose problems. So this patch totally removes "env" as an argument
to the Stack class to make absolutely sure that we are doing this
correctly. I came across these bugs when rebasing decouple-nested.

- env was not getting passed into instance group make_templates()
- template deepcopy was not working correctly (causing some problems
  when deleting backup stacks)

Change-Id: I85cfb01c68ff5a44e2ff4f6e446870efb7205933
8 years ago
Jens Rosenboom a99fe6a760 Make import of oslo libraries namespaceless

Closes-Bug: 1423174
Change-Id: I48680ce6e7ce91005c147ab4388203946171d433
8 years ago
Jenkins d4f8bb3652 Merge "Move LB reload logic into scaling library" 8 years ago
tengqm f433cfc73e Move LB reload logic into scaling library
The lb_reload() logic is moved into a separate module of the scaling
library.  A new test case is added to test this utility function.

Since the revised _lb_reload() method checks if LOAD_BALANCER_NAMES is
defined/provided or not, the OpenStack version of AutoScalingGroup
doesn't have to implement an empty _lb_reload() method now.

partial-blueprint: as-lib
partial-blueprint: reorg-asg-code

Change-Id: I7387d0f27c6121be29d9a035be4cca0b9bbdf441
8 years ago
Pavlo Shchelokovskyy 4279bd2923 Enable H305 and H307 style checks
Correct grouping and ordering of imports

Change-Id: I47ea0d53f80d7f0aeb01c1c6afd63713be87ddf4
8 years ago
Julien Danjou 6519cf36fd Switch to oslo.utils
Change-Id: I74979d8f75b099858314a30c98bb252c379e0304
9 years ago
tengqm 6e22014cad Move CooldownMixin into separate file
CooldownMixin is a class that can be shared between OS and AWS
auto-scaling implementations.  This patch moves it to a shared

Implements: partial-blueprint reorg-asg-code
Change-Id: I40e470460e84944d317f5b1772fc562abf62896d
9 years ago
Zane Bitter 8998897425 Use add_resource() to build autoscaling templates
Instead of building nested templates for Autoscaling manually, use the
Template.add_resource() method to build them up programmatically.

Change-Id: Ie4d6a869355cf0ddb6fce0edc6c7d49b8a2b7e75
9 years ago
Christopher Armstrong 22e96c022a Move resource_templates to heat.scaling
This introduces a new package for autoscaling code which is
intended for use outside of the Heat engine, and moves the
resource_templates function into a new module, heat.scaling.template.
The function hasn't been changed at all.

Change-Id: I78c420e7a188f2d14780a03b3ea220b9a5fbe86c
Implements: partial blueprint as-lib
9 years ago