Commit Graph

32561 Commits

Author SHA1 Message Date
Thomas Haller
62104477c3 cloud-setup: fix _aliyun_base() initializing base URL
Fixes: f3404435a9 ('cloud-setup: configure secondary ip in Aliyun cloud')
2023-05-22 17:26:18 +02:00
Thomas Haller
e1f3acf3a6 test-cloud-meta-mock: allow configuring the provider that are mimicked
"test-cloud-meta-mock.py" needs to be mocked, so it only replies
to stuff that we tell it to. Except for the API token, that is
pushed by the client.

We need to be able to tell the mock whether it supports that API
or not. By default it does, but by setting "/.nmtest/providers"
we can limit that.

The DEFAULT_RESOURCE are now grouped by provider. If a path is not
explicitly mocked, we may fallback to the DEFAULT_RESOURCE, but only if
the respective "/.nmtest/providers" is enabled and if /.nmtest/allow-default"
indicates so (which they do by default).
2023-05-22 17:26:10 +02:00
Thomas Haller
4691f45bde test-cloud-meta-mock: add and use helper to send response code 2023-05-22 17:24:55 +02:00
Thomas Haller
77fd4d5f0e test-cloud-meta-mock: update default MAC address for test-cloud-meta-mock.py
Choose a MAC address that is easily recognizable. And where you can
see which is mac1 and mac2.
2023-05-22 17:24:55 +02:00
Thomas Haller
c80076c501 gitlab-ci: add CentOS Stream 8+9 containers 2023-05-22 14:47:54 +02:00
Thomas Haller
436b9cb005 gitlab-ci: improve "fedora-install.sh" for CentOS Stream 2023-05-22 14:47:42 +02:00
Thomas Haller
1a0fa85397 platform/tests: check errno on failure to umount() in test_netns_bind_to_path()
The umount() call failed in a test. Rework the assertion, so
we might see the errno of the problem.
2023-05-22 13:06:35 +02:00
Thomas Haller
dcfcb55166 tests: increase timeout for check-local-tests-cloud-setup test with meson
Fixes: d89d42bf23 ('tests/client: test nm-cloud-setup')
2023-05-19 16:02:29 +02:00
Thomas Haller
6dad817c05 tools: fix python2 compatibility in "generate-docs-nm-settings-docs-merge.py"
Fixes: 42aa225185 ('docs: better handle description tags in generate-docs-nm-settings-docs-merge.py')
2023-05-19 15:53:20 +02:00
Thomas Haller
4528ae44bc docs: merge branch 'th/generate-doc-fixes'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1633
2023-05-19 12:55:10 +02:00
Thomas Haller
b7d0218ee1 docs: rework selecting properties with "generate-docs-nm-settings-docs-merge.py"
"generate-docs-nm-settings-docs-merge.py" merges properties from
multiple XMLs. It supported an argument "--only-from-first", to
only select properties that were in the first of the provided XMLs.

The idea is that the first XML would be "src/nmcli/gen-metadata-nm-settings-nmcli.xml"
which is generated from nmcli meta-data and exactly describes the
supported properties. For example, "connection.read-only", "user.data"
or "wireless.tx-power" exist as properties somewhere, but not supported
by nmcli.

Change that, to not tie the selected property to the first XML.
"gen-metadata-nm-settings-nmcli.xml" is the XML that contains which
properties to select from, but "src/libnm-client-impl/nm-property-infos-nmcli.xml"
contains hand crafted descriptions. The latter descriptions are
preferred. As the order of the XML is already relevant for which
description is preferred, the selection is orthogonal to that.

With this, prefer descriptions from "src/libnm-client-impl/nm-property-infos-nmcli.xml"
but still select properties from "src/nmcli/gen-metadata-nm-settings-nmcli.xml".

Note that the argument is only used to generate "man/nm-settings-docs-nmcli.xml",
and with the current input, there is no actual change in behavior.
2023-05-19 12:52:01 +02:00
Thomas Haller
42aa225185 docs: better handle description tags in generate-docs-nm-settings-docs-merge.py
When we generate the manual page for nm-settings-nmcli, we run:

   "/usr/bin/python" \
        ./tools/generate-docs-nm-settings-docs-merge.py \
        --only-from-first \
        man/nm-settings-docs-nmcli.xml \
        src/nmcli/gen-metadata-nm-settings-nmcli.xml \
        src/libnm-client-impl/nm-property-infos-nmcli.xml \
        src/libnm-client-impl/nm-settings-docs-gir.xml

If "gen-metadata-nm-settings-nmcli.xml" contains either a <description>
or a <description-docbook>, then we must not continue searching the
other XML documents. The user provided an explicit override, and
fallback (search further) is wrong. Previously, we might take
<description> from the first file, and <description-docbook> from the
second file. As "man/nm-settings-nmcli.xsl" prefers
<description-docbook>, it takes the wrong text. Instead, as we search
the files during merge, we must prefer the first one.

Note that the change doesn't really matter anymore, because each XML
now must also contain both <description> and <description-docbook>.
There is an assertion for that.

Also, stop generating <deprecated-docbook>. First, it lacked the
important "since=" attribute and was necessary. Also, it's redundant and
does not contain anything interesting. So far, we don't need special
formatting for the deprecated message, and we likely never will.

Also, stop accepting or generating the "description=" attribute. This
should always be an XML element now.
2023-05-19 12:52:00 +02:00
Thomas Haller
89abede3df docs: rework generating property infos to use <description> element
The "generate-docs-nm-property-infos.py" script parses the tags like
"---nmcli---" and generates an XML.

Rework it:

- don't put long text descriptions in a "description=" XML attribute.
  Instead, use an XML element. That is in line with what
  "generate-docs-nm-settings-docs-gir.py" does, which generates
  a similar file.

- if there is no <description-docbook> element, generate one based
  on <description>. That is important, because we want to create
  paragraphs.
  It's also important because "generate-docs-nm-settings-docs-gir.py"
  tends to generate <description-docbook> from the libnm/gir data.
  However, if you specify a "---nmcli---" override, then that should
  automatically apply to <description> and <description-docbook>.
2023-05-19 12:52:00 +02:00
Thomas Haller
63cc5b3104 docs: don't generate <description> tag in "gen-metadata-nm-settings-nmcli"
"gen-metadata-nm-settings-nmcli" previously printed the <description>.
But that tag is not very useful for further processing.

For the most part it itself comes from "src/libnmc-setting/settings-docs.h",
which is generated (but lost formatting information already to be
suitable for where it's used).

Some parts are original texts from "src/libnmc-setting/nm-meta-setting-desc.c",
like TEAM_DESCRIBE_MESSAGE. However those text are also not really suitable
for any other purpose.

Rename the tag, so that the tools that process "gen-metadata-nm-settings-nmcli.xml"
don't use it.

The file "gen-metadata-nm-settings-nmcli.xml" is currently only used to
generate "man/nm-settings-docs-nmcli.xml", and that file slightly
changes with this patch. However, the manual page which is generated by
"man/nm-settings-docs-nmcli.xml" does not change.
2023-05-19 12:52:00 +02:00
Thomas Haller
d95001beff docs: fix showing link for secrets-flags in man nm-settings-nmcli
The input always actually has a <description-docbook> field, so the secret-flags
hint was never shown.

Move it. It's indepenent from <description> and <description-docbook> anyway.

With this we see the expected messages

  See the section called “Secret flag types:” for flag values.
2023-05-19 12:52:00 +02:00
Thomas Haller
676a99c96a docs: drop redundant list([...]) in "generate-docs-nm-settings-docs-merge.py" 2023-05-19 12:51:59 +02:00
Thomas Haller
8c17077289 docs: simplify generating paragraphs in "generate-docs-nm-settings-docs-gir.py" 2023-05-19 12:51:59 +02:00
Thomas Haller
5d58792848 libnm: add nmcli specific documentation override for "ipv6.addr-gen-mode" 2023-05-19 12:51:59 +02:00
Thomas Haller
b90e7a2c6c libnm: add "description:" for overrides with doctext
If we have an override with "description-docbook:", we soon will require that
there is also an accompanying "description:", for plain uses.

The text is copied from what otherwise gets merged (it comes from the gir file).
2023-05-19 12:51:59 +02:00
Thomas Haller
92e32c4b7a libnm/docs: reword documentation for "ipv6.{addr-gen-mode,token}" 2023-05-19 12:51:58 +02:00
Thomas Haller
bcadcc173a core: improve logging of used IPv6 interface identifier 2023-05-19 12:51:58 +02:00
Thomas Haller
e1ef6dad8a build: merge branch 'th/update-to-fedora38'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1634
2023-05-19 12:49:58 +02:00
Thomas Haller
ea39d75f7b gitlab-ci: update default Fedora image for building pages and check steps
We want to follow current Fedora, so update to Fedora 38.

Also, we now use clang-format from Fedora 38 release, so the default
image in gitlab-ci must match, because that image is used for the
"check-tree" test.

While at it, add Fedora 39 and move Fedora 36 to tier 3.
2023-05-19 12:49:24 +02:00
Thomas Haller
d9df884fce gitlab-ci: update to latest ci-templates version 2023-05-19 12:49:23 +02:00
Thomas Haller
fe95e07fef contrib: fix fedora/REQUIRED_PACKAGES for {lib,}vala-devel
Originally, the package was called vala-devel (it still is on CentOS7).
Then it was renamed to libvala-devel, but keeping a Provides.

On Fedora 39, the Provides was dropped. Workaround.
2023-05-19 12:49:23 +02:00
Thomas Haller
257b6bb686 clang-format: add reformatting commit to ".git-blame-ignore-revs" 2023-05-19 12:49:22 +02:00
Thomas Haller
c275d24637 clang-format: reformat code with clang-format 16.0.2-1.fc38
This is the version shipped in Fedora 38. As Fedora 38 is now out, the
core developers switch to it. Our gitlab-ci will also use that as base
image for the check-{patch.tree} tests and to generate the pages. There
is a need that everybody agrees on which clang-format version to use,
and that version should be the one of the currently used Fedora release.

Also update the used Fedora image in "contrib/scripts/nm-code-format-container.sh"
script.

The gitlab-ci still needs update in the following commit. This change
in isolation will break the "check-tree" test.
2023-05-19 10:53:13 +02:00
Thomas Haller
94d651067a build: merge branch 'th/build-fixes-cloud-setup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1627
2023-05-18 09:18:11 +02:00
Thomas Haller
e37a15acad all: avoid "==" bashism in scripts 2023-05-18 09:16:41 +02:00
Thomas Haller
611db44974 build/meson: enable -Dnm_cloud_setup=true by default
That is also what autotools does. Keep the behvior in sync.
Also, "contrib/scripts/nm-ci-run.sh" does not explicitly enable
nm-cloud-setup, so we ended up not building it in test. This
solves that, by enabling it by default.
2023-05-18 09:16:41 +02:00
Thomas Haller
e7aa33ebfd build/autotools: avoid checking twice for libcurl
We check once conditionally for enable_concheck, and once for
with_nm_cloud_setup. Don't do it twice.
2023-05-18 09:16:41 +02:00
Thomas Haller
701171d99a build: don't mark nm-cloud-setup as EXPERIMENTAL in build script 2023-05-18 09:16:31 +02:00
Beniamino Galvani
b05cc4aa0a release: bump version to 1.43.8 (development) 2023-05-16 17:18:21 +02:00
Beniamino Galvani
93430627c2 team: don't try to connect to teamd in update_connection()
In constructed(), NMDevice starts watching the D-Bus name owner or
monitoring the unix socket, and so it is always aware if teamd is
running. When it is, NMDevice connects to it and initializes
priv->tdc.

It is not useful to try to connect to teamd in update_connection()
because warnings will be generated by NM and by libteam if teamd is
not running. As explained above the connection is always initialized
when teamd is available, and so we can just check priv->tdc.

Fixes: ab586236e3 ('core: implement update_connection() for Team')

https://bugzilla.redhat.com/show_bug.cgi?id=2182029
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1631
2023-05-16 13:18:36 +02:00
Thomas Haller
7a6257d446 libnm: drop duplicate line from "libnm.ver" 2023-05-15 16:32:50 +02:00
Fernando Fernandez Mancera
f45625a897 merge: branch 'ff/bond_port_version_symbol' 2023-05-15 15:19:19 +02:00
Fernando Fernandez Mancera
bc0818fe13 libnm: adjust symbol versioning of bond port prio in 1.40.20
This ABI was backported all the way to 1.42.8 and 1.40.20 and to rhel-8.9.
Move the ABI to a separate symbol version, which we have in all those
versions.
2023-05-15 15:16:49 +02:00
Fernando Fernandez Mancera
9b8220c9fa tests: adjust test-gir.py to allow extra elements in section name 2023-05-15 15:16:49 +02:00
Thomas Haller
a235bb3c6f test-client: merge branch 'th/client-tests-refactor-base-class'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1628
2023-05-15 15:03:09 +02:00
Thomas Haller
efc14fcbec test-client: drop TestNmClient base class from tests
With the unit test framework, we define special methods, like setUp()
and test_*(). This is documented, but not obvious.

Previously, TestNmClient was the base class for our tests classes, and
it provided some functionality (and state). It was utterly confusing how
pieces fit together.

Instead, move the state to a new class NMTestContext(). That contains
most of the code from TestNmClient. Drop TestNmClient and let the test
classes directly descend from unittest.TestCase.

The difference is, when you now look at a certain test (test_001()), you
can easier understand which code runs when. First, the test class has a
setUp() method which runs, but that method is now trivial without extra
context. Second, there is the @nm_test attribute that wraps the
function. But that's it. It's all at one place, and we delegate instead
of inherit.
2023-05-15 14:59:58 +02:00
Thomas Haller
50f97307c5 test-client: move TestNmClient.ReplaceTextConUuid() to NMStubServer
The goal is to make the base class TestNmClient smaller because it
contains a lot of state, and with inheritance it's hard to follow what
happens.
2023-05-15 14:59:58 +02:00
Thomas Haller
1c32b59ebd test-client: move TestNmClient.{cmd_construct_argv,_env}() to Util.cmd_create_{argv,env}()
These two are stateless method, and even not only work for nmcli, but also for
nm-cloud-setup. Move to the Util class, as static methods.
2023-05-15 14:59:58 +02:00
Thomas Haller
7ecb659743 test-client: move skip functions to Util class
They can both be used as decorators and called plainly.
2023-05-15 14:59:58 +02:00
Thomas Haller
d1e6edcb7b test-client: move static function from TestNmClient._read_expected() to Util.file_read_expected()
Static, state-less functions are great. Keep them separate from TestNmClient which
has lots of state.
2023-05-15 14:59:58 +02:00
Thomas Haller
33f7ee0bb7 nm-in-container: run with "--no-hosts" to have a plain /etc/hosts in the container
The bind mount interferes with running certain CI tests that want to
change /etc/hosts.
2023-05-15 11:02:10 +02:00
Beniamino Galvani
53ba9f4701 ipv6ll: don't regenerate the address when it's removed externally
Currently if the IPv6 link-local address is removed after it passed
DAD, NetworkManager tries to generate a new link-local address. If
this fails, which is always the case for EUI64, ipv6ll is considered
as failed and the connection can go down (depending on may-fail).

This is particularly bad for virtual interfaces because if somebody
removes the link-local address, the activation can fail and destroy
the interface, breaking all services that require it. Also, it's a
change in behavior introduced in 1.36.0.

It seems that a better approach here is to re-add the address that was
removed externally.

Fixes: aa070fb821 ('core: add NML3IPv6LL helper')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1622
2023-05-15 10:23:39 +02:00
Beniamino Galvani
eb9f3b1e3b merge: branch 'bg/wake-assume-rh2193422'
https://bugzilla.redhat.com/show_bug.cgi?id=2193422
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1624
2023-05-15 10:12:21 +02:00
Beniamino Galvani
5e3bef6ae9 manager: use the right reason for managing devices after wake/reenable
When managing the interface after wake/reenable, the reason determines
whether the device will be sys-iface-state=managed or external.

Commit 5a9a7623c5 ('core: set STATE_REASON_CONNECTION_ASSUMED when
waking up') changed the reason from 'now-managed' to
'connection-assumed'; the effect was that devices that were fully
managed before sleeping become external after a wake up. For example:

  $ nmcli connection add type ethernet ifname enp1s0
  Connection 'ethernet-enp1s0' (47fcd81e-bf00-4c02-b25b-354894f5657e) successfully added.
  $ nmcli device | grep enp1s0
  enp1s0  ethernet  connected               ethernet-enp1s0
  $ nmcli networking off
  $ nmcli device | grep enp1s0
  enp1s0  ethernet  unmanaged    --
  $ nmcli networking on
  $ nmcli device | grep enp1s0
  enp1s0  ethernet  unavailable  --

Set the correct reason during wake up so that the previous state is
restored.

Fixes: 5a9a7623c5 ('core: set STATE_REASON_CONNECTION_ASSUMED when waking up')
https://bugzilla.redhat.com/show_bug.cgi?id=2193422
2023-05-15 10:11:16 +02:00
Beniamino Galvani
1494774bd1 device: add functions to get and set sys-iface-state before sleep 2023-05-15 10:10:42 +02:00
Thomas Haller
fc0fc4ab0d clients: merge branch 'th/client-secrets-cleanup'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1630
2023-05-12 13:26:42 +02:00