Commit 348f5250 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Filter alarms on slap_state

This should reduce (significantly) the number of activities launched while searching for documents to process.
parent 9ea48762
......@@ -8,7 +8,8 @@ portal.portal_catalog.searchAndActivate(
left_join_list=select_dict.keys(),
method_id='Instance_tryToGarbageCollectNonAllocatedRootTree',
activate_kw={'tag': tag}
activate_kw={'tag': tag},
**{"slapos_item.slap_state": ['start_requested', 'stop_requested']}
)
context.activate(after_tag=tag).getId()
......@@ -8,7 +8,9 @@ portal.portal_catalog.searchAndActivate(
left_join_list=select_dict.keys(),
method_id='SoftwareInstance_tryToInvalidateIfDestroyed',
activate_kw={'tag': tag}
activate_kw={'tag': tag},
**{"slapos_item.slap_state": "destroy_requested"}
)
context.activate(after_tag=tag).getId()
portal = context.getPortalObject()
# TODO: We should filter for the specialise related
# (Hosting Subscription) which are on stop_requested
# state too.
portal.portal_catalog.searchAndActivate(
portal_type=["Slave Instance", "Software Instance"],
validation_state="validated",
specialise_validation_state="validated",
method_id='Instance_tryToStopCollect',
activate_kw={'tag': tag}
activate_kw={'tag': tag},
**{"slapos_item.slap_state": "start_requested"}
)
context.activate(after_tag=tag).getId()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment