| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
"ovs-external-ids.py"
This example script is used by our NM-ci. Make it work also with libnm
versions that don't yet support NM.SettingOvsOtherConfig.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- only printing the scan list is not gonna cut it. It's usually stale,
and we need to request a new scan.
- don't hard-code the GEnum and GFlags values that we understand. We
have libnm, which provides us some meta information about the data.
Use it.
- Some code cleanup.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1531
|
|
|
|
|
|
| |
See `man ovs-vswitchd.conf.db` for documentation of "other_config" keys.
https://bugzilla.redhat.com/show_bug.cgi?id=2151455
|
| |
|
|
|
|
| |
Fixes: 3ce3ed4c92fb ('examples: improve finding last checkpoint in "checkpoint.py"')
|
| |
|
|
|
|
| |
lgtm.com warns about this. Avoid it.
|
|
|
|
| |
Complained by lgtm.com.
|
|
|
|
|
|
|
| |
lgtm.com says:
Call to function format_exception with too few arguments; should be no
fewer than 3.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a fire-and-forget function to wait for shutdown to be complete.
It's not entirely trivial to ensure all resources of NMClient are
cleaned up. That matters only if NMClient uses a temporary GMainContext
that the user wants to release while the application continues. For
example, to do some short-lived operations an a worker thread. It's
not trivial also because glib provides no convenient API to integrate
a GMainContext in another GMainContext. We have that code as
nm_utils_g_main_context_create_integrate_source(), so add a helper
function to allow the user to do this.
The function allows to omit the callback, in which case the caller
wouldn't know when shutdown is complete. That would still be useful
however, when integrating the client's context into the caller's
context, so that the client's context gets automatically iterated
until completion.
The following test script will run out of file descriptors,
when wait_shutdown() is not used:
#!/bin/python
import gi
gi.require_version("NM", "1.0")
from gi.repository import NM, GLib
for i in range(1200):
print(f">>>{i}")
ctx = GLib.MainContext()
ctx.push_thread_default()
nmc = NM.Client.new()
ctx.pop_thread_default()
def cb(unused, result, i):
try:
NM.Client.wait_shutdown_finish(result)
except Exception:
# cannot happen
assert False
else:
print(f">>>>> {i} complete")
nmc.wait_shutdown(True, None, cb, i)
while GLib.MainContext.default().iteration(False):
pass
|
|
|
|
|
|
|
|
|
|
| |
While iterating the context (once), multiple sources can be dispatched.
So if we get a timeout and shortly after the weak-ref callback, then
we still need to honor the weak-ref.
In particular, because weak_ref.unref() is not safe to do after
the object was already destroyed. So we need to be correct about
tracking destruction.
|
|
|
|
| |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1290
|
|
|
|
|
| |
This is a python example. We should do nice things, like
using max() for finding the maximum, instead of sorting.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"examples/python/gi/checkpoint.py" is not only an example. It's also a
useful script for testing checkpoints.
Support a "--last" argument to specify the last checkpoint created.
Otherwise, when you are using this example from a test script, it
can be cumbersome to find the right checkpoint point.
Also, rename "client" and "nm_client" variables to "nmc". The purpose of
using the same variable name for the same thing is readability, but also
it works better when copy+paste snippets into the Python REPL.
|
|
|
|
|
| |
Recent python-black (22.0) dropped support for Python 2 and thus fail
for those files. Make the examples Python3 compatible.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous implementation did some ratelimiting, namely how many parallel
ActivateConnection D-Bus calls are in fly. This way we are able to kick off
many parallel calls, but the activations themselves were not ratelimited.
Rework the code. Now there are two rate limits (that can be set via environment
variables):
NUM_PARALLEL_STARTING
NUM_PARALLEL_IN_PROGRESS
This allows more control about how much is happening in parallel. If we are
going to activate 1000 profiles, then it matters that we do things in parallel,
but not everything at the same time.
|
|
|
|
| |
lgtm.com complains about this. Avoid the warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's an example for how to use libnm and asynchronous API.
But it's also a script I will use to test activating many
profiles in parallel.
Also add a test script that creates many veth interfaces and connection
profiles. So now you can do:
sudo NUM_DEVS=100 contrib/scripts/test-create-many-device-setup.sh setup
./examples/python/gi/nm-up-many.py c-a{1..100}
and cleanup with
nmcli connection down c-a{1..100}
sudo contrib/scripts/test-create-many-device-setup.sh cleanup
Of course, be careful to do this on your production machine.
|
| |
|
|
|
|
|
| |
lgtm.com warns about unqualified "except". This catches any "BaseException",
when we really only should handle "Exception" here.
|
|
|
|
|
| |
lgtm.com also complained about "connection_after" being unused. This
hopefully works around that warning.
|
| |
|
|
|
|
| |
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/781
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fedora 33's version of python-black is the authoritative version we
use for formatting -- note that formatting may look different depending
on the black version.
Recently, the package was updated to 20.8~b1-1.fc33, which treats
these lines different.
Work around that by adjusting the code so that both older and current
versions of python black behave the same.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These SPDX license identifiers are deprecated ([1]). Update them.
[1] https://spdx.org/licenses/
sed \
-e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \
-e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \
-i \
$(git grep -l SPDX-License-Identifier -- \
':(exclude)shared/c-*/' \
':(exclude)shared/n-*/' \
':(exclude)shared/systemd/src' \
':(exclude)src/systemd/src')
|
|
|
|
| |
All our source code is UTF-8. We don't need to mark it as such.
|
|
|
|
|
|
| |
The python example is (also) used to test the feature. That is because
currently nmcli does not yet have support for ovs.external-ids and this
API is only accessible via D-Bus (or a tool like this example).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And example script for getting and setting OVS external-ids.
Since currently there is no nmcli support for these properties yet,
the script becomes more interesting.
This "example" is rather long, and it showcases less the usage of
libnm (which is rather trivial, with respect to configuring
NMSettingOvsExternalIDs). Instead, it aims to provide a useful
command line tool for debugging. Hence, it's mostly concerned with
an elaborate command line syntax and useful print output.
|
| |
|
|
|
|
| |
black by default only considers files that have a ".py" extension.
|
|
|
|
|
|
| |
Part of !537.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/537
|
|
|
|
| |
lgmt.com says "Testing for None should use the is operator".
|
|
|
|
| |
lgtm.com flags this as "Except block directly handles BaseException".
|
| |
|
|
|
|
| |
lgtm.com warns about this.
|
|
|
|
|
| |
Add a python example using GObject introspection that shows how to
scan for Wi-Fi P2P peers and connect to one of them.
|
|
|
|
| |
Add libnm support for the new InterfaceFlags property of NMDevice.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
```bash
readarray -d '' FILES < <(
git ls-files -z \
':(exclude)po' \
':(exclude)shared/c-rbtree' \
':(exclude)shared/c-list' \
':(exclude)shared/c-siphash' \
':(exclude)shared/c-stdaux' \
':(exclude)shared/n-acd' \
':(exclude)shared/n-dhcp4' \
':(exclude)src/systemd/src' \
':(exclude)shared/systemd/src' \
':(exclude)m4' \
':(exclude)COPYING*'
)
sed \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[-–] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C1pyright#\5 - \7#\9/' \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) *[,] *\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C2pyright#\5, \7#\9/' \
-e 's/^\(--\|#\| \*\) *\(([cC]) *\)\?Copyright \+\(\(([cC])\) \+\)\?\(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/\1 C3pyright#\5#\7/' \
-e 's/^Copyright \(\(20\|19\)[0-9][0-9]\) \+\([^ ].*\)$/C4pyright#\1#\3/' \
-i \
"${FILES[@]}"
echo ">>> untouched Copyright lines"
git grep Copyright "${FILES[@]}"
echo ">>> Copyright lines with unusual extra"
git grep '\<C[0-9]pyright#' "${FILES[@]}" | grep -i reserved
sed \
-e 's/\<C[0-9]pyright#\([^#]*\)#\(.*\)$/Copyright (C) \1 \2/' \
-i \
"${FILES[@]}"
```
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/298
|
| |
|
|
|
|
|
| |
$ find * -type f |xargs perl contrib/scripts/spdx.pl
$ git rm contrib/scripts/spdx.pl
|
| |
|
|
|
|
| |
(cherry picked from commit e966f4b272331fcf99914ee2c1a980074a01ed94)
|
|
|
|
| |
This is useful for manually testing Update2() D-Bus API.
|
|
|
|
| |
This is useful for manually testing AddConnection2() D-Bus API.
|
|
|
|
| |
sed '1,3 { /^\(#\|--\) *vim:/d }; 1 { /^\/\* *vim:.*\*\/$/ d}' -i $(git grep -l 'vim:')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We no longer add these. If you use Emacs, configure it yourself.
Also, due to our "smart-tab" usage the editor anyway does a subpar
job handling our tabs. However, on the upside every user can choose
whatever tab-width he/she prefers. If "smart-tabs" are used properly
(like we do), every tab-width will work.
No manual changes, just ran commands:
F=($(git grep -l -e '-\*-'))
sed '1 { /\/\* *-\*- *[mM]ode.*\*\/$/d }' -i "${F[@]}"
sed '1,4 { /^\(#\|--\|dnl\) *-\*- [mM]ode/d }' -i "${F[@]}"
Check remaining lines with:
git grep -e '-\*-'
The ultimate purpose of this is to cleanup our files and eventually use
SPDX license identifiers. For that, first get rid of the boilerplate lines.
|
|
|
|
|
|
|
| |
Codespel run with the same arguments as described in
commit 58510ed56679 ('docs: misc. typos pt2').
(cherry picked from commit bf0c4e6ac2855088e3962693886bb6ab71856f7b)
|
|
|
|
|
|
|
|
| |
This is an API break since 1.16-rc1.
Similar to previous commit.
(cherry picked from commit 8ae9aa2428c10aafb837c692fb39bfd04ef4235c)
|
|
|
|
|
|
|
|
| |
This is an API break since 1.16-rc1.
Similar to previous commit.
(cherry picked from commit 7962653918fbfd66b549d389a1cb2cf96ae0d3eb)
|