summaryrefslogtreecommitdiff
path: root/ironic/tests/db
Commit message (Collapse)AuthorAgeFilesLines
* Implement sync_power_state periodic taskDevananda van der Veen2013-12-041-0/+11
| | | | | | | | | | | | | | | Implement a periodic task in the ConductorManager which will check all the existing, non-locked nodes and verify that their current power states correspond to state stored in DB. If they differ, for now, log a warning and update the DB using current power state. This is a step towards keeping powered-off-nodes off. Also, this removes the unused db.api.get_nodes method and adds a new get_nodeinfo_list method. Change-Id: I609fdbd7db6620de617b44f83c7ec35350f9178c Blueprint: keep-powered-off-nodes-off
* Replace removed xrange in Python3Haomeng, Wang2013-12-023-5/+5
| | | | | | | | | Built-in function xrange were used in Python 2 were removed in Python3. Python3 uses range, we use range() to support both Python2 and Python3. Change-Id: Ib4e4f833866ed6653f75e0ace67f1d9fa493babf Closes-bug: #1256159
* Add port address unique constraint for sqliteYuriy Zveryanskyy2013-11-282-1/+23
| | | | | | | | | SQLite backend used in unit tests, but unique constraint for 'address' column in 'ports' table not working for this backend. Patch fix this and also unit tests which violates 'address' UC. Closes-Bug: #1252343 Change-Id: I761e480c99f1687531cf4c64a64c02faa7e4fb73
* Remove oslo uuidutils.generate_uuid() callHaomeng, Wang2013-11-263-11/+14
| | | | | | | | | | | | uuidutils.generate_uuid() is going to be removed from oslo, so we need to remove the call from our Ironic code. http://lists.openstack.org/pipermail/openstack-dev/2013-November/ 018980.html We create new method in our Ironic common utils to wrap the generate_uuid methods. Change-Id: I7bc4ca8fcdb29c4ee5b3e7fc7afb0235812a1c0d Partial-Bug: #1253497
* Merge "Update openstack/common/lockutils"Jenkins2013-11-191-20/+28
|\
| * Update openstack/common/lockutilsMichael Still2013-11-161-20/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 79e6bc6 fix lockutils.lock() to make it thread-safe ace5120 Add main() to lockutils that creates temp dir for locks 537d8e2 Allow lockutils to get lock_path conf from envvar d498c42 Fix to properly log when we release a semaphore 29d387c Add LockFixture to lockutils 3e3ac0c Modify lockutils.py due to dispose of eventlet 90b6a65 Fix locking bug 27d4b41 Move synchronized body to a first-class function 15c17fb Make lock_file_prefix optional 1a2df89 Enable H302 hacking check b41862d Use param keyword for docstrings Change-Id: Id604ae4188ebf822746e229165e7fcdb78a66f96
* | Merge "Changes power_state and adds last_error field"Jenkins2013-11-192-0/+20
|\ \
| * | Changes power_state and adds last_error fieldRuby Loo2013-11-162-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made these changes: * power_state -- always represents current power state. Any power operation sets this back to "actual" when done (whether successful or not). It is set to ERROR only when unable to get the power state from a node. * target_power_state -- represents the requested destination of a state transition. Cleared when the transition window is over (whether successful or not). * last_error -- string field used to store the last error from any requested asynchronous operation (eg, whether that was to change power state, or deploy a node, or anything else) that started but failed to finish. Cleared when any new asynchronous operation is started. Closes-Bug: #1237688 Change-Id: I7e079627b87b2cb1606e677e287dd08dcc87263a
* | | Accessing a subresource that parent does not existLucas Alvares Gomes2013-11-182-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When accessing a subresource like /nodes/<id>/ports or /chassis/<id>/nodes where <id> does not exist should fail with 404. Also fix a typo in the name of a method on test_nodes.py Change-Id: I5b6beba00fa7cc72b45689c5685914da895b7aa2 Closes-Bug: #1246731
* | | Supporting both Python 2 and Python 3 with sixHaomeng, Wang2013-11-143-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | We should use six.text_type for both python2 and python3 for textual data type, not unicode, it supports python 2 only. Change-Id: Ia5d7b5df83ff1a7536954f6a190502f117c80ff2 Partial-Bug: #1249886
* | | Check invalid uuid for get-by-instance db apilinggao2013-11-121-2/+12
| |/ |/| | | | | | | | | | | The db api get_node_by_instance did not check if the given instance uuid is a valid uuid or not. This patch fixes it. Change-Id: Ic22e0bf5db34fdd3d8ef974f40ea3a736ee95525
* | Merge "Don't use deprecated module commands"Jenkins2013-11-091-3/+5
|\ \
| * | Don't use deprecated module commandsChang Bo Guo2013-11-061-3/+5
| |/ | | | | | | | | | | | | | | | | The commands module was deprecated since version 2.6 and it has been removed in Python 3. Use the subprocess module instead. See http://docs.python.org/2/library/commands#module-commands Closes-Bug: #1248216 Change-Id: I16d6baa77637f84b878df3ee6f964ddb9446d7bf
* | Comply with new hacking requirementsGhe Rivero2013-11-061-9/+9
|/ | | | | | | | | | | With new hacking>=0.8.0,<0.9 requirements, some functions are now deprecated. assertEquals -> assertEqual assertNotEquals -> assertNotEqual assert_ -> assertTrue Change-Id: If666b68e6af5fcb9565f10c645b4e13dca16a141
* Merge "Conductors maintan driver list in the DB"Jenkins2013-10-253-3/+148
|\
| * Conductors maintan driver list in the DBDevananda van der Veen2013-10-243-3/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To facilitate exposing a list of drivers in the API, and keep track of which ironic-conductor instance status, this patch ... * adds a new 'conductors' table in the DB * adds a Conductor object class (with intentionally limited functionality) * adds db/api methods for register/unregister/get/touch * adds periodic task to conductor to maintain its updated_at field * adds an additional db/api method to retrieve a list of drivers which are registered by active conductor instances Change-Id: I1ebdb92d5c2d6ad1a6d1717dd13ff51be181ccc0
* | Merge "Supports paginate query for two get nodes DB APIs"Jenkins2013-10-251-0/+19
|\ \
| * | Supports paginate query for two get nodes DB APIslinggao2013-10-231-0/+19
| |/ | | | | | | | | | | | | | | | | | | In DB APIs that return a list of nodes, limiting and sorting the output is necessary for a large number of output nodes. This is especially important for the GUI that uses the APIs where the view is limited. This patch adds limit, marker, sort_key and sort_dir to get_associated_nodes and get_unassociated_nodes DB APIs. Change-Id: Ia2c616fff65a03bace1244fe646bdf0cf5f30a29
* | Fix a few missing i18nDevananda van der Veen2013-10-241-4/+4
|/ | | | Change-Id: I44612bbb92655c653766f8227571cbd99aa370ad
* Don't allow deletion of associated nodeYuriy Zveryanskyy2013-10-211-0/+5
| | | | | | | | Checks that node is associated with instance added to method destroy_node() in db api. Exception NodeAssociated raised in case associated node. Change-Id: I52c7a0b3d33078b38460b5fd08e4cd2d4c7731ef
* Implement db get_[un]associated_nodesDevananda van der Veen2013-10-172-3/+42
| | | | | | | | These method were just stubs. This patch implements them in db/sqlalchemy/api.py, and a subsequent patch will expose this functionality via the API. Change-Id: Iae68cbe3bf4e84a0f47a0770695bed9dae78aa95
* Consolidates TestCase and BaseTestCaselinggao2013-10-151-3/+3
| | | | | | | | | | Most unit tests are derived from TestCase class of base.py. A few unit tests are derived from BaseTestCase class of utils.py. This patch consolidates these two classes into one and have all the tests derived from a single base class which is TestCase class. Hence, the ironic/tests/util.py is removed from this patch. Change-Id: Iecc3352ef7e49524b202e6551a233692a2f6acea
* Remove nested 'ipmi' dict from driver_infoLucas Alvares Gomes2013-10-091-5/+3
| | | | | | | | driver_info do not support nested objects. Self-namespace will be used to distinguish parameters from one driver to another. Change-Id: Ia720fac4b60aa0aa18406e0ba61d8a0a8c5c8a78 Partial-Bug: #1236533
* Merge "Replace tearDown with addCleanup in unit tests"Jenkins2013-10-091-8/+4
|\
| * Replace tearDown with addCleanup in unit testsDevananda van der Veen2013-10-081-8/+4
| | | | | | | | | | | | | | | | Infra team has indicated that tearDown should not be used, and should be replaced with addCleanup in all places. This patch removes the few cases of tearDown in Ironic. Change-Id: Ie2a59ea018c68fccadf0530409255bd9a0cf9717
* | Merge "Remove nested 'ssh' dict from driver_info"Jenkins2013-10-091-8/+6
|\ \
| * | Remove nested 'ssh' dict from driver_infoLucas Alvares Gomes2013-10-081-8/+6
| |/ | | | | | | | | | | | | | | driver_info do not support nested objects. Self-namespace will be used to distinguish parameters from one driver to another. Change-Id: I2756abc855ddfd5388dacb083c12c8916beedd01 Partial-Bug: #1236533
* | Remove nested 'pxe' dict from driver_infoLucas Alvares Gomes2013-10-081-7/+5
|/ | | | | | | | driver_info do not support nested objects. Self-namespace will be used to distinguish parameters from one driver to another. Change-Id: I165438fff7a032b54d3f019b727f6f85ad88d153 Partial-Bug: #1236533
* Check for required fields on portsLucas Alvares Gomes2013-10-012-16/+11
| | | | | | | | Currently the API on ports does not check for any required fields, this patch add such verifications + tests. Change-Id: I4a2003c3a5ab0a0b31742fcac119fbe20929f636 Partial-Bug: #1223847
* Add API uuid <-> id mappingLucas Alvares Gomes2013-09-302-3/+3
| | | | | | | | | On the API side, when creating a new node or port, translate 'chassis_id' and 'node_id' from uuid to id, internally id will be always used to do database operations. The opposite will happen when returning data back to the user the internal id will be translated to an uuid. Change-Id: I84782268c4317b4eec53fdcdfc6cb2b901b22780
* Prevent updates while state change is in progressLucas Alvares Gomes2013-09-171-2/+3
| | | | | | | This patch will prevent clients to update a node while its transitioning from one state to another. Change-Id: I3395916b5f9be3f6a5b6d7e6d92dd9353217d4d0
* Merge "Optimization reserve and release nodes db api methods"Jenkins2013-09-111-0/+4
|\
| * Optimization reserve and release nodes db api methodsYuriy Zveryanskyy2013-08-301-0/+4
| | | | | | | | | | | | | | | | Bulk queries used for replacement one-by-one cycles. Complex operations executed only in the case of error. add_filter_by_many_identities() method added. Change-Id: I3161f5ace1fa5b1bee76cda48700218b64e2b79e
* | Add missing unique constraintYuriy Zveryanskyy2013-09-051-0/+8
| | | | | | | | | | | | | | There is missing unique constraint in chassis table. This patch adds missing UC in separate migration. Change-Id: If4640d09a19bbd1548375fa6817e9d926c805c7c
* | Merge "Add missing foreign key"Jenkins2013-09-041-0/+9
|\ \
| * | Add missing foreign keyYuriy Zveryanskyy2013-08-271-0/+9
| |/ | | | | | | | | | | | | | | Chassis table is created after nodes table, there is missing foreign key nodes.chassis_id -> chassis.id. This patch adds missing FK in separate migration. Change-Id: Ic82181c7aa85515a5a2bba49c8dc8d35b495742c
* | Porting nova pxe driver to ironicGhe Rivero2013-08-261-3/+5
|/ | | | | | Implements: blueprint equivalent-pxe-driver Change-Id: I59cf6e10ff00b3787e2bd60082ca872348157ec8
* API Nodes statesLucas Alvares Gomes2013-08-223-7/+26
| | | | | | | | | | | | Expose the power state and provision state of a baremetal node in the API, each state is represented by a separate entity where clients can GET/PUT value from/to it. A generic /state subresource is also exposed allowing clients to GET all the current states of that node and links to each one of the specific states. Partially implements blueprint state-machine Change-Id: I0dcea268718dc3bcb152880654631f9fd61295e7
* Merge "Add checks locked nodes to db api"Jenkins2013-08-063-7/+34
|\
| * Add checks locked nodes to db apiYuriy Zveryanskyy2013-08-053-7/+34
| | | | | | | | | | | | | | | | | | | | Checks that node is locked added to methods destroy_node(), update_port(), destroy_port() in db api. Exception NodeLocked raised in case locked node. Tests updated respectively. Change-Id: I3218df016d35f80df7a707fd3f3c6dd40db81fd2
* | Merge "Disable deleting a chassis that contains nodes"Jenkins2013-08-051-0/+11
|\ \ | |/ |/|
| * Disable deleting a chassis that contains nodesRoman Prykhodchenko2013-08-041-0/+11
| | | | | | | | | | | | | | | | | | Deleting a chassis that has nodes might cause orphaned hardware to appear. This patch disables deleting chassis like that by checking the number of nodes that are in the target chassis. Change-Id: I0c7b83457b3be17949795c5cd8292421f66fa81e
* | Add Pagination of collections across the APILucas Alvares Gomes2013-08-023-9/+6
|/ | | | | | | | | | | | | Pagination is designed to return a subset of the larger collection while providing a link that can be used to retrieve the next. The next link will preserve any parameters sent in the initial request. The patch also creates a new 'api' option group and move the existing api configuration from the [default] section to the new [api] section. Implements blueprint add-api-pagination Change-Id: I3e72599344b7716a3ac88e504d018cbe7b0764b3
* Merge "Move "opportunistic" db migrations tests from Nova"Jenkins2013-07-291-0/+105
|\
| * Move "opportunistic" db migrations tests from NovaYuriy Zveryanskyy2013-07-291-0/+105
| | | | | | | | | | | | | | | | | | | | | | | | For db migrations tests on Jenkins we must use hardcoded credentials and skip test if backend (mysql or postgres) not available on developer host. Patch moves this "opportunistic" tests from Nova. blueprint db-migration-tests-opportunistic Change-Id: I3bd0be61a00916507f02a86a2e45c5831b3aaa5f
* | Build unittests for nodes apijiangwt1002013-07-281-4/+3
|/ | | | | | | 1. test create node 2. test delete node Change-Id: I9e4e2b5dbb992bed12ec07db0a55614b9d045d31
* Merge "Add links to API Objects"Jenkins2013-07-261-3/+3
|\
| * Add links to API ObjectsLucas Alvares Gomes2013-07-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds links to the resources, this allows a client to easily obtain rather than construct resource URIs. The patch also: * Add from_rpc_object to convert RPC objects into API object * Add unittests for the API /chassis/ and /port/ * Change get_all() to return a list of objects instead of a list of UUIDs Change-Id: I54a7b4846f1e9a76ee5fcb1bc84b5fd2b4fc3d8a
* | Merge "Add tests for existing db migrations"Jenkins2013-07-261-0/+127
|\ \
| * | Add tests for existing db migrationsYuriy Zveryanskyy2013-07-231-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test case TestMigrations with existing db migrations tests added to common code in test_migration. blueprint db-migration-tests Change-Id: I94feb7720d5b99da3790ba344c9c97861bc8ae1b