If two parallel greenthreads use the same, uninitialized client, there's
a race-condition when both enter `negotiate_version()`: there is a
request made to Ironic, which hands over execution to the other
greenthread. The first greenthread returning from the request changes
the state of the client and the second one reads the updated state and
thus thinks it's in an error-handling call instead of the initial
negotiation - and errors out.
We fix this by adding a lock around the initial call to
`negotiate_version()`.
Change-Id: I9ec03d2bc34017c7670fd6903e5353a8c91e9f17
Closes-Bug: #2119323
Signed-off-by: Johannes Kulik <johannes.kulik@sap.com>
(cherry picked from commit ad1291cc9c)
Python bindings for the Ironic API
Team and repository tags
Overview
This is a client for the OpenStack Bare Metal API. It provides:
- a Python API: the
ironicclientmodule, and - a command-line interfaces:
openstack baremetal
Development takes place via the usual OpenStack processes as outlined in the developer guide. The master repository is on opendev.org.
python-ironicclient is licensed under the Apache
License, Version 2.0, like the rest of OpenStack.
Contents:
Project resources
- Documentation: https://docs.openstack.org/python-ironicclient/latest/
- Source: https://opendev.org/openstack/python-ironicclient
- PyPi: https://pypi.org/project/python-ironicclient
- Bugs: https://storyboard.openstack.org/#!/project/959
- Release notes: https://docs.openstack.org/releasenotes/python-ironicclient/
Python API
Quick-start Example:
>>> from ironicclient import client
>>>
>>> kwargs = {'os_auth_token': '3bcc3d3a03f44e3d8377f9247b0ad155',
>>> 'ironic_url': 'http://ironic.example.org:6385/'}
>>> ironic = client.get_client(1, **kwargs)
openstack baremetal
CLI
The openstack baremetal command line interface is
available when the bare metal plugin (included in this package) is used
with the OpenStackClient.
There are two ways to install the OpenStackClient (python-openstackclient) package:
along with this python-ironicclient package:
# pip install python-ironicclient[cli]directly:
# pip install python-openstackclient
An example of creating a basic node with the ipmi
driver:
$ openstack baremetal node create --driver ipmi
An example of creating a port on a node:
$ openstack baremetal port create --node <UUID> AA:BB:CC:DD:EE:FF
An example of updating driver properties for a node:
$ openstack baremetal node set --driver-info ipmi_address=<IPaddress> <UUID or name>
For more information about the openstack baremetal
command and the subcommands available, run:
$ openstack help baremetal