178 Commits

Author SHA1 Message Date
Takashi Kajinami
9b27968a04 Stop accepting encoded JSON string
... to avoid redundant parsing of json content from a given string.

This also allows us to add more strict validation later using Struct
data type.

Change-Id: I2a8bbd266d5e97a06b89c131bbd86e3710a68923
2025-03-17 01:43:38 +09:00
Takashi Kajinami
c023e8bff9 Use only Hash value for properties
Drop support for string value and accept only hash values, to make
the interface consistent with cinder_* resources. This allows us to
avoid wrong interpretation of input values.

Change-Id: I29a79e4a66ce91647a216511213c2a59eb49c12b
2024-10-24 10:11:08 +09:00
Takashi Kajinami
06159d4b23 Use common function to parse python list
Depends-on: https://review.opendev.org/931749
Change-Id: I152c9871c2fcf909328eb6d8cf73a23d7c32070c
2024-10-10 12:35:18 +09:00
Takashi Kajinami
da7785c6fa Use common function to parse python dict
Depends-on: https://review.opendev.org/931722
Change-Id: I11afea8ef57ec3d003c283cdc2c8ba57476db82f
2024-10-10 10:26:14 +09:00
Zuul
8e97291497 Merge "Fix lack of parse logic after resource creation" 2024-10-09 15:35:12 +00:00
Zuul
4268c106d4 Merge "nova_aggregate: Fix match for array hosts" 2024-10-09 15:31:35 +00:00
Takashi Kajinami
92e8ccee5a Fix lack of parse logic after resource creation
The metadata property needs to be converted from the property field
value.

Also the hosts property need to be added after hosts are additionally
associated with the aggregate.

Change-Id: I9ad8334f2d2c1d01e42b4405e65da68939bd5c8d
2024-10-09 13:23:41 +09:00
Takashi Kajinami
82a9b003cc nova_aggregate: Fix match for array hosts
The property is not fully applied because of lack of array_matching
definition.

Change-Id: I1a9bba3e597bc61329c4526b051787723f2a7dc9
2024-10-09 10:57:42 +09:00
Takashi Kajinami
8d8e3f6197 Drop compatibility with openstackclient < 4.0.0
openstackclient 4.0.0 was released long time ago. Drop the code
maintained for support quite old versions.

Change-Id: I14610a852804c8e83d0e7c9a623fa721ba514dcc
2024-10-08 18:59:11 +09:00
Takashi Kajinami
8593d289d1 Fix puppet 8 compatibility of nova_flavor
Fix the following error detected by puppet 8.

Munging failed for value true in class is_public: undefined method `=~'
for true:TrueClass ...

Change-Id: I7d078ea72c5c1c4898247f61422986f277ee9a98
2024-05-31 07:05:16 +00:00
Zuul
5ec1ef579c Merge "nova_flavor: Fix broken idempotency with properties" 2024-04-03 11:37:13 +00:00
Takashi Kajinami
820695b463 nova_flavor: Fix broken idempotency with properties
Make sure that nova_flavor resource is idempotent when the "properties"
property is set. Also fix the typo causing undefined method error.

Closes-Bug: #2059949
Change-Id: I17a9d92c44b8dfe329b22b309d7a0408df707d1a
2024-04-02 17:05:11 +09:00
Takashi Kajinami
2dcad6d8dc Replace usage of uriescape
The uriescape function from puppetlabs-stdlib is no longer functional
in Puppet 8, because the URI.escape, which is internally used by that
function, is no longer available in Ruby 3+.

This replaces the function by own function to avoid the failure in
Puppet 8.

Closes-Bug: #2057860
Change-Id: I7b4db4c1e64416e20d8470cbff0b8497c6a0cfc9
2024-03-15 23:05:08 +09:00
Zuul
f744cbde55 Merge "Enforce supported types for hash properties" 2023-11-27 17:19:37 +00:00
Takashi Kajinami
898b5da4c8 Enforce supported types for hash properties
Change-Id: I39f9cef7007a1b3e47cf53fcec602a87b9ebb81d
2023-11-26 14:50:21 +09:00
Takashi Kajinami
ce6d01138e Stop reading keystone_authtoken options
Using credentials in keystone_authtoken options for nova_* resources
was deprecated some cycles ago[1].

[1] 0ed626e1461fecc4f443fcd543a99ba945539b1f

Change-Id: Iff2124f142791df8eb0be12ce134e32145bc209c
2023-11-16 16:11:04 +09:00
Takashi Kajinami
f8bde51891 pci: Drop support for "broken" json
JSON does not allow usage of single quotes and require double quotes.
We have been converting single quotes to support such invalid usage but
that was deprecated a long ago[1].

This also simplifies the logic to handle aliases. Using undef results
in the value set to service default fact.

[1] 1cd349f893408803fec307f615ae3fe265d54fed

Change-Id: If1328531f33a9fe778091ce38b5c1f8072b473b8
2023-11-03 23:11:29 +09:00
Takashi Kajinami
06875a6c73 Add native resource type for qemu.conf
This introduces the native resource type to manipulate qemu.conf, so
that we can define the resources in the same way for all libvirt
config files.

This also updates all libvirt config resource types to convert boolean
values automatically, because libvirt does not support raw boolean
values and the values should be converted to 1/0.

Change-Id: I562d19299e0377e02f2587f5ef36d35069b5a5cd
2023-04-04 10:27:27 +09:00
Takashi Kajinami
7f7e1010ef Do not use system scope tokens in providers
This is partial revert of 0ed626e1461fecc4f443fcd543a99ba945539b1f .

After discussing several problems caused by scope separation, we
decided to suspend implementing the scope enforcement and focus on
project personas like reader role. As the result of that decision,
the system admin persona will be removed, thus we should use
the project admin persona instead. The previous policy rules to allow
system scope access have been reverted by [1].

This does not revert the original patch to keep the unit tests which
were hugely refactored by that change.

[1] 066e1e69d1394839a9f0bde4ca8c3a0db2d52396

Change-Id: I85847850602ab3526d2fdb1a56bb927183198825
2022-10-06 10:37:04 +09:00
Takashi Kajinami
75475c06be Use the common provider for libvirt daemons
Currently we implement separate providers for all libvirt configuration
files but this is quite redundant because we have the same logic in
all providers.

This change refactors these providers makes use the libvirtd_config
provider used as the base implementation.

Change-Id: I486211306620d245262678875be3ec607640e921
2022-09-12 10:56:16 +09:00
Takashi Kajinami
322599b75d Switch provider to manage paste.ini file
... so that we users can use '<SERVICE DEFAULT>' similarly to
the resource types to manage the <service>.conf files.

Closes-Bug: #1981118
Change-Id: I4092da4732d5e68ce190e7341df7a01166954504
2022-07-09 10:04:03 +00:00
Zuul
0c35a804af Merge "Remove handling of 'u' prefix" 2022-05-23 17:31:14 +00:00
Zuul
c697f79f3e Merge "Remove novajoin support" 2022-05-23 17:31:12 +00:00
Takashi Kajinami
571848bcdb Remove handling of 'u' prefix
... because the prefix is no longer printed in Python 3.

In python 2
>>> print({u'foo': u'baa'})
{u'foo': u'baa'}
>>> print([u'foo', 'baa'])
[u'foo', 'baa']

In python 3
>>> print({u'foo': u'baa'})
{'foo': 'baa'}
>>> print([u'foo', 'baa'])
['foo', 'baa']

Change-Id: If670215181dd338dbcf32e06ff3a1d745651e9b6
2022-05-18 10:43:53 +09:00
Takashi Kajinami
90be242323 Remove novajoin support
The novajoin[1] project has been unmaintained for last two years.
We deprecated support for the service during the previous cycle[2],
and no longer expect any user requires it.

[1] https://opendev.org/x/novajoin
[2] 70bb80f6d33a4c81a370cd051a4a47c5a2b2c88c

Change-Id: I8f21036de12d78ca25fddaf02399e4c38b490ed5
2022-05-18 08:26:19 +09:00
Takashi Kajinami
5242d3a08b Support virtlockd configurations
... so that this module supports configuration of all libvirt daemons.

Change-Id: I93a02935df3a23e15b4a37081dc2a6ea646f6c79
2022-04-19 09:13:48 +09:00
Takashi Kajinami
0ed626e146 Use system scope credentials in providers
This change enforces usage of system scope credentials to manage
flavors, aggregates, and services, following the new policy rules for
SRBAC support in nova.

The logic to look up credential for the nova service user from
[keystone_authtoken] is left to keep backward compatibility but is
deprecated and will be removed.

Depends-on: https://review.opendev.org/806474
Depends-on: https://review.opendev.org/828025
Depends-on: https://review.opendev.org/828874
Change-Id: I71779f0f1459d64914589a94a440336386266306
2022-02-21 14:54:47 +00:00
Takashi Kajinami
77138476e0 nova_flavor: Add the new project_name property
The nova_flavor resource has been providing the project property which
accepts both project name and id. However this implementation results
in broken idempotency with project name used.

This change introduces a separate project_name property, so that users
can use project name with proper idempotency.

Closes-Bug: #1790795
Change-Id: Idee4af6931b8cf4a21d88f4cd38fe83468ec8efa
2022-02-18 01:32:03 +09:00
Zuul
4db2df55a9 Merge "nova_flavor: Strip '' from project id value" 2022-02-15 10:31:00 +00:00
Zuul
c008eb0143 Merge "nova_flavor: Refactor property setter" 2022-02-14 20:00:29 +00:00
Takashi Kajinami
f40bf357c0 nova_flavor: Refactor property setter
This change replaces redundant implementation of some property setters
by the common template.

Change-Id: I527aa84d52dd787169e38f81a1c2fde9f67a3046
2022-02-13 23:15:34 +09:00
Takashi Kajinami
599703b530 Remove unused str2hash
Change-Id: I9732ccbdafa79b11d8cb4955381794b922e16385
2022-02-13 21:34:35 +09:00
Takashi Kajinami
0ce7d9fe9e Ensure auth_endpoint is cleared by reset
Change-Id: I9d81eff950a50a2139c874ecc426040bcc0a93d4
2022-02-12 23:20:34 +09:00
Takashi Kajinami
60acc82c22 Fix missing update of property_hash
When a resource is created, the :ensure parameter should be set to
'present' so that exists returns true. In addition, the whole hash
should be cleared when a resource is deleted, otherwise subsequent
access might look up stale values. This change ensures property_hash is
updated in create/destroy accordingly.

This change also fixes the incorrect handling of "project" property
in nova_flavor which is causing unexpected update.

Finally, the ignored unit tests are fixed, to test the above fixes.

Change-Id: I611e3d0428674e7438fe15b276667f7b379d136e
2022-02-12 23:19:38 +09:00
Takashi Kajinami
ed1b0dbf3a nova_flavor: Strip '' from project id value
Currently the project field shows a list of projects like;

project=['ec085e18-22bb-403b-8ba5-0f9c6d67dffa']

The commit 86764de9cd90b9b09898da6061aaa786906620df added the logic to
handle this format but it missed surrounding quote(') which should be
also removed.

Change-Id: If65221db5a9e60e797b834a305d385d3fea4db16
2022-02-12 00:40:19 +09:00
Takashi Kajinami
3b47f97063 Remove inefficient usage of autorequire
This change removes inefficient usage of autorequire, with the wrong
resource name(The resource name should include section name) in
some resource types. The necessary dependency is already enforced by
another autorequire which depends on service::end anchor.

Change-Id: I0993e2c9ed80d476ca984edf9d6167818a1cb1bb
2022-01-20 22:51:30 +09:00
Takashi Kajinami
6bf4526ff1 Add support for rootwrap.conf
Change-Id: I69a85a9fc5179d984325747c63b3bb52a0153b22
2021-12-27 12:03:58 +09:00
Takashi Kajinami
1f43e25cc7 Allow customizing separator for api-paste.ini
The api-paste.ini accepts not only "=" but also ":" and some services
like Barbican have been using ":" for their default api-paste.ini
files.

[composite:main]
use = egg:Paste#urlmap
/: barbican_version
/v1: barbican-api-keystone

This change allows users to use ":" so that they can update the ini
files with keeping it consistent with the default fules

Depends-on: https://review.opendev.org/813614
Change-Id: I8ebe0c65b0e71380ba5a58a81b57e595e8dd29f8
2021-10-15 13:57:01 +09:00
Takashi Kajinami
414830e48b Remove the deprecated nova_api_paste_ini resource type
Change-Id: I7868ad180e5691b94507b09fc5b61459ed7265e0
2021-10-15 13:57:01 +09:00
Rajesh Tailor
448c9d3517 Enable support for Libvirt modular daemons
This change enables support for modular libvirt
daemon configurations.

NOTE: As of now, this change doesn't handle any modular daemons
socket configuration.

Change-Id: I90c3dd7bd63f9f54e43eee7bc2f58d165ca80e57
2021-09-28 23:34:14 +09:00
Takashi Kajinami
55874cb8ea Remove resource types to manage security groups and rules
The nova_security_group resource type and the nova_security_rule
resource type are dependent on subcommands of nova cli which were
already removed during Pike cycle[1][2]. This change removes these
invalid resource types.

Deprecation process is skipped because these resource types have not
worked as intended for a long period and we don't expect any user is
still using these invalid implementations.

[1] security group      : a298b29cc7e6b7330945b1890f0a4bd4c9f3fde6
[2] security groip rules: 0896bdc52a307c0b9598da0b6b837a95f0c00b9a

Closes-Bug: #1941947
Change-Id: Ic72911bab169b0ab171a1701b6871a3d03f7951b
2021-08-28 22:40:34 +09:00
Erik Berg
7111aa75f9 Allow for a more permissible regex
Some openstack installations use characters that are not in \w, the
old regex, now moved to string2hash was more permissible, and
there's probably no reason the regex in pythondict2hash can't be
just as permissible.

Change-Id: I35b964d96e6a558f1a10daa2391a398db60ea800
2021-08-09 11:37:46 +02:00
Takashi Kajinami
26dbd52717 Libvirt: quote config parameters in resource types
This change implements the quote parameter in libvirtd_config and
virtlogd_config, so that we can quote the value by that simple
parameter instead of implementing a logic in each manifests.

Also, with this change libvirtd_config and virtlogd_config supports
$::os_service_default, so that we can define absence of parameters more
easily.

Depends-on: https://review.opendev.org/792735
Change-Id: I3030ca34088019be932a9cc33344f7fb473a9aea
2021-06-22 16:13:52 +05:30
Zuul
0367a5ceed Merge "Clean up floating ip pool management for nova-network" 2021-04-27 12:11:00 +00:00
Zuul
c9234bcaed Merge "Debian api_uwsgi_config: Switch to :ini_setting" 2021-04-26 16:27:21 +00:00
Takashi Kajinami
1c0a03c6d8 Clean up floating ip pool management for nova-network
... because it was deprecated during the previous cycle and has been
useless since nova-network was removed.

Change-Id: If637debcd25b17183311e16e1bf5b76c453c634f
2021-04-26 22:08:55 +09:00
Zuul
5d18eb4152 Merge "nova_flavor: Accept array format about access_project_ids" 2021-04-20 15:21:42 +00:00
Thomas Goirand
98f286cd7b Debian api_uwsgi_config: Switch to :ini_setting
On each puppet run, I'm seeing:
value changed ['12'] to '12' (corrective)

Therefore, this patch switches from :openstackconfig to :ini_setting
to make runs indenpotant.

Change-Id: I2bd2a61263db8d7e54397ab85b4c51b79644adf2
2021-04-20 17:03:48 +02:00
Takashi Kajinami
86764de9cd nova_flavor: Accept array format about access_project_ids
The latest openstackclient doesn't show none but empty array([]) when
no access_project_ids is set for an flavor.
This change ensure that array format is properly handled to avoid
error during updating nova flavor using the nova_flavor resource.

Closes-Bug: #1924222
Change-Id: I976f70f1f4015536201c6c3acac3f1e4dbca4ccb
2021-04-15 14:31:00 +09:00
Thomas Goirand
8334bd3666 Add support for nova_api_{metadata_,}uwsgi_config in Debian
This patch is adding the configuration of the number of workers,
threads, and the size of the listen queue in Debian, which uses
uwsgi to run Nova API and api-metadata. Therefore, this patch adds
two new nova_api_uwsgi_config and nova_api_metadata_uwsgi_config
providers as well as two new nova::wsgi::uwsgi_api and
nova::wsgi::uwsgi_api_metadata classes.

Change-Id: Idd141edc5cddcfd79cf23e2041dbd1ce6a8252a8
2021-04-11 00:19:00 +02:00