1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I0c903ca9d566c89e4e0d6bd129dc1f7bc3e95db9
The root device configuration code and unit tests come from the
python-tripleoclient project. By moving them into a common Mistral
action, they can be reused by other clients like the UI. The workflows
will also be used for the new 'overcloud node configure' command in the
client.
Change-Id: I5ba0a3710012c44822dd3b8e69662bbef04d3787
Related-Bug: #1595205
This patch removes the code previously committed for the API
implementation we abandoned in favor of Mistral workflows.
Change-Id: I34ece26dced3b4b07c030b7689f2b408925f86d6
Ironic API v1.11 introduced a new ENROLL state for newly-registered
baremetal nodes. Logic to allow the user to specify which initial state
to use (either ENROLL or the older AVAILABLE) was previously in
python-tripleoclient; this patch moves it into this repo, along with
supporting utility functions and tests.
Specifically, we
- add a `provide` keyword argument to utils.nodes.register_all_nodes;
when set to True, newly-registered nodes should be transitioned to
the AVAILABLE state;
- import the utility functions wait_for_provision_state and
set_nodes_state from python-tripleoclient;
- change set_nodes_state to return a list of node objects rather than
generating a sequence of UUIDs. This makes its results more useful to
client code.
Change-Id: I34d48293c90f9b3b18d05272166a72b61b209b66
This patch introduces tripleo_common.utils.{glance,nodes} modules.
The glance one is imported with only import fixes (including importing
a private exceptions module from the glance client).
The nodes.py is a rewritten and fixed version taken from
https://review.openstack.org/#/c/263309/. Main changes:
* Stop hardcoding flavor (e.g. agent, pxe) for each driver
* Support only generic properties with pm_* names. Driver-specific things
should stay with their prefix. Existing pm_* driver-specific things
were deprecated.
* Pass through everything that starts with driver-specific prefix to
node's driver_info.
* Dropped handling Conflict exceptions - ironicclient is doing it for
some time already (and does better job in it).
* Issue a specific exception for malformed instackenv.json.
* Optimize calls to ironic (use list with details instead of list+get)
* Use 'add' operation instead of 'replace', as it allows both adding
and overwriting (despite its name).
* Fixed some small issues like adding a dict to a set.
Change-Id: I7efffc5c6627776a20fad4bf4cf266330c4b8b6b