334 Commits

Author SHA1 Message Date
Jacob Anders
ec49ec035c Add missing whitespaces in test_virtual_media_certificates()
Change-Id: I1fbfd873ca79950304d04e70baad83dd562197d2
2024-02-15 14:40:32 +10:00
Steve Baker
382a548e31 Handle nova instance having no image
There will be no image when the instance boots from volume. In the
future there could be a fallback to fetch the metadata from the volume
but for now just return None for boot mode and secure boot.

Change-Id: I00576ee19571bd91683fd6c1754e0624e469b2c9
2024-02-01 18:08:53 +13:00
Sharpz7
905a39b4eb [codespell] Adding CI target for Tox Codespell
Third in a series of commits to add Codespell to Ironic Repos. This commit adds the Tox Target to CI

A future commit could potentially add a git-blame-ignore-revs file if their are lots of spelling mistakes that could clutter git blame.

Change-Id: I384db875eb9090e9d9e711af3479021bdbed5a26
2024-01-29 23:02:47 +00:00
Sharpz7
a4f23f3472 [codespell] Adding Tox Target for Codespell
Second in a series of commits to add Codespell to Ironic Repos. This one adds the command that was used to fix the spelling errors.

Future Commits will add CI support and potentially a git-blame-ignore-revs file if their are lots of spelling mistakes that could clutter git blame.

Change-Id: I3ab0d3acd2e008038605ea0fbfc4b199b312a6e5
2024-01-29 23:02:33 +00:00
Sharpz7
244620d8f5 [codespell] Fixing Spelling Mistakes
This is the first in a series of commits to add support for codespell. This is continuning the process completed in ironic-python-agent.

Future Commits will add a Tox Target, CI support and potentially a git-blame-ignore-revs file if their are lots of spelling mistakes that could clutter git blame.

Change-Id: I563e316ba9955766e28d9cec702387fac472c414
2024-01-29 19:12:47 +00:00
Zuul
5868dab414 Merge "Remove translation sections from setup.cfg" 2024-01-23 21:50:52 +00:00
Takashi Kajinami
70c119e381 Add Python 3.10 and 3.11 to supported versions
... according to the current PTI.

Change-Id: I6bc64d56a4d925ded50d5389723df1d9363f540b
2024-01-22 07:36:29 +00:00
Takashi Kajinami
70f037b1d9 Remove translation sections from setup.cfg
These translation sections are not needed anymore, Babel can generate
translation files without them.

Change-Id: Ief444d81e6a70960d40463568ab608c0991eba61
2024-01-22 07:36:22 +00:00
Takashi Kajinami
f907ec9c27 Fix broken unit tests with Werkzeug>=2.3.0
Werkzeug>=2.3.0 introduced a logic to detect incorrect Content-Type and
now returns 415 instead of 400 if an application tries to load request
body as json but Content-Type is not `application/json`.

This fixes the unit test broken by that change.

Change-Id: I3470813661be312eac7bbead91af7913aa15ac9d
2024-01-22 07:36:10 +00:00
Dmitry Tantsur
0e18baab40
Add feature sets to test with different available feature
* "full" is the default and provides all features
* "minimum" only provides boot settings
* "vmedia" is "minimum" plus virtual media and NICs

Closes-Bug: #2046153
Change-Id: I57cff90b1327104f65264d3fb87dafc89f3be521
1.1.0
2023-12-11 17:48:04 +01:00
Dmitry Tantsur
a654a033de
Expose VirtualMedia on Systems in addition to Managers
VirtualMedia on Managers is deprecated, so make System the primary
source while keeping compatibility.

Change-Id: I933d0d5c9f78109f46eb314bef05cc8d653d7137
2023-12-11 13:44:30 +01:00
Zuul
19acb66e91 Merge "Use WAL mode for SQLite cache" 2023-12-07 16:01:46 +00:00
Zuul
e901c91f62 Merge "Add new ironic driver" 2023-12-07 11:33:41 +00:00
Zuul
84fd13e14a Merge "Use a UUID instead of a named identity for httpboot" 2023-12-07 11:33:40 +00:00
Jakob Meng
361e0eef99 Use existing nvram path in libvirt driver to support session daemon mode
When libvirtd is started as a non-root user it does not have access to
folder /var/lib/libvirt. By default, libvirtd in session daemon mode
creates a nvram file at path ~/.config/libvirt/qemu/nvram/\
[DOMAIN]_VARS[EXT] instead [0],[1].

Querying the nvram path in session daemon mode is difficult because
libvirtd does not expose it nor $HOME of the user that runs the daemon.
As a workaround, this change will let libvirtd create the nvram file
path if it has not been previously defined [2]. However, if it had been
defined earlier then the path will be changed to enforce regenerating
it from the template.

[0] 2b148748c2/src/qemu/qemu_conf.c (L203)
[1] 2b148748c2/src/qemu/qemu_firmware.c (L1124)
[2] 2b148748c2/src/qemu/qemu_firmware.c (L1065)

Change-Id: Id78101f5c1f5fdf4b365d2d270dbde8877b05dbf
2023-12-04 21:24:30 +01:00
Julia Kreger
6b4e418d6d Use a UUID instead of a named identity for httpboot
This is an alternative to https://review.opendev.org/c/openstack/sushy-tools/+/902015
The tl;dr is we can leak the uuid out in some weird cases and
while things will just keep working, some methods internally
really just want a UUID and not a name. The other patch
is the name fix.

This, explicitly uses a UUID for httpboot, in the event
it is still happilly working with a name up until that point.

Change-Id: I52121f7e6148aaa3739bc9900b4480b7b3dff8fc
2023-11-28 09:05:12 -08:00
Julia Kreger
feb88a5c46 Simplify UEFI logic and change the UefiHttp flow
In trying to test the Redfish UEFI Http interface logic, it was
observed that we were not getting the values out of the emulator we
expected. So this change simplifies the logic which wasn't quite
working for us.

We also realized the code was trying to set the boot interface before
actually creating it. Doh!

It seems, also I might have had some other issues in the original patch
which we couldn't detect without fully getting everything working, so
some additional refactoring exists with this patch.

Change-Id: Ibfe5a560a25251965e8bad87012f64e89d9640be
2023-11-21 08:32:19 -08:00
Zuul
b5edaadd8d Merge "Add Support testing for HttpBootUri" 2023-11-13 10:03:20 +00:00
Julia Kreger
e14cfe361d Add Support testing for HttpBootUri
Maps the HttpBootUri to the virtual media functionality, so we can
leverage sushy-tools for testing HttpBootUri functionality.

Change-Id: I51a7e684bafdb6b3aa9adda35ae438c747c9847a
2023-11-03 07:12:46 -07:00
Iury Gregory Melo Ferreira
37f118237a Add BiosVersion field to System
Currently we don't have the BiosVersion information when
we query the System resource in sushy-tools, this cause
problems when checking the information with Firmware Interface

Change-Id: I8b5bf1387f32bd4d4bd91d3211782d900320b319
1.0.1
2023-10-25 09:44:21 -03:00
Derek Higgins
79cd737e65 Add new ironic driver
Add a driver to provide a limited emulated redfish
API to ironic nodes. This would be needed in cases
where a redfish compatible endpoint is needed but
but don't have direct access to the BMC (you only
have access via Ironic) or the BMC doesn't support
redfish.

Change-Id: I9a3f6a178978ef25efe5129d8bf5f94e031d9751
2023-10-09 17:56:31 +01:00
Dmitry Tantsur
259671612a Use WAL mode for SQLite cache
Change-Id: Idcca63c5365ef741a9f137a2b3b500b0c6cb7cef
2023-09-14 15:08:35 +02:00
Jay Faulkner
0246649c06 Update pep8 deps - now on latest hacking v6
Hacking bumped to 6.0.0.
No code changes needed for flake8.

Change-Id: I2bd57cd682081687f93baf4ffdd23b7332edb05c
1.0.0
2023-04-21 12:59:39 -07:00
Michele Costa
4357bf2347 Ignore FileNotFoundError when ejecting virtual media image
As these files are in /tmp the can be garbage collected
causing a FileNotFoundError. As it is trying to remove
the file anyway there is no reason to propogate this
error as the end result is the same.

Change-Id: If44be26e3fba70b89aec6ba88743d740276e7560
2023-02-21 14:14:33 +00:00
Zuul
7115db2f3a Merge "Save previous hd boot device when setting Pxe" 2023-02-17 17:45:33 +00:00
Zuul
e15cd2c2b4 Merge "Add mac address to the fakedriver node" 2023-02-16 16:29:37 +00:00
Mohammed Boukhalfa
879744ad62
Add mac address to the fakedriver node
Change-Id: I70c6ee68c66789f15f2dc2c56e23c797af6fa65e
2023-02-14 11:06:57 +02:00
Oliver Walsh
0a8c1b0d62 Fix libvirt forbidden error in set_boot_mode
get_xml_desc (unless dump_sensitive=False) requires a read-write libvirt
connection.
set_boot_mode was calling this using a read-only connection.

Related to: I562e19a4290df64010ef59f6c5d9f49aeb09a693

Story: 2010575
Task: 47322
Change-Id: I60a8a8b5678e548541c05ea1066032a338013aff
2023-02-08 17:31:23 +00:00
Zuul
af7de384e2 Merge "Add SecureBoot support to the emulator, all drivers" 2023-01-19 20:53:43 +00:00
arddennis
2a628d4099 Save previous hd boot device when setting Pxe
Assuming that sushy_tool ignores "BootSourceOverrideEnabled": "Once" for
libvirt backend, we define a new boot device permanently. And if the pxe
server does not reply after the first successful  provision, we just get a
vm which doesn't manage to boot after provision because netboot is the only
option and no reply from pxe.

This patch adds two additional lists of previously configured boot hard drives
for the vm at the end of the boot order. The first list is for the os section
If it is defined, it just adds all hard drives to the list. The second list is
for the actual drive section with the boot directive. 

Tried to save script logic as much as possible. But it might be reasonable to
pass one additional argument to the set_boot_device function to do such
altering when "BootSourceOverrideEnabled" is defined and has "Once" as a value

Added testcase to verify boot order definition

Change-Id: I0abcab9ccbffcc9b06382b0e6d335edd20db25bf
2023-01-12 13:50:32 +01:00
Riccardo Pittau
7c29b7b180 Fix tox4 error
Remove skipsdist that it was never supported and causes breakage
when used with usedevelop.

Also move to generic openstack test template.

Change-Id: Ie231aa8f574f882bb3879efcda2363a012e67caf
2023-01-03 09:26:39 +01:00
Steve Baker
41628d3546 Add SecureBoot support to the emulator, all drivers
This change adds a basic SecureBoot endpoint to the emulator which
returns the actual secure boot enabled status.

The fake and libvirt drivers supports setting the secure boot.

OVMF paths have aligned on /usr/share/OVMF/ since this is supported by
Red Hat and Debian family distros. Default and example firmware loader
is now OVMF_CODE.secboot.fd since this exists on all distros and is
known to work with both secure boot enabled and disabled on some
distros.

Change-Id: Icb85710d81c656da6853d67f5e1c6a8609abc1cf
2022-12-13 11:24:31 -08:00
Jay Faulkner
8427349985 Explictily document not for production use
Sushy-tools is a CI/development tool, for CI uses. It should not be run
in production.

Story: #2010382
Task: #46664
Change-Id: If90a38913f762ca4dc4f7b321b6b1e61db95105e
2022-10-26 09:30:13 -07:00
Julia Kreger
de5fad7368 preserve secure information on xml changes
When setting parameters revolving around boot
mode, options, firmware, it is necessary to
extract and edit the XML document.

Some details, however, are not automatically
extracted and libvirt must be told to provide
secure information. This change prevents us
from accidently loosing such configuration
parameters

Story: 2010382
Task: 46652

Change-Id: I562e19a4290df64010ef59f6c5d9f49aeb09a693
0.21.1
2022-10-25 18:50:08 +00:00
Zuul
35c8b86fa3 Merge "Add Chassis to ServiceRoot" 0.21.0 2022-09-08 17:42:43 +00:00
Serhii Skrypnik
0d49437e6f Add Chassis to ServiceRoot
This property is not required, but it would be nice to have it
along with existing Systems, Managers, Registers.

Story: 2010059
Task: 45509
Change-Id: I4c7c7b63e9e30f3dc5aecc4b83e015c3621cb3d3
2022-08-16 10:44:36 +00:00
Zuul
03265e59f8 Merge "List network interfaces of all types" 2022-08-16 10:37:58 +00:00
jiaqi07
152dc1d3eb remove unicode from code
Change-Id: Ie1988cb059e9bbfb5d310445a94dad5013e3c563
2022-08-11 15:02:40 +08:00
jiaqi07
d576943e05 remove unicode from code
Change-Id: I53703f067fb41c27e42a107883ad2562c6be4edb
2022-08-02 16:26:43 +08:00
Serhii Skrypnik
197087b333
List network interfaces of all types
Story: 2010061
Task: 45512

Change-Id: I1746e7c4cbbeecf691b205072ad113a160508e37
2022-08-01 23:13:03 +03:00
Zuul
23362129ed Merge "Document SUSHY_EMULATOR_ALLOWED_INSTANCES" 2022-07-28 10:19:55 +00:00
Zuul
360db16290 Merge "Fix per-request memoization" 2022-07-28 10:15:07 +00:00
Riccardo Pittau
58d7f8df31 Fix for werkzeug 2.2 routing change
Version 2.2.0 of Werkzeug brings a fix for an issue [1] related to
discarding trailing slash that modifies redirect behavior for
branches, effectively applying strict_slashes rule.

[1] https://github.com/pallets/werkzeug/issues/1074

Change-Id: Id08668d943be0ff94a191a1f06ba93eecbf74eb5
0.20.0
2022-07-27 11:57:14 +02:00
Riccardo Pittau
56e7ace0b7 Fix unit tests for Werkzeug 2.2.0
For some reason a get request on a root fails if the url does not
end with a trailing slash.
This started happening since Werkzeug version 2.2.0 [1].
This is NOT a proper fix but a workaround that can be merged to unblock
the CI.

[1] https://werkzeug.palletsprojects.com/en/2.2.x/changes/#version-2-2-0

Change-Id: I53ba35471bbbe4e08f5aa6144a58d72b83bc2de0
2022-07-26 18:21:44 +02:00
Zuul
809ee6e49f Merge "novadriver, don't use instance.flavor.id" 2022-07-15 18:13:20 +00:00
Dmitry Tantsur
413a205219 Replace the netboot job with a local-boot one
Change-Id: I4a65d79efaae0d0968233c9df722484a65f49930
2022-07-07 16:24:52 +02:00
Zuul
d293ae4359 Merge "aarch64/arm64 libvirt VMs should default to SCSI controller" 2022-06-27 03:14:37 +00:00
Riccardo Pittau
d8f0925ae8 Remove support for Python 3.6 and 3.7
Maintaining support for older not supported in Zed Python versions
would take too much effort with a lot of libraries dropping
compatibility with 3.6 and 3.7

Change-Id: I24a8806012dea6fe379aa49fe061f1c6a2243a86
2022-06-17 14:42:38 +02:00
Jeff Young
c0acc3de08 aarch64/arm64 libvirt VMs should default to SCSI controller
The current logic breaks when sushy-tools tries to mount virtual media to an arm64/aarch64 libvirt vm.
This is because by default it tries to connect and ide controller, and the only controller option for arm is scsi.

This patch ensures that aarch64 type vms will always get a scsi controller.

Story: 2009962
Task: 44940
Change-Id: Ib7c3267f401355cf045954e71fe7297b484508be
2022-05-18 10:01:06 -04:00
Steve Baker
c560bd3c78 Document SUSHY_EMULATOR_ALLOWED_INSTANCES
Change-Id: I632f68da2d06a4008f4df1fbe751c92e0120bf89
2022-05-13 14:46:02 +12:00