41 Commits

Author SHA1 Message Date
Zuul
f6668f94c9 Merge "Move minimum ironic version to latest ocata" 2020-04-15 10:22:12 +00:00
Riccardo Pittau
6c51709a1a Move minimum ironic version to latest ocata
All other API versions from releases  before that are not
supported anymore.

Change-Id: I49fb3e4facdec42a4dab343c46a84f3cba6d2b7c
2020-04-08 15:40:02 +02:00
Riccardo Pittau
9ac6040110 Remove unused version parameter in version header function
The logic to determine the version when getting the ironic version
header is not influenced by the version parameter passed to the
function.

Change-Id: Ie52a82bf71a2277cea11fd2dedfd9c1e0001d95f
2020-04-08 12:17:41 +02:00
Julia Kreger
af5f05a0ee Agent token support
Adds support to the agent to receive, store, and return
that token to ironic's API, when supported.

This feature allows ironic and ultimately the agent to
authenticate interactions, when supported, to prevent
malicious abuse of the API endpoint.

Sem-Ver: feature
Change-Id: I6db9117a38be946b785e6f5e75ada1bfdff560ba
2020-03-12 10:35:17 -07:00
Doug Hellmann
f7740c7919 improve error messages during node lookup failures
The error messages reported on the console when the agent can't find
its node do not give enough information to debug the cause of the
failure. This change adds some basic details like the URL of the API
server and the addresses of the node being sought there.

Change-Id: Ia54faf05c80159d1d5fde0b222627c673f1cffe3
2019-06-26 11:54:19 -04:00
Sam Betts
903ec3ff12 Include IPA Version during heartbeat
In order for Ironic to know what parameters can be sent to IPA commands,
Ironic needs to know which version of IPA it is talking to.  This patch
adds a new node heartbeat parameter agent_version which will carry the IPA
version information to Ironic.

Change-Id: I27e3311accf3a113a48a73df372ed46ff50c7e22
Partial-Bug: #1602265
Depends-On: I400adba5d908b657751a83971811e8586f46c673
2017-12-07 12:16:06 +00:00
Pavlo Shchelokovskyy
fdd11b54a5 Configure and use SSL-related requests options
This patch adds standard SSL options to IPA config and makes use of them
when making HTTP requests.

For now, a single set of certificates is used when needed.
In the future configuration can be expanded to allow per-service
certificates.

Besides, the 'insecure' option (defaults to False) can be overridden
through kernel command line parameter 'ipa-insecure'.
This will allow running IPA in CI-like environments with self-signed SSL
certificates.

Change-Id: I259d9b3caa9ba1dc3d7382f375b8e086a5348d80
Closes-Bug: #1642515
2017-01-13 11:33:44 +02:00
Derek Higgins
9f5f664080 Advertise the correct address when using IPv6
Parse the output of "ip route get $IP" taking
IPv6 into consideration. Also wrap the IP address
in square brackets if it is IPv6.

Change-Id: Ifc44e5aa3c5b814b6ceba04461bb68fe1d75c22b
Closes-Bug: #1650533
2017-01-11 11:00:56 +00:00
Luong Anh Tuan
ab41106cf6 Python 3 Compatible JSON
In order to be really python3 compatible, the json lib was replaced
with oslo.serialization(1.10 or newer) module jsontuils since it's
the recommended migration to python3 guide.

https://wiki.openstack.org/wiki/Python3#Serialization:_base64.2C_JSON.2C_etc.

Change-Id: I2d8b62e642aba4ccd1b70be7e9b3784a95a6743d
Closes-Bug: #1629068
2016-11-16 08:19:51 +00:00
Jenkins
f330dac837 Merge "Remove old lookup/heartbeat from IPA" 2016-11-13 13:03:39 +00:00
Pavlo Shchelokovskyy
b033bfd933 Remove old lookup/heartbeat from IPA
Lookup/Heartbeat via vendor passthru was deprecated in Newton.

This patch removes the corresponding functionality from IPA,
and also removes handling of 'ipa-driver-name' kernel parameter,
as it was only used in code related to old passthru.

Change-Id: I2c7989063ab3e4c0bae33f05d6d2ed857a2d9944
Closes-Bug: #1640533
2016-11-09 16:34:44 +00:00
John L. Villalovos
0b8763e332 Update to hacking 0.12.0 and use new checks
Use hacking 0.12.0

Use the new checks that are available:
    [H106] Don’t put vim configuration in source files.
    [H203] Use assertIs(Not)None to check for None.
    [H904] Delay string interpolations at logging calls.

Fix code so tests pass.

Change-Id: If22ad272c332f30624ce10861408d377908b152b
Depends-On: I2aa44b62f900d4dfd67701b01eadd0523fbfaf07
2016-11-08 11:31:18 -08:00
John L. Villalovos
20d960ff98 Remove Python 2.6 format style
In Python 2.6 it was required to use {0}, {1}...{n} when using the
string format function. In Python 2.7 and Python 3 it it not required.

Change {N} to {} in code.

This brings the code in style alignment with other projects like
ironic and ironic-lib.

Change-Id: I81c4bb67b0974f73905f14b589b3dd0a7131650d
Depends-On: I8f0e5405f3e2d6e35418c73f610ac6b779dd75e5
2016-10-06 09:05:26 -07:00
Julia Kreger
fb1cbbdafc Fix IPA for stable/mitaka with noauth mode
In noauth mode when running stable/mitaka, Ironic responds to the
initial lookup request with code 406, NOT_ACCEPTABLE, due to the client
supplied microversion of 1.22 by IPA.

As such, we should fallback upon receiving the 406 error code.

Related-Bug: #1616461
Change-Id: Ief9c151cf27a3c38c33a837bb7d6581868a3dc22
2016-08-26 13:06:34 +00:00
Lucas Alvares Gomes
09d5d0c377 Fallback to the old /lookup endpoint on 401
Prior to this patch the ironic-python-agent service would only fallback
to use the old endpoints for /lookup and /heartbeat on a 404 error but,
since Ironic will check auth (if enabled) before it routes the requests
a 401 (Unauthorized) was returned.

Closes-Bug: #1612696
Change-Id: Idba5fed587e77aaa683d2c2b2126a520214712ce
2016-08-12 16:41:51 +01:00
Dmitry Tantsur
09265ba4b5 Use new agent API if available
Falls back to vendor passthru on receiving 404.

Also fixes logging around lookup: log traceback on unexpected
exceptions, log successful lookup and replace % with ,

Change-Id: I7160c99ca63585fc333482fa578fdf5e0962b2b6
Depends-On: I9080c07b03103cd7a323e2fc01be821733b07eea
Partial-Bug: #1570841
2016-08-05 12:02:41 +02:00
Lucas Alvares Gomes
f09dce79af Fix programmatic error in heartbeat()
This patch is fixing a programmatic error in the heartbeat() method of
the APIClient() class. When 409 (Conflict) was returned from the the
Ironic API the code wasn't parsing the content of the response
correctly.

Change-Id: I01fbb8d866b2f94fe128d0bc40b69d05b5add1a3
Closes-Bug: #1556199
2016-03-11 16:58:28 +00:00
Zhenguo Niu
d25d94b316 Change to use WARNING level for heartbeat conflict errors
It's normal that ironic returns 409 Conflict from time to time, so
it's a bit confusing that we report this with Exception level and
traceback.

Change-Id: I1627c61facc3fadd0f5d9d324150e7d2833c7fbc
Closes-Bug: #1533113
2016-03-06 17:13:02 +08:00
Zhenguo Niu
7fe40bb559 Replace all the 'self.log' calls with global LOG
Change-Id: Iae917e1139c8c95a1bad5466df8a607656b9de5c
2016-02-24 09:51:01 +08:00
Joshua Harlow
df701c979c Replace backoff looping call with oslo_service provided version
The code that comprises the backoff looping call moved to
oslo.service in 0.10.0 and IPA can use that version so remove
the local backoff code and just prefer the oslo.service maintained
and supported version instead.

Change-Id: Ifec3490f9e5c68859deff4a951dcdf59caa7ca3a
2016-02-04 12:22:21 -08:00
Dmitry Tantsur
dab1ce9831 Allow passing node UUID to lookup
After successful inspection we will know node UUID already, so no need
to do a proper lookup. In the future we might get rid of lookup completely
in this case.

Change-Id: Ic00049bf69f9ecc59ac4e389a3e6afe20ba67aba
2015-08-21 16:25:04 +02:00
Sergey Vilgelm
64fd0fe37f Switch to oslo.service
oslo.service has graduated, so ironic should consume it.

Change-Id: I4560f3050bd8ce7e0c40a5cd5fb6a5a1b410f728
Partial-Bug: #1466851
2015-06-24 11:19:07 +02:00
Jim Rollenhagen
601201d120 Update hacking and fix hacking violations
This does a few things:

* Update hacking to the version in global-requirements. Old hacking was
  installing a version of pbr that was breaking other packages.

* Fix all the hacking/pep8 rules that updating hacking raised.

* Do some general docstring cleanup, while already in there cleaning up
  a bunch of docstrings due to H405 violations.

Change-Id: I1fc1e59d4c3d7b14631f8b576e3f3854bc452188
Closes-Bug: #1461717
2015-06-03 16:58:57 -07:00
Ghe Rivero
10a3a800e7 Use oslo_log lib
Module 'log' from oslo-incubator was removed after release of oslo_log
library.

Change-Id: Ia00e26071fc0cab4fd3f3334ca94860bc7b1c75c
2015-03-24 08:43:35 +01:00
Russell Haering
1893e02c10 Reduce requests connection pool size
Requests defaults to keeping 10 connections to the API alive. This
seems excessive, reduce it to 2.

Change-Id: Iac67fd4d855388d2671da3b7258b31d1eead77a9
2014-06-16 15:46:01 -07:00
Jim Rollenhagen
c5e8670b23 Remove Heartbeat-Before check from heartbeat
Ironic does not send this header - agent should not look for it.

Change-Id: I7b8857fa5f744bc03ee0907424a95b9305811c51
2014-04-25 13:31:47 -07:00
Jim Rollenhagen
81c1ea4744 Fix expected status code in Ironic heartbeat
The agent previously checked for a 204, Ironic actually returns
a 202 for heartbeats.

Change-Id: I7ef45dd13dee3c40802aee3424afa3f67bf4a237
2014-04-24 11:05:18 -07:00
Jim Rollenhagen
98791c4547 Revert "Fix expected status code in Ironic lookup"
This reverts commit 7b8b06c71401b5ce13fc73ed13b0e49e648cba8b.

The wrong function was fixed - it was the heartbeat, not the lookup,
that was checking for the wrong status code.

Change-Id: I35f49ca4fa1295d266f68b72b6ecdd5184181bd5
2014-04-24 11:04:53 -07:00
Jim Rollenhagen
7b8b06c714 Fix expected status code in Ironic lookup
Ironic returns a 202 on successful lookup, the agent previously
expected a 200.

Change-Id: I180f411024a4bd82eff581037352c65d14b2d3a4
2014-04-24 08:26:23 -07:00
Jim Rollenhagen
46e9776d42 Use configurable driver name in lookup URL
Allow configuration via command line arguments or kernel parameters.
Default to agent_ipmitool, the reference driver.

Depends on https://review.openstack.org/#/c/84795/12

Change-Id: I55c4a8713308d038002a6567471cd862bf89ec76
2014-04-14 11:32:16 -07:00
Jenkins
88f06e2831 Merge "Use # instead of """ for copyright blocks" 2014-04-11 23:47:09 +00:00
Jay Faulkner
1384d79d2c Implement version 2 payload with more hw info
Bumping the payload version to two, and adding CPU, Memory, and Block
Device information to the inventory.

Added dependency on psutil for available memory and cpu_count.
Requirements line copied from global requirements

Change-Id: Ia39c85c91b1d60468667787a7978020084dc6c2a
2014-04-10 17:37:54 -07:00
Jenkins
bbe50749fc Merge "Add BackOffLoopingCall with jitter" 2014-04-11 00:07:58 +00:00
Jim Rollenhagen
3c1d52cbb1 Use # instead of """ for copyright blocks
Reformats copyright messages to be comments rather than
docstring-style blocks.

Change-Id: I4d863f53b67bb49d03bda0952b9e6179b6d23c59
2014-04-10 07:14:06 -07:00
Jim Rollenhagen
b826a72a7b Version node lookup payload
This payload may change over time and should be versioned.
Corresponds to https://review.openstack.org/#/c/85228/

Change-Id: I58b1d69a2c41ff105038178632e289cb4b12c971
2014-04-08 13:16:46 -07:00
Josh Gachnang
bd25174338 Add BackOffLoopingCall with jitter
Using DynamicLoopingCall involved a few hacks to make it work properly. This
new BackOffLoopingCall will start an exponential backoff (with a configurable
jitter) when there is a failure. The backoff will continue until the given
function returns True or timeout is about to be exceeded. The function will
run indefinitely until either an exception is raised or timeout is reached.
I plan to merge this into oslo loopingcall and switch the heartbeat to this.

Change-Id: I1482348e98c6b68c34b3003645029e08135b1341
2014-04-07 10:59:47 -07:00
Josh Gachnang
3bc4866a21 Adding DynamicLoopingCall around lookup
Currently, if a single lookup call to the Ironic API fails, the entire
agent errors out and restarts. This allows the agent to retry for a set
amount of time before throwing an uncaught exception forcing a restart.

Change-Id: I39752fb3f42ad3e4f15a49194f1554e1d3463cf8
Closes-Bug: 1297019
2014-03-31 14:54:14 -07:00
Jim Rollenhagen
6329ae46db Fix URL for node lookup
Change-Id: I5b128a74bf0442f61d722978308c03c6ec45f8d8
2014-03-27 12:35:16 -07:00
Josh Gachnang
d8c0f1b794 Actual exception message, stylistic changes 2014-03-20 15:57:20 -07:00
Josh Gachnang
6dc09f3148 Getting the heartbeat from Ironic instead 2014-03-20 15:18:48 -07:00
Josh Gachnang
5914e36b30 Replacing teeth/overlord with ipa/ironic 2014-03-19 16:19:52 -07:00