Commit Graph

43 Commits

Author SHA1 Message Date
Monty Taylor 3b2cad5d31
Decouple OpenStackCloud from Connection
Revert the openstacksdk subclassing from shade. The idea was to
reduce the workload, but trying to make sure that the Cloud abstraction
in openstacksdk doesn't break shade's contract while we update things is
a ton of work to meet the contract that's not really valuable to people.

Instead, we'll put shade on lifesupport and only accept bugfix patches.

Revert "Make OpenStackCloud a subclass of Connection"

This reverts commit ab3f400064.

Revert "Use openstack.config directly for config"

This reverts commit 2b48637b67.

Revert "Remove the task manager"

This reverts commit 28e95889a0.

Change-Id: I3f5b5fb26af2f6c0bbaade24a04c3d1f274c8cce
2018-10-16 08:58:01 -05:00
Monty Taylor ab3f400064
Make OpenStackCloud a subclass of Connection
The shade code lives in openstacksdk now and is a part of Connection.
Start making shade a subclass of that for backwards compat.

Mostly only deal with the constructor for now, but go ahead and do
list_flavors and get_flavor_by_id while we're looking at the extra
config override. Also remove list_projects because of its use of the
_normalize module.

keystoneauth lower-constraint needs to be bumped because of
status_code_retries.

Change-Id: Ibbe6e167d6285b30a9adbd0c5a89bc679c5645f3
2018-07-13 06:17:25 -05:00
Monty Taylor 7c9d461796
Convert image_client mocks in test_shade_operator
These two methods were mocking the image client.

Change-Id: I2a5c249f55662caaf3a669283721f283f6b1b565
2018-06-24 10:36:34 -05:00
Monty Taylor 2b48637b67
Use openstack.config directly for config
shade depends on openstacksdk already. Let's go ahead and start
consuming it directly rather than through the os-client-config compat
layer. We have to leave the os-client-config depend for the legacy
client functions.

Change-Id: Ibe2176c16e29960e9cc2b569325e41d1a4e297a8
2018-05-04 11:30:09 -05:00
Julia Kreger 15263d36b3 Switch baremetal nics/ports tests over
Moved baremetal port tests to a separate file and
updated them to utilize the new testing method.

Additionally, normalized the output of the port lists as
noise is introduced that is not needed.

Change-Id: I60492cca893e823cb2f9937405c75e23cc42807d
2017-11-26 20:41:06 -05:00
Julia Kreger 395d927081 Complete move of baremetal machine tests
Migrating tests to wrap up machine actions.

Ports will be migrated separately as there
will also need to be portgroups, which could
be wrapped into the same file/class depending
on how that ends up being implemented.

Change-Id: I239bbc134f42a47e8df75531dbd50916a97a6068
2017-11-19 01:34:33 -05:00
Julia Kreger b817f47782 Migrate machine tests related to state transitions
Migrating the machine tests where state transitions
occur, such as turning power on/off, maintenance mode,
hardware inspection, and general provision state changes
such as activating a node and deactivating a node.

Change-Id: I88663fecb79247d5473c47847f9c7405f447a80d
2017-09-08 18:53:52 +00:00
Julia Kreger c821c977b9 Migrate machine inspection tests to requests_mock
Change-Id: I53bfeff53d569a8075b40e4fb1087357f7eb4da0
2017-09-08 04:05:56 +00:00
Julia Kreger e8d37f8281 Migrate additional machine tests
Migrated a number of simpler machine tests to using rest calls,
while removing the mocked client versions of the tests.

Added additional patch_machine tests, which raised the fact that
patch method was not normalizing the data being returned.

Added normalization since those fields are not normally returned
by get_machine.

Change-Id: I1c5f4ebd06fff40da45dbcc0d6ea0f7b108ce8fa
2017-09-07 06:10:27 +00:00
Monty Taylor 4de4fb4a5a
Begin converting baremetal node tests
Shamelessly based upon pre-existing requests mock code in
shade, with the attempt to replace the existing baremetal
client mock testing.

This updates the way we're creating the ironic_client so that it
always does discovery, which _baremetal_client will always have
to do because of how the versioned discovery document is in ironic.

It also puts in a workaround for a bug that was found in keystoneauth's
new version discovery that we should eventually take out.

Change-Id: I0e811d69c3cba50f164cb2a3a1302b88fba51308
2017-09-05 13:43:48 -05:00
Béla Vancsics 05b0fe25cc Use more specific asserts in tests
Instead of assertTrue and assertFalse use more specific asserts.
They are compatible with Python 2.7[1] and 3.5[2]

[1]: https://docs.python.org/2.7/library/unittest.html
[2]: https://docs.python.org/3.5/library/unittest.html

Change-Id: Ie2e117935e12b9fb56c0b6070924786f9693421e
2017-08-01 10:18:30 +02:00
Monty Taylor d69b81fe00
Convert hypervisor test to requests_mock
Change-Id: Ie9acb8582ab52580c90b3511acf5e28eed2f9abf
2017-06-18 10:50:53 -05:00
Rosario Di Somma 4fce8d91f4 Rename obj_to_dict and obj_list_to_dict
Since we are actually to munch objects and not dict,
let's rename them to obj_to_munch and obj_list_to_munch.

Change-Id: Id4d77520237503bbfede89638675402d143fffcd
Signed-off-by: Rosario Di Somma <rosario.disomma@dreamhost.com>
2017-06-10 16:07:38 +00:00
Monty Taylor dc77e7d6c2
Convert first ironic_client test to REST
Add the various plumbing and convert one test.

Also, ironicclient prepends "v1" to all of its calls (joy) so there is
an ugly transition related to version discovery coming with this one.
For now just prepend it in our mock base class. When we convert calls,
we'll have to prepend v1 at the call site until we're done with the
transition. Then we can do a followup patch that'll do discovery and
remove the v1 from the code. Gross.

Change-Id: Icfd70267910d19a7da2ae8e9b9e4f24d2077b87d
2017-05-14 07:50:56 -05:00
Monty Taylor b459c8de5c
Futureproof keystone unit tests against new occ
We have a version of OCC coming out that fixes how keystoneclient is
constructed. The fix is good - however, it breaks a couple of places
where we're mocking to the old behavior. This will all go away once
we're done with keystoneclient-ectomy, so for now just put in a version
detection switch.

Change-Id: I9d4908ef12d40868dc207b130e3244577b9870e9
2017-04-18 14:09:17 -05:00
Monty Taylor fe130c620b
Enable H238 - classes should be subclasses of object
As shade is no longer an Infra project, it's no longer appropriate to
ignore hacking. Luckily, shade is mostly hacking clean anyway, so this
isn't terribly disruptive.

Change-Id: I607f1835abb328e3b4a4a33d80a1848ab11779be
2017-03-29 04:22:22 -05:00
Iswarya_Vakati 25405851b7 Removes unnecessary utf-8 encoding
This patches removes unnecessary utf-8 encoding

Change-Id: Ida121eb29eb8ea1b5fb40c3eb6843c4f9cb1caff
2017-01-11 16:42:25 +05:30
Andrey Shestakov 18916dea57 Add failure check to node_set_provision_state
When 'wait' is enabled in node_set_provision_state, exception should be
raised when machine failure occurred.

Change-Id: I5cc96127b4f44fdadbe75f5df5264565d4e646c9
2016-12-22 17:12:44 +02:00
Monty Taylor dd25a3c416
Remove a few glance client mocks we missed
Change-Id: Id4b5bc89e8829b3aebe67053b16c49abc60248c6
2016-12-12 14:01:54 -06:00
Monty Taylor 2a6ae13257
Use REST for listing images
Finally, the long awaited beginning of the removal of the client
libraries is upon us. Marvel in the wonder that is just making direct
REST calls. Allow yourself to be excited that soon we'll lose the
dependency on warlock.

Change-Id: I9d9f3b4762f9f61c5f325f9e47ea09a1261b02b3
2016-11-16 07:06:30 -06:00
Monty Taylor ae705ec878
Change deprecated assertEquals to assertEqual
It literally doesn't matter, but also getting deprecation warnings is
equally silly. Change the deprecated things to the non-deprecated one,
and then enable the check that prevents this from happening in the first
place.

Change-Id: Icd714da7ee881fad0c201e9cd56b32a4a330a431
2016-08-21 15:40:42 -05:00
Monty Taylor c40cc19381
Use cloud fixtures from the unittest base class
We need to do things to protect against local environment leaking into
the test fixtures when we create the cloud objects. Those things are all
done in the base unittest TestCase class, but for reasons that are hard
to fathom, we ignore that and create our own clouds in many of the
unitttest classes. This leads to problems if a user running the
unittests has cache config information in their local clouds.yaml.

Fix it.

Change-Id: I022d541d8e98bf4b6691bf0a91e3b7d20b2b7456
2016-08-21 11:17:56 -05:00
Jenkins 05384e5fc1 Merge "Add wait support for ironic node [de]activate" 2015-12-11 16:18:43 +00:00
Julia Kreger 3b50573f63 Add wait support for ironic node [de]activate
Original shade support for ironic node activation and deactivation
was without support for a wait option being passed into the helper
methods.

So the os_ironic_node module can be updated to support wait=True,
we need to add support in the activate_node and deactivate_node
methods.

Change-Id: I69eee2d254cde2fffcf0c1ac7679a623fa7f97a5
2015-12-11 08:48:53 -05:00
David Shrewsbury f0440f80b7 Improve test coverage: hypervisor list
The existing test for list_hypervisors() did not go deep enough
into the call stack to test the actual underlying nova client call.

Change-Id: I1d4cd9bc9424dfed6554794fa7a80db74cdac8a3
2015-12-08 10:35:41 -05:00
Monty Taylor f7ca875777 Let os-client-config handle session creation
More things than shade need consistent Session creation, so we moved
a copy of the shade code into os-client-config to allow python-*client
to consume the same logic. Now that it's there, consume it in shade and
remove the need for shade to know/duplicate the logic.

Depends-On: Ide4c613cc143a0b8a3f36130989b57e808b2530f
Change-Id: I86cdb3cdd2710ef302520184ccfcb1605384f706
2015-11-08 08:27:00 -05:00
Jenkins 19b6a7ca00 Merge "teach shade how to list_hypervisors" 2015-11-03 23:30:15 +00:00
Lars Kellogg-Stedman 234a2bf068 teach shade how to list_hypervisors
adds a list_hypervisors method to shade, along with a corresponding unit
test.

Change-Id: Ia7d8f7249356f28fdbad6c513adee4176615142f
2015-11-03 13:36:08 -07:00
Monty Taylor b7ad03eadc Minor logging improvements
While testing running an inventory on a clouds.yaml with 17 clouds,
errors popped up that were opaque. These are mainly just the things
I noticed doing that.

Change-Id: If3f0dc85b7a8d5a510f9f7b561f3c49edd817908
2015-11-03 10:22:21 -05:00
David Shrewsbury e2f0253547 Timeout too aggressive for inspection tests
The new ironic inspection tests has a timeout that appears may
be too aggressively low, which may be causing the iterator to give
up before yielding even once, on a random basis.

Change-Id: I18d447e092c74e21edcc7f90f36112d8c87ffee7
2015-11-01 13:31:09 -05:00
Julia Kreger 12e78681bc Add logic to support baremetal inspection
Ironic supports an inspect verb which directs ironic to boot
the node into a special firmware image in order to collect
properties from the remote node.

Change-Id: I4ba3f0cf4ad6f5466e52f5d034bb217f06eec7dd
2015-10-27 19:10:57 -04:00
Julia Kreger 80f2a21bc0 node_set_provision_state wait/timeout support
Addition of wait/timeout support for node_set_provision_state to
block the method until the machine has entered the desired state.

Combined with this, node_set_provision_state will now return the
state of the machine as opposed to just passing through the default
from the ironicclient node set provision state call.

Change-Id: I3e0bfe9e4612291dc77bd683479f7f99aef50d0a
2015-10-26 19:55:20 -04:00
Monty Taylor 137458fc1c Dont throw exception on missing service
We log exceptions to debug log, but checking for the existence of a
service is normal flow. Don't throw an exception when we can just
return None and have everything work without spamming logs.

Change-Id: I35f431b12c16e085c0e256cad514134066e15a39
2015-09-30 18:14:03 -04:00
Julia Kreger 8822b7ad56 Fix baremetal port deletion
Shade's node deletion logic removes ports one at a time in
the requested order, however that logic has been silently failing
to the API for some time now as we're inadvertently returning the
entire port object back to the API as the port we wish to delete
instead of the port UUID.

Changed to return the port UUID value to the delete call.
Added code to unit test to ensure that correct action is taken.

Closes-Bug: #1500063
Change-Id: I01c16990dc66988fab29c41ec4b4e6094213b2ca
2015-09-27 12:09:53 -04:00
Monty Taylor d084ebd643 Start using keystoneauth for keystone sessions
This is being split out from keystoneclient. That's a happymaking.
In order to make this work, we also need to fix glance image data upload
for v2 put. It seems that the internal interface has changed. Pass the file
object and not a size. We could do the work to figure out how to do it
in two discreet steps, but I believe that would involved a chunk of
engineering on a dead interface and is not worth it.

Also, Change ignore-errors to ignore_errors

Change-Id: I816752f8f4d29e40d41622bd8a271eb5c8e5a9fb
2015-09-21 11:12:21 -05:00
Julia Kreger b52d744781 unregister_machine blocking logic
Additional logic to preemptively prevent NIC removal when a
machine is unregistered by pre-validating if a node is can be
safely deleted.

Change-Id: I55152de9d42143be3b8a4e3da00da0bc0ec88dff
2015-09-03 11:40:00 +00:00
Jenkins 80093002f1 Merge "Addition of shade unregister_machine timeout" 2015-08-27 23:53:43 +00:00
Julia Kreger 2920aa0e82 Addition of shade unregister_machine timeout
Adds support for setting wait and timeout values for
the removal of machines from Ironic.

Change-Id: If08ccd60e18f2f5ceabecc07a2bbc380552a9af1
2015-08-22 18:16:10 +00:00
Julia Kreger de6cb78950 Initial support for ironic enroll state
Addition of logic for the ironic enroll state which will
ultimately permit a newer client library version.

Change-Id: I85fe0f2b2f0e6766928f9fb23cb1a8177779008c
2015-08-19 15:17:35 -04:00
Monty Taylor ad59fe3a72 Process config options via os-client-config
Assume that a cloud config object will be passed in. For compat,
create one and pass in kwargs if it's not - but based the internal
operation on the existence of a cloud_config object.

Change-Id: I31b2d851e0636c7742468aa62565295a2c5266e2
Depends-On: I8764ed68f8a38563c4242d4b50e2158e99ed4109
2015-07-28 09:44:43 -05:00
David Shrewsbury 735aae777e Convert ironicclient node.update() call to Task
Changes the node.update() calls to Task calls. Also adds missing
test cases.

Change-Id: Iaa97aef01b14c348b8cf9045b928a972151b0614
2015-06-22 12:15:20 -04:00
David Shrewsbury 5369ffc3dc Convert ironicclient node.get() call to Task
Changes the node.get() calls to Task calls. Also adds missing
test case.

Change-Id: I94b2c2bdb4c7c8bb7b96d3aa0e0117ec3585e620
2015-06-22 11:51:23 -04:00
Davide Guerri fdefa583ae Move TestShadeOperator in a separate file
This patch separate tests for OpenStackCloud and OperatorCloud classes.

Change-Id: I503c31cb6f15258572d85b8b82da03bee67b77f1
2015-06-22 15:49:23 +01:00