summaryrefslogtreecommitdiff
path: root/trove/common/utils.py
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2019-09-05 23:21:08 +1200
committerLingxian Kong <anlin.kong@gmail.com>2019-09-11 11:28:00 +1200
commitc33fa6706678131e7625a605e2f1dd3a2b0cd362 (patch)
tree9e9e1749d9d476c3b9f9f5f656ca45e79b0e4f24 /trove/common/utils.py
parent3c09e6178a20b99b0c54346c8661a1a3f01cc4b6 (diff)
downloadtrove-c33fa6706678131e7625a605e2f1dd3a2b0cd362.tar.gz
Support to create public trove instance
- The users need to specify the network to create Trove instance, but trove-taskmanager will create port in that network for Nova instance creation. Using port gives Trove more capabilities to define how the database service is exposed. - Deprecate ICMP protocol for the instance. - Restrict 'nics' parameter for creating instance. - Add 'access' parameter for creating instance. - Add 'public_network_id' option in order to create floating IP for the instance. - Do not create records for security groups, but Trove can still delete existing instances for backward compatibility. - Delete unreasonable Host, Account, Storage API. Story: 2006500 Task: 36468 Task: 36466 Change-Id: I80827e1ad5e6b130cbf94c2bb7a909c44d5cf1e5
Diffstat (limited to 'trove/common/utils.py')
-rw-r--r--trove/common/utils.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/trove/common/utils.py b/trove/common/utils.py
index 91ed1698..c6a730ac 100644
--- a/trove/common/utils.py
+++ b/trove/common/utils.py
@@ -185,16 +185,19 @@ class MethodInspector(object):
def build_polling_task(retriever, condition=lambda value: value,
sleep_time=1, time_out=0):
+ """Run a function in a loop with backoff on error.
+
+ The condition function runs based on the retriever function result.
+ """
def poll_and_check():
obj = retriever()
if condition(obj):
raise loopingcall.LoopingCallDone(retvalue=obj)
- return loopingcall.BackOffLoopingCall(
- f=poll_and_check).start(initial_delay=False,
- starting_interval=sleep_time,
- max_interval=30, timeout=time_out)
+ call = loopingcall.BackOffLoopingCall(f=poll_and_check)
+ return call.start(initial_delay=False, starting_interval=sleep_time,
+ max_interval=30, timeout=time_out)
def wait_for_task(polling_task):