summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/common/test_hash_ring.py
Commit message (Collapse)AuthorAgeFilesLines
* Use monotonic time for hashring resetKaifeng Wang2023-05-071-1/+1
| | | | | | | hashring use time.time() to calculate intervals, replace with monotonic so it will not be affected by system time jump. Change-Id: I17569359f4d2c0f2f24ca8b50773c4d210ed8deb
* Bye-bye iSCSI deploy, you served us wellDmitry Tantsur2021-05-041-3/+3
| | | | | | | | | | | | The iSCSI deploy was very easy to start with, but it has since become apparently that it suffers from scalability and maintenance issues. It was deprecated in the Victoria cycle and can now be removed. Hide the guide to upgrade to hardware types since it's very outdated. I had to remove the iBMC diagram since my SVG-fu is not enough to fix it. Change-Id: I2cd6bf7b27fe0be2c08104b0cc37654b506b2e62
* Register all hardware_interfaces togetherDerek Higgins2021-01-081-3/+18
| | | | | | | | | | Prevent each driver comming online one at a time. So that /driver returns nothign until all interfaces are registered Story: #2008423 Task: #41368 Change-Id: I6ef3e6e36b96106faf4581509d9219e5c535a6d8
* Fix a race condition in the hash ring codeDmitry Tantsur2020-09-281-2/+5
| | | | | | | | | | | | | We're handling hash rings and updated_at differently: one is stored on the class level, the other - on instance. Apparently, there is a race there, resulting in updated_at never updated. Store hash rings and updated_at in one tuple, so that they're always loaded and stored together. Also remove double loading of the hash ring in _get_ring that could contribute to the problem. Change-Id: Ib659014e07549ae3d5ec7e69da318301f5994ca8
* Fixes a race condition in the hash ring codeDmitry Tantsur2018-10-051-16/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current hash ring code suffers from several problems: 1. The cache is reset on any get_topic_for call, which means that the cache is not used between API calls. Previously it was done to work around the situation when a new conductor is not visible until the API process restarts. Currently we refresh the hash rings periodically. This patch removes resetting the cache. To avoid waiting 2 minutes to be able to use a new driver: 1) the hash ring cache is always rebuilt when a ring is not found, 2) the hash_ring_reset_interval option was changed to 15 seconds. 2. The reset of the cache races with the hot path in the get_ring call. It is possible that the reset happens after the class-level cache variable is checked but before it is used, yielding None. This patch stores the value of the class-level variable to a local variable before checking, thus ensuring None is never returned. Finally, some logging was added to the modified code to make this kind of problems more debugable in the future. Change-Id: I6e18c6ec23a053b59c76fcadd52b13d84d81b4fb Story: #2003966 Task: #26896 Partial-Bug: #1792872
* Simplify hash ring testsJim Rollenhagen2018-07-251-6/+5
| | | | | | | Move use_groups to a class-level variable so we don't need to re-implement setUp in the subclass. Change-Id: Ia7e508899e0db47bf4800f8411e02ebd21c62ffd
* Use conductor group for hash ring calculationsJim Rollenhagen2018-07-231-13/+62
| | | | | | | | | | | | | | | | | | | | | | This changes the calculation for keys in the hash ring manager to be of the form "<conductor_group>:<driver>", instead of just driver. This is used when the RPC version pin is 1.47 or greater (1.47 was created to handle this). When finding an RPC topic, we use the conductor group marked on the node as part of this calculation. However, this becomes a problem when we don't have a node that we're looking up a topic for. In this case we look for a conductor in any group which has the driver loaded, and use a temporary hash ring that does not use conductor groups to find a conductor. This also begins the API work, as the API must be aware of the new hash ring calculation. However, exposing the conductor_group field and adding a microversion is left for a future patch. Story: 2001795 Task: 22641 Change-Id: Iaf71348666b683518fc6ce4769112459d98938f2
* Remove support for creating and loading classic driversDmitry Tantsur2018-07-021-9/+4
| | | | | | | | | | | | | | | | * removes any bits related to loading classic drivers from the drivers factory code * removes exceptions that only happen when classic drivers can be loaded * removes the BaseDriver, moves the useful functionality to the BareDriver class * /v1/drivers/?type=classic now always returns an empty list * removes the migration updating classic drivers to hardware types The documentation will be updated separately. Change-Id: I8ee58dfade87ae2a2544c5dcc27702c069f5089d
* Add hardware types to the hash ringJim Rollenhagen2017-01-191-2/+10
| | | | | | | | | | | | | This loads hardware types into the hash ring, along with the drivers that are currently there. This allows us to make RPC calls for nodes that are using a dynamic driver. Adds a dbapi method `get_active_hardware_type_dict`, similar to `get_active_driver_dict`, to get a mapping of hardware types to active conductors. Change-Id: I50c1428568bd8cbe4ef252d56a6278f1a54dfcdb Partial-Bug: #1524745
* Move to tooz hash ring implementationJim Rollenhagen2017-01-191-189/+1
| | | | | | | | This changes the ironic driver to use the hash ring implementation from tooz, which is nearly identical to ironic.common.hash_ring. Change-Id: I4200be2035067622604e5aa70e025594bcd0a801 Depends-On: Ic1f8b89b819ace8df9b15c61eaf9bf136ad3166b
* Fix race in hash ring refresh unit testJim Rollenhagen2016-03-231-1/+1
| | | | | | | | | This has been found to be racy in the gate[0]. Offset it by a second so that we always hit the refresh. [0] http://logs.openstack.org/19/259119/9/check/gate-ironic-python34-db/438bc8e/testr_results.html.gz Change-Id: I54d465c75316043f515e2ef1b04ef0f719b91894
* Use assertEqual/Greater/Less/IsNoneBéla Vancsics2016-03-011-2/+2
| | | | | | | | Instead of using assertFalse(A * B) / assertTrue(A * B), developers should use assertEqual/NotEqual/Less//Greater The * operator: '==', '<', '>' Change-Id: Ic4952ee034c8c8f6da70403cb767bb027058eeb0
* Merge "Move ironic.tests.unit.base to ironic.tests.base"Jenkins2015-10-231-1/+1
|\
| * Move ironic.tests.unit.base to ironic.tests.baseJohn L. Villalovos2015-10-221-1/+1
| | | | | | | | | | | | | | | | We will use the base.py file for both unit and functional testing, so move it under ironic/tests/base.py Change-Id: Ifc36d61be60c820dd8e5ee0f9b9dadb52d8b480a Partial-Bug: #1491670
* | Move hash_ring refresh logic out of sync_local_stateZhenguo Niu2015-10-231-0/+12
|/ | | | | | | | | | | | As sync_local_state periodic task can be disabled, which will lose out on hash ring refresh, so the refresh logic should be independent of it. this patch adds a updated_at to HashRingManager to track of when the ring was last refreshed, and when checks the ring is set, also check the age and rebuild if older than the new config option hash_ring_reset_interval which is default to 180s. Change-Id: Ie46dbf93b920543f99e11774a29878aaf27c3400 Closes-Bug: #1506657
* Prepare for functional testingJohn L. Villalovos2015-09-281-0/+251
Prepare for functional testing by creating two new directories: * ironic/tests/unit * ironic/tests/functional Move all files currently in ironic/tests/* to ironic/tests/unit/ Update imports from 'ironic.tests.YYY' to 'ironic.tests.unit.YYY' Fix any PEP8 issues due to longer lines Partial-Bug: #1491670 Change-Id: I1166f20adf8c84b2042b62e348926502a4851e08