112 Commits

Author SHA1 Message Date
ericxiett
50f914d088 Add missing description for params of 'start_iscsi_target'.
Change-Id: I3bbd092d0738110ad36f85f1d333273f46648d2b
Closes-Bug: #1691303
2017-05-18 07:57:36 +08:00
vmud213
85869a134b Remove unused function _configdrive_location
This function is never used and can be removed safely.

Change-Id: Ied7b4984185ea170d33cb57010de89edeaaaeec5
Closes-Bug: #1690135
2017-05-11 12:23:38 +00:00
John L. Villalovos
e9344077fc flake8: Specify 'ironic_python_agent' as name of app
Specify 'ironic_python_agent' as the name of the application for the
flake8-import-order plugin. That way it knows that imports of
ironic_python_agent should come after external libraries.

Change-Id: Id39d558a51aeb97d96633afea28676634547d0d7
2017-03-16 07:09:07 -07:00
Galyna Zholtkevych
9c2d0cdd85 Correct failure message output when downloading
This fixes unreadable output on download image failure.
Adding new instance variable to exception `ImageDownloadError` class
to avoid redundant logs.

Change-Id: I51782abd572588adfc62745eeab9c559eb8346dd
Closes-Bug: #1657691
2017-03-10 19:16:07 +00:00
John L. Villalovos
949f4f509e Use flake8-import-order
Use the flake8 plugin flake8-import-order to check import ordering. It
can do it automatically and don't need reviewers to check it.

Change-Id: I946457e9079ce0b54c7fe0ad554d024a1c61dce0
2017-02-16 09:46:21 -08:00
Jenkins
fd7f10b993 Merge "Configure and use SSL-related requests options" 2017-02-07 09:57:49 +00:00
Jenkins
465687940b Merge "Reboot and Poweroff fails with coreos IPA image" 2017-01-20 22:53:36 +00:00
Annie Lezil
20dc04e5e2 Reboot and Poweroff fails with coreos IPA image
The CoreOS IPA images do not support poweroff/reboot due to running in a
chroot. For this case, we fall back to forcing poweroff or reboot via
sysrq commands

Change-Id: I75d68b6308beba299d043e43a5fa1671b6ef3ada
Closes-Bug: #1628367
2017-01-20 12:55:12 -08:00
Jenkins
bbbea4601a Merge "iscsi: Listen for connections on both IPv4 and IPv6 ports" 2017-01-19 22:34:11 +00:00
Derek Higgins
1c493c470a iscsi: Listen for connections on both IPv4 and IPv6 ports
Allow connections if deploying over a IPv6 network.

Change-Id: Ib5b97e960fcb30b9a37c5971e88d5251905f8113
Closes-Bug: #1650540
2017-01-19 15:24:17 +00:00
Jenkins
7680625994 Merge "Use sh instead of bash when installing grub" 2017-01-18 10:27:56 +00:00
Pavlo Shchelokovskyy
a5370d52cd Use sh instead of bash when installing grub
there is no guarantee that 'bash' is present in a user's image,
while 'sh' as system shell must be there.
As we do not use any bash-specific syntax (just starting commands in a
subshell) when installing the bootloader from chroot-ed user image,
let's be more supportive and use 'sh' instead of 'bash' for that.

Change-Id: I1fb82068b9c55da35166d8d2ecf9f0ba41356adb
Closes-Bug: #1657096
2017-01-17 13:57:49 +02:00
Cao Xuan Hoang
6997907b07 Removes unnecessary utf-8 encoding
The following files added utf-8 encoding but never used. So we can
removes them at all.

ironic_python_agent/extensions/image.py
ironic_python_agent/extensions/iscsi.py
ironic_python_agent/tests/unit/extensions/test_image.py
ironic_python_agent/tests/unit/extensions/test_iscsi.py

Change-Id: Ifc98faf025ee81f885ea58d9203037c6357ea7f2
2017-01-16 08:25:10 +07: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
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
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
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
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
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
Josh Gachnang
fd874652e3 Add metrics support to IPA
This utilizes the new metrics support in ironic-lib to allow the agent to
report timing metrics for agent API methods as configured in ironic-lib.

Additionally, this adds developer docs on how to use metrics in IPA,
including some caveats specific to ironic-lib.metrics use in IPA.

Co-Authored-By: Jay Faulkner <jay@jvf.cc>
Co-Authored-By: Alex Weeks <alex.weeks@gmail.com>
Change-Id: Ic08d4ff78b6fb614b474b956a32eac352a14262a
Partial-bug: #1526219
2016-08-03 11:24:54 -07:00
Jim Rollenhagen
2e10d7b32c Fix doc warnings
Per Doug's email[0], 'warnerrors' in setup.cfg hasn't actually been
working for some time now, and we've piled up a few warnings. Fix these
before a pbr release to unbreak it gets pushed out and breaks our doc
builds.

[0] http://lists.openstack.org/pipermail/openstack-dev/2016-June/097849.html

Change-Id: I6576a56234918febb21e7e4860544eb952123c09
2016-07-14 14:37:02 -04:00
Lucas Alvares Gomes
af81914ce7 Add a log extension
The log extension is responsible for retrieving logs from the system,
if journalctl is present the logs will come from it, otherwise we
fallback to getting the logs from the /var/log directory + dmesg logs.

In the coreos ramdisk, we need to bind mount /run/log in the container
so the IPA service can have access to the journal.

For the tinyIPA ramdisk, the logs from IPA are now being redirected to
/var/logs/ironic-python-agent.log instead of only going to the default
stdout.

Inspector now shares the same method of collecting logs, extending its
capabilities for non-systemd systems.

Partial-Bug: #1587143
Change-Id: Ie507e2e5c58cffa255bbfb2fa5ffb95cb98ed8c4
2016-06-28 17:02:11 +01:00
Lucas Alvares Gomes
33535cd572 Get root device hints from the node object
In order to support a more complex syntax for root device hints (e.g
operators: greater than, less than, in, etc...) we need to stop relying
on the kernel command line for passing the root device hints. This patch
changes this approach by getting the root device hints from a cached
node object that was set in the hardware module.

Two new functions: "cache_node" and "get_cached_node" were added to the
hardware module. The idea is to facilitate the access to a node object
representation from the hardware extension methods without changing
method signatures, which would break compatibility with out-of-tree
hardware managers.

Note that the new "get_cached_node" is just a guard function to
facilitate the tests for the code.

The function parse_root_device_hints() and its tests were removed since
it's not used/needed anymore.

Partial-Bug: #1561137
Change-Id: I830fe7da1a59b46e348213b6f451c2ee55f6008c
2016-05-26 14:52:15 +01:00
Jenkins
6d8eaac8e3 Merge "Improve __str__ method of BaseCommandResult" 2016-04-07 22:42:36 +00:00
Jenkins
1121887d19 Merge "Fix incorrect formatting in the iSCSI extension" 2016-04-01 17:44:24 +00:00
Clif Houck
3cf5369cb6 Add docstrings to all functions in Agent standby extension
Change-Id: Ic8101a6b29dee4b79c2d7f3dc064e4c98a9a0741
Partial-Bug: 1367915
2016-03-31 11:44:50 -05:00
Dmitry Tantsur
e9dbf4acf2 Fix incorrect formatting in the iSCSI extension
Change-Id: I141c205dec838c64126106186a1352d032d8d987
2016-03-31 14:11:08 +02:00
Jay Faulkner
b176f29b3d Improve __str__ method of BaseCommandResult
Fixes nits raised in review for Change ID
I3ca0382f05e88700c56d3c7f4b4ecf7b8fc3bc0c

Remove useless id field, fix capitalization and grammar.

Change-Id: I7976993d1ac9354e035a5e7dba6ef8cc392537e3
2016-03-30 23:38:50 +00:00
Jenkins
698211b771 Merge "Add __str__ method to BaseCommandResult" 2016-03-30 18:46:15 +00:00
Julian Sy
d1060c0469 Add __str__ method to BaseCommandResult
Method was added so that logging could be more understandable

Change-Id: I3ca0382f05e88700c56d3c7f4b4ecf7b8fc3bc0c
Closes-Bug: #1506409
2016-03-29 16:54:48 +00:00
Haomeng, Wang
c83a968997 add new portal_port argument into iscsi.start_iscsi_target api
Currently we hardcode the iSCSI port to its default. With this
patch, we added new portal_port argument into iscsi.start_iscsi_target
api, cover both lio and tgt two iscsi target operations.

And for IPA client and driver code change, will commit more patch to
cover.

Change-Id: I6da20487ccba6cbac04d36b8643afdd1e3920b12
Partial-Bug: #1523829
2016-03-24 13:32:42 +00:00
Jenkins
858c643777 Merge "Add disk_label support for partition images" 2016-03-23 10:53:35 +00:00
Jenkins
16265a6c8b Merge "iscsi: wipe part table before starting the target" 2016-03-22 19:21:06 +00:00
Gonéri Le Bouder
0b1f01db94 iscsi: wipe part table before starting the target
If the local disk has already a partition table, it must be clean up
before the disk is exposed through iscsi. Otherwise this disk partition
can create a conflict during the grub installation.

How reproducible:

1. Inject an image on the root disk, like for example ipxe.usb or ipxe.iso
2. Try to deploy a system on the node using Ironic
3. The node is properly deployed but the grub installation has failed
   with the following error:
     attempting to install grub to a disk with multiple partition labels

A simple sgdisk -Z /dev/vdX is not enough because grub-install will
inspect the disk and will still detect a remaining partition.

This commit makes use of the ironic-lib to do the clean up of the disk.
The additional review Id59fa5a06b9115c0f9afc09aae95daaac97e2fac increase
the amount of data to wipe.

References:
https://bugzilla.redhat.com/show_bug.cgi?id=1310883

Partial-Bug: 1550604

Change-Id: Ie68cb6296c782e904d40f6e9de0faa52ab2af2bf
2016-03-22 13:28:21 -04:00
Nisha Agarwal
4ec49be8e2 Add disk_label support for partition images
This commit adds the disk_label support for partition
images. It also fixes the node_uuid info passed to the
ironic_lib.

Partial-Bug: 1560560
Change-Id: I8b8ef20787468c1b8dc6fbc0b8905abd285325e1
2016-03-22 16:59:38 +00:00
Nisha Agarwal
936b2e4c4a Fixes the agent message for uefi netboot for partition image
The agent returns "efi_system_partition_uuid=None" in the
status message for uefi netboot for partition images.
This commit fixes to remove this unwanted message
from the status message as efi partition is created only
for localboot.

Closes-bug: 1526289

Change-Id: I6376406cdde29493619f50b0a6cd8b6ce3784d6e
2016-03-21 18:11:32 +00:00
Jenkins
4f1caf11e9 Merge "Add sync() command to the standby module" 2016-03-21 09:51:44 +00:00
Lucas Alvares Gomes
4b802c47b5 Add sync() command to the standby module
This patch is adding a new command called sync to the standby module of
IPA. The new command runs synchronously and it's responsible for
flushing file system buffers to the disks.

The initial intention for this command is to use it as part of the fix
for the bug #1512492 where some hardware/firmwares do have problems to
come back online after a soft ACPI power off, therefore we need to call
sync() to make sure all file system buffers have been synced and then
issue a hard power off (e.g via the BMC).

Partial-Bug: #1512492
Change-Id: I5cd1d1b821426e995dc584452494b93ab23917e0
2016-03-18 15:20:48 +00:00
Faizan Barmawer
944595a69d Add support for partition images in agent driver.
It also adds the ironic-lib in the requirements
list of the IPA package.

Partial-bug: 1526289
Depends-On: I22bc29a39bf5c35f3eecb6d4e51cebd6aee0ce19
Change-Id: I37908470484744bb720f741d378106d1cb1227a3
2016-03-18 08:21:01 +00:00
Nisha Agarwal
bb605784dd Fixes programmatic error in _install_grub()
The patch defines the variables before they are used in the
code.

Closes-bug: 1555547
Change-Id: I27c5e926cf4001211c4edd794a09b26559c63f71
2016-03-11 21:09:37 +00:00
Jenkins
2a71a94208 Merge "Replace all the 'self.log' calls with global LOG" 2016-02-29 16:05:09 +00:00
Zhenguo Niu
7fe40bb559 Replace all the 'self.log' calls with global LOG
Change-Id: Iae917e1139c8c95a1bad5466df8a607656b9de5c
2016-02-24 09:51:01 +08:00
Zhenguo Niu
c716293cbf Catch OSError as well to return a better error message
When neither tgt nor linux-io are available, we only get error
message like 'No such file or directory', this situation should
be detected and return a better error instead.

Change-Id: I334717a1a8a728aa6da6024ff9fc6d817399a41f
Closes-Bug: #1540958
2016-02-22 15:10:57 +08:00
Jenkins
1e30946835 Merge "Allow hardware managers to override clean step priority" 2016-01-28 05:36:12 +00:00
Josh Gachnang
61b4387b95 Allow hardware managers to override clean step priority
If two hardware managers have the same clean step, for example
'erase_devices' in the GenericHardwareManager and a custom manager,
IPA must determine which step should be kept and which should be run
in order to prevent running the step multiple times.

This patch uses the following filtering logic to decide which step
"wins":
- Keep the step that belongs to HardwareManager with highest
  HardwareSupport (larger int) value.
- If equal support level, keep the step with the higher defined
  priority (larger int).
- If equal support level and priority, keep the step associated with
  the HardwareManager whose name comes earlier in the alphabet.

Other than individual step priority, picking which step to keep does
not actually impact the cleaning run. However, in order to make
testing easier, this change ensures deterministic, predictable
results.

Co-Authored-By: Mario Villaplana <mario.villaplana@gmail.com>
Co-Authored-By: Jay Faulkner <jay@jvf.cc>
Co-Authored-By: Brad Morgan <brad@morgabra.com>
Change-Id: Iaeea4200c38ee22cab72ba81c1dbae3389e675e4
2016-01-14 13:12:52 -08:00
Kan
dcdb06d812 Replace deprecated LOG.warn with LOG.warning
Change-Id: I0ca31eac70afaccda73e7819c582af0b226b8442
Closes-Bug: #1508442
2016-01-05 05:37:09 +00:00