461 Commits

Author SHA1 Message Date
Jenkins
a6b09f2fa8 Merge "Use oslo_serialization.base64 to follow OpenStack Python3" 2017-01-02 16:57:44 +00:00
Joanna Taryma
83a19a4844 Fail IPA startup if no protocol prefix in ironic api address
Add regex validation of api_url specified in configuration file.
Oslo config will raise exception if no supported protocol prefix
is included in Ironic api address in configuration file.
Supported protocols are http and https.

Closes-Bug: #1630785
Change-Id: I437b4ea0a2995921ddede03bc670087fdbbc8b83
2016-12-23 16:13:25 +01:00
Jenkins
8271996fe8 Merge "Add a new Hardware Manager for CNA network card" 2016-12-19 16:16:10 +00:00
Jenkins
4cf29db7e2 Merge "Use oslo-config-generator for sample config" 2016-12-16 19:42:46 +00:00
Luong Anh Tuan
81780adef8 Use oslo_serialization.base64 to follow OpenStack Python3
This patch replaces python standard base64 library call to
oslo_serialization.base64 to follow OpenStack Python3 porting
standard [1].

Use base64 encoding takes 8-bit binary byte data and encodes it. On
Python3, A string is a sequence of Unicode characters thus base64 has
no idea what to do with Unicode data, it's not 8-bit[2]. We use
oslo_serialization.base64 for both python2 and python3.

[1] https://wiki.openstack.org/wiki/Python3
[2] http://stackoverflow.com/questions/8908287/base64-encoding-in-python-3

Change-Id: I1dafe878a71f37d223eaf58ea8e2e8c6b4422a14
2016-12-16 04:29:16 +00:00
Jenkins
28da1ca05a Merge "Moving Reboot bashscript to python" 2016-12-15 01:40:02 +00:00
Bharath kumar
9948349b10 Moving Reboot bashscript to python
Currently a reboot bash script file is used to call reboot and
poweroff operation. Deleting this file and moving the code to
python file using utils.execute()

Partial-Bug: #1557542

Change-Id: Iad9cd9d15417e9a954d108d2759e6303452fca27
Author: Bharath kumar <shettybharath4@gmail.com>
Co-Authored-By: Annie Lezil <annie.lezil@gmail.com>
2016-12-15 00:05:03 +00:00
Szymon Borkowski
ef47d62f43 Add a new Hardware Manager for CNA network card
This patch adds a new hardware manager, which will disable the embedded
LLDP agent on Intel CNA network cards in order to allow the gathering of
LLDP data during the inspection process.

Change-Id: I572756ac6a7bf67a7f446738ba9d145e1c1bdc48
Closes-Bug: #1623659
2016-12-12 17:17:23 +01:00
Pavlo Shchelokovskyy
762f3bf4e6 Use oslo-config-generator for sample config
The old generate_sample.sh is broken already as it refers to
non-existing openstack/common path.

Let's use oslo-config-generator as many other OpenStack projects do.

Also, where applicable, option descriptions are updated with the
corresponding kernel parameters to set those options durig pxe boot.

Change-Id: Id4a0df30ea573d52f3b359f357fe8f4a29751939
2016-12-09 21:01:02 +02:00
Jenkins
005927b80e Merge "Add HCTL to BlockDevices" 2016-12-08 22:32:29 +00:00
John L. Villalovos
9ebb70d2fd Update mock variable name in unit tests
In test_agent.py change variable names from 'mocked_' to 'mock_' to
follow convention we use in openstack/ironic.

Change the mock variable names 'wsgi_server_cls' and
'mocked_server_maker' in some of the unit tests to
'mock_make_server'. It is the convention to have 'mock' in the
variable names for mock objects.

Not changing the other unit test files at this time.

Change-Id: I844071c928f92778e8ce0bfbdb8fb89fc26ee43b
2016-12-07 13:37:34 -08:00
Jenkins
9f9b5b5c43 Merge "Skip API related work if no api url configured" 2016-12-07 17:05:39 +00:00
Lucas Alvares Gomes
b272426562 Add HCTL to BlockDevices
This patch is adding a "hctl" attribute to the BlockDevices. HCTL stands
for: Host, Channel, Target and Lun, which is basically the SCSI address.

The idea behind this patch is to allow root device hints to find the
disk for deployment based on the SCSI address.

Partial-Bug: #1648036
Change-Id: If8897c68609e0df0378ee919b803ca5e497def02
2016-12-07 16:51:30 +00:00
Yufei
dd9253f1b6 Skip API related work if no api url configured
Currently, if IPA is booted without an ironic api url, it will default
to localhost and fail to connect. Instead, we now explicitly fail and
print a log message if no api callback url is provided.

Change-Id: I0271be94ba7febc6abd5bf3343f6fa179bc1a6a4
Closes-Bug: #1643966
2016-12-07 17:04:05 +08:00
Moshe Levi
92ced38bfe Fix docsting in Mellanox _detect_hardware
This is followup patch from the review
of this I4e7f7649a1bdeaa3ee99b2748037b0f37fea486c
commit.

Change-Id: I3151daec4ff4ed9c7159a9f3f7f25367586cf3ae
2016-12-06 15:32:07 +02:00
Jenkins
3a858fe779 Merge "Fix two typos, "messsage" and "containg"" 2016-11-24 17:19:01 +00:00
Moshe Levi
1bdcd4449f Add a new Hardware Manager for Mellanox NICs
This patch add Mellanox Manager to support Mellanox
InfiniBand NICs.

It adds client_id to the NetworkInterface for the
InfiniBand network interface.

The Mellanox Manager provides it own implementation of
get_interface_info. The mlnx get_interface_info generate
InfiniBand MAC and client-id from the InfiniBand network
interface address.

Closes-Bug: #1532534

Change-Id: I4e7f7649a1bdeaa3ee99b2748037b0f37fea486c
2016-11-22 15:46:12 +01:00
Nam Nguyen Hoai
41cf45f126 Fix two typos, "messsage" and "containg"
This patch set updated two wrong words:
+ In error.py file, it should be changed from "messsage" to "message"
+ In utils.py file, it should be changed from "containg" to "contaning"

Change-Id: I5ad121ec58ccc6e5f3cc499eca50d16e691f217e
2016-11-22 08:56:33 +07:00
Jenkins
f9236682f7 Merge "Dispatched out network interface info to all hardware managers" 2016-11-20 13:05:01 +00:00
Moshe Levi
966db1c18c Dispatched out network interface info to all hardware managers
This patch dispatches out the network_interface_info
to allow vendor hardware managers to plug the spacific
implementation. It also move neworking releated methods
form hardware to netutils
Related-Bug: #1532534

Change-Id: Idcd25c4753c009b5ba70bea97ee4eb83391a77a9
2016-11-17 13:08:03 +02: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
Jenkins
b2e608a94c Merge "Add bash scripts style checking for IPA" 2016-11-10 12:48:26 +00:00
John L. Villalovos
13c9350699 Clarify test comment to minimize confusion
Wording was a little confusing. Try to make it more clear.

Change-Id: Iad280314bf4929b18b1493bd7e9a26fc58297ee1
2016-11-09 14:59:30 -08:00
Jenkins
a6d6e477e3 Merge "Fix several errors in LLDP handling code" 2016-11-09 22:33:22 +00:00
OpenStack Proposal Bot
c40575e4e0 Add bash scripts style checking for IPA
Updated file tox.ini allows to check code style in all ".sh" files
included in Ironic Python Agent. Checking can be invoked by calling either
"tox" or "tox -e pep8".

Change-Id: Ie76605737c7db10a064f2aebfda388372a4c0591
Closes-Bug: #1625215
2016-11-09 14:14:40 -08: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
Dmitry Tantsur
b864a8c566 Fix several errors in LLDP handling code
* Stop silencing exceptions in raw socket context manager
* Correctly handle receiving packages with odd size and too small ones
* Fix a unit test that was testing nothing due to bad mocking

Change-Id: Ic8626d10618f52d50667d2698f34a92f5dcac33e
Closes-Bug: #1640238
2016-11-09 15:02:54 +01: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
Luong Anh Tuan
ef6c1cb9ce Replaces uuid.uuid4 with uuidutils.generate_uuid()
Openstack common has a wrapper for generating uuids.We should
use that function when generating uuids for consistency.

Change-Id: Ifb7b15fc8634338fc535de8043053e41aa93968a
Closes-Bug: #1082248
2016-11-08 09:06:45 +00:00
Shivanand Tendulker
7471d4004e Remove duplicated logging in configdrive creation
Ironic-lib logs a message when configdrive is created
successfully. Remove duplicate message from IPA.

Change-Id: I2af81cdfda4cfc004288f44d14a5c127639cc1f1
2016-10-26 02:47:53 -07:00
Jenkins
0727443b1a Merge "Use ironic-lib to create configdrive" 2016-10-21 15:42:59 +00:00
Shivanand Tendulker
3665306dfb Use ironic-lib to create configdrive
Shell script to create config drive being replaced with python
code in ironic-lib.

Closes-Bug: #1493328

Change-Id: I31108f1173db3fb585386b2949ec880a95305fb6
2016-10-21 03:39:06 +00:00
Jenkins
c393214528 Merge "Install grub in the EFI "Fallback path"" 2016-10-20 16:18:49 +00:00
Derek Higgins
cc5556d06b Install grub in the EFI "Fallback path"
In systems where the nvram may have been reset, add
\EFI\BOOT\BOOTx64.EFI to the EFI system partition so that
the image continues to boot. This will be particularly useful
if the NVRAM wasn't written correctly or if the baremetal
server is be simulated on virt and the NVRAM was been reset
on start (as is the case in libvirt).

Change-Id: I5005ae02c283cdc01540ea46c341a7b0bf9d4c42
Closes-Bug: #1632637
2016-10-20 13:50:02 +00:00
Vladyslav Drok
7bda3408f5 Fix config drive writing script
When the deployment happens on a GPT disk with config drive, writing
it to disk fails. Three reasons for that:

* parted should be used instead of partprobe to determine the type of
  the disk;
* gdisk -l sorts the partitions by their number, sort them by start
  sector instead;
* after sgdisk completion, the configdrive device is not immediately
  visible in the /dev folder, udevadm settle needed here too.

Closes-Bug: #1633063
Change-Id: Ifed89e343f9db4cf303baf7f8823342f6041f202
2016-10-18 00:28:04 +03:00
Lucas Alvares Gomes
cca1cd48ef Add support for root device hints with operators
This patch is updating IPA to use the match_root_device_hints() method
provided by ironic-lib version 2.2.0.

Partial-Bug: #1561137
Depends-On: I1d9dc7a57ea391a3419710c289242b39a4201463
Change-Id: Id93dd0360137df600f5a656348279e56c6b84bf9
2016-10-11 15:43:50 -03: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
Jenkins
6f98e534f5 Merge "Add vendor, product to interface information" 2016-09-21 15:43:10 +00:00
Moshe Levi
fe3b630360 Add vendor, product to interface information
This patch updates the interfaces JSON to include
vendor and  product
u'interfaces': [
    {
        u'mac_address': u'00:0c:29:8c:11:b1',
        u'name': u'eth0',
        u'ipv4_address': None,
        u'switch_chassis_descr': None,
        u'switch_port_descr': None,
        u'lldp': None,
        u'vendor': u'0x15b3',
        u'product': u'0x1014,
    }]

Co-Authored-By: yogananth subramanian <ysubrama@redhat.com>

Closes-Bug: #1611856

Change-Id: I8fa58dde29601abee959f74b69b692ed9eaffb94
2016-09-21 10:14:26 -04:00
Galyna Zholtkevych
993149cfb4 Improve error message while download image
Collecting warning logs in the case of download failure
and write them to error logs in the end. This will help
a user to diagnose a problem when warning log was not
enabled.

Change-Id: I4198d7be08fc11b616b3f95c595ff53794436e24
Partial-Bug: 1512186
2016-09-21 10:02:22 -04:00
Jenkins
c4c7115d4f Merge "Fix IPA for stable/mitaka with noauth mode" 2016-09-01 09:19:52 +00:00
John L. Villalovos
abf98ae84a Use namedtuple to improve code readability
Use the namedtuple class to improve code readability by creating a Host
class with namedtuple to store the 'hostname' and 'port'

Replace foo[0] with foo.hostname, and foo[1] with foo.port to make code
more readable.

Change-Id: Ie2b5f9cf89e7ccbbcf0a2573dab6f6c5d14c018b
2016-08-30 16:12:29 -07:00
Jenkins
aa4c889a06 Merge "Using assertIsNone() is preferred over assertEqual()" 2016-08-29 18:43:18 +00:00
Gábor Antal
4facf2c385 Changed an assert to more specific assert method
Following OpenStack Style Guidelines [1], I changed:
assertFalse(sth in sth) to assertNotIn(sth, sth).

After this change, a more specific message is shown on error.

[1]: http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises

Change-Id: I5d47d775dcff194693d97db6b797b7b027cbab56
2016-08-29 15:40:44 +02:00
Luong Anh Tuan
814b60def3 Using assertIsNone() is preferred over assertEqual()
Following OpenStack Style Guidelines[1]:
http://docs.openstack.org/developer/hacking/#unit-tests-and-assertraises

[H203] Unit test assertions tend to give better messages for more specific assertions.
As a result, assertIsNone(...) is preferred over assertEqual(None, ...)

Change-Id: I53c6d6d3e53d9fac38c50faf065c131d3aa55224
2016-08-29 05:22:33 +00: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
Julia Kreger
95f31be108 Re-use API client for Heartbeat operations
Re-initialization of the API client causes the identification
of an older ironic API to be forgotten.

As such, we need to re-use the API client from the initial lookup
for the heartbeat.

Tested with current master branch and stable/mitaka ipa
in noauth mode, and was able to deploy without any issues.

Closes-Bug: #1616461
Change-Id: I3ae1e2ce83f614b5b936a3cbb1b9587c6c55a89a
2016-08-26 12:53:30 +00:00
Robert Li
9e4b769055 Build socket list right before select call
This will make sure the socket list and the interface list are
always in sync, and the select call is on the right list of
sockets.

Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com>
Closes-Bug: #1533892
Change-Id: Id6710f4648203b7d476a2a16ea647224baca1bb9
2016-08-17 16:35:07 +02: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