Commit Graph

36 Commits

Author SHA1 Message Date
Takashi Kajinami ac2462a584 Clear implementations for neutron LBaaS v1
These resources were hidden some releases ago so we no longer need to
maintain the implementations.

Story: 2010678
Task: 47760
Change-Id: Id9684396e495f46890a915e7d05d9fd2ddc24b63
2023-04-10 14:16:40 +09:00
Hervé Beraud 9bc5c23885 Remove six and python 2.7 full support
Six is in use to help us to keep support for python 2.7.
Since the ussuri cycle we decide to remove the python 2.7
support so we can go ahead and also remove six usage from
the python code.

Review process and help
-----------------------
Removing six introduce a lot of changes and an huge amount of modified files
To simplify reviews we decided to split changes into several patches to avoid
painful reviews and avoid mistakes.

To review this patch you can use the six documentation [1] to obtain help and
understand choices.

Additional informations
-----------------------
Changes related to 'six.b(data)' [2]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

six.b [2] encode the given datas in latin-1 in python3 so I did the same
things in this patch.

Latin-1 is equal to iso-8859-1 [3].

This encoding is the default encoding [4] of certain descriptive HTTP
headers.

I suggest to keep latin-1 for the moment and to move to another encoding
in a follow-up patch if needed to move to most powerful encoding (utf8).

HTML4 support utf8 charset and utf8 is the default charset for HTML5 [5].

Note that this commit message is autogenerated and not necesserly contains
changes related to 'six.b'

[1] https://six.readthedocs.io/
[2] https://six.readthedocs.io/#six.b
[3] https://docs.python.org/3/library/codecs.html#standard-encodings
[4] https://www.w3schools.com/charsets/ref_html_8859.asp
[5] https://www.w3schools.com/html/html_charset.asp

Patch 14 of a serie of 28 patches

Change-Id: Iccb743056c631f2e0728013942d764cd8b1ecfe0
2020-04-23 14:49:12 +02:00
Zuul 8643975783 Merge "Eliminate nested stack loading in InstanceGroup/ASG scaling" 2018-04-02 04:35:47 +00:00
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
2018-01-28 09:41:20 +05:30
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
2018-01-19 15:40:37 -05:00
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
activity.

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
2017-11-17 17:21:09 +05:30
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.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Ieec8028305099422e1b0f8fc84bc90c9ca6c694f
2017-03-25 17:11:50 +08:00
huangtianhua 197febdb01 Improve resource.NoActionRequired
Log the proper reasons (scaling activity or cooldown)
when scaling is not allowed.

Change-Id: I3a9ed8fe7bff8696551470a9fac0b1a2831eb95c
2017-01-25 00:17:00 +00:00
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
2017-01-04 11:18:00 +00:00
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
modules.
We need to fix that.

Change-Id: I9c7481462ac7350bddae78c0a05af1e835a282e2
2016-08-16 12:44:36 +07:00
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
2016-05-26 18:28:10 +00:00
Kanagaraj Manickam 080ace0054 Fixes cooldown logic throws ValueError
Change-Id: I2835e8b2b570a82625761aa55ec34e0df4d6ecd5
Closes-bug: #1569273
2016-05-15 19:05:44 +00:00
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
2016-04-01 18:24:16 +05:30
Omar Soriano 6c25e8302d Avoid cooldown when group size does not change
Cooldown behavior changed in commit:
50cc71e33c

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
2016-03-19 19:22:04 +05:30
Peter Razumovsky a2ec480f3c Fix [H405] pep rule in heat/scaling
Implements bp docstring-improvements

Change-Id: If1b98962ce20f28cefd01ccf7d6f88f7e908d0db
2015-09-21 14:51:45 +03:00
Rabi Mishra b336c29589 Move new capacity calculation to scaling library
Change-Id: Ief647b68bcd54adf3c7b2afbd32555a789e4c38c
2015-09-10 21:01:24 +05:30
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
2015-09-08 08:44:18 +12:00
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
2015-09-08 08:44:18 +12:00
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
2015-09-08 08:44:18 +12:00
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
does.

Change-Id: Ie25a8de380ffc4a6eb4d5934118452b010c1872a
Partially-Implements: blueprint scaling-group-common
2015-09-07 08:38:13 +12:00
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
2015-09-07 08:38:13 +12:00
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
2015-09-07 08:38:13 +12:00
Rabi Mishra cc7e2d6cb3 Use latest stable version for RG & ASG nested templates
Change-Id: I5924db9fa2a49825baef2faf88c533aca76ea081
2015-08-27 16:45:47 +05:30
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
2015-07-15 15:37:55 +03:00
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
2015-07-05 23:19:06 -04:00
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
2015-06-02 16:29:15 +02:00
Tetiana Lashchova 4ace95ad47 Use six.iterkeys(x) instead of x.keys()
Implements: partial blueprint heat-python34-support
Change-Id: I6f1c3091ca65dbef0f36bd6ba7f7fcbf77ff2e40
2015-04-23 17:18:40 +03:00
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
2015-03-18 10:29:55 +10:00
Jens Rosenboom a99fe6a760 Make import of oslo libraries namespaceless
See https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages

Closes-Bug: 1423174
Change-Id: I48680ce6e7ce91005c147ab4388203946171d433
2015-02-18 22:54:10 +01:00
Jenkins d4f8bb3652 Merge "Move LB reload logic into scaling library" 2015-02-11 14:11:59 +00:00
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
2015-02-01 21:53:22 +08:00
Pavlo Shchelokovskyy 4279bd2923 Enable H305 and H307 style checks
Correct grouping and ordering of imports

Change-Id: I47ea0d53f80d7f0aeb01c1c6afd63713be87ddf4
2015-01-20 09:47:25 +02:00
Julien Danjou 6519cf36fd Switch to oslo.utils
Change-Id: I74979d8f75b099858314a30c98bb252c379e0304
2014-09-30 14:27:59 +02:00
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
subdirectory.

Implements: partial-blueprint reorg-asg-code
Change-Id: I40e470460e84944d317f5b1772fc562abf62896d
2014-08-14 17:20:24 +08:00
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
2014-06-05 13:45:14 -04:00
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
2014-02-06 22:53:28 +00:00