<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/NetworkManager.git/examples, branch th/cloud-setup-logging</title>
<subtitle>gitlab.freedesktop.org: NetworkManager/NetworkManager.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/'/>
<entry>
<title>examples: rework nm-up-many.py for ratelimiting parallel activations</title>
<updated>2021-06-22T07:47:44+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-06-21T21:40:18+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=938f9b075fd4d78a74f7d566f579d1c6517501b6'/>
<id>938f9b075fd4d78a74f7d566f579d1c6517501b6</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>example: drop unused import from "nm-up-many.py"</title>
<updated>2021-06-17T13:09:48+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-06-17T13:09:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=1b895d98c071c853beb0ad28e1a577247dfada70'/>
<id>1b895d98c071c853beb0ad28e1a577247dfada70</id>
<content type='text'>
lgtm.com complains about this. Avoid the warning.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lgtm.com complains about this. Avoid the warning.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: add "examples/python/gi/nm-up-many.py"</title>
<updated>2021-06-11T20:48:41+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-06-08T16:14:26+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=be4b997e4f2ada217e1067029d53fdd47cff2159'/>
<id>be4b997e4f2ada217e1067029d53fdd47cff2159</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples/trivial: fix black formatting of python code</title>
<updated>2021-05-27T12:08:47+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-27T12:08:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=f63723f75e6b216765f82077a240b26babef0bbc'/>
<id>f63723f75e6b216765f82077a240b26babef0bbc</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: explicitly catch "Exception" in "ovs-external-ids.py"</title>
<updated>2021-05-27T07:13:26+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-27T07:13:24+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=fdc0285e6842a880a5f085e4a3d69e0713381546'/>
<id>fdc0285e6842a880a5f085e4a3d69e0713381546</id>
<content type='text'>
lgtm.com warns about unqualified "except". This catches any "BaseException",
when we really only should handle "Exception" here.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lgtm.com warns about unqualified "except". This catches any "BaseException",
when we really only should handle "Exception" here.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: fix printing applied connection in "ovs-external-ids.py"</title>
<updated>2021-05-27T06:56:20+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-27T06:56:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=07193dabd13607d94b6f2881c3c3e6fbe55a4f04'/>
<id>07193dabd13607d94b6f2881c3c3e6fbe55a4f04</id>
<content type='text'>
lgtm.com also complained about "connection_after" being unused. This
hopefully works around that warning.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lgtm.com also complained about "connection_after" being unused. This
hopefully works around that warning.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: drop unused variable in "examples/python/gi/ovs-external-ids.py"</title>
<updated>2021-05-27T06:53:35+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-27T06:53:35+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=6c919dc897c624a9d498aff3dee751f7433b2255'/>
<id>6c919dc897c624a9d498aff3dee751f7433b2255</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>python: remove unused imports</title>
<updated>2021-05-27T06:52:30+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-27T06:52:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=26f0fb06043776f371a202415e0aa3200c8a3934'/>
<id>26f0fb06043776f371a202415e0aa3200c8a3934</id>
<content type='text'>
They are flagged by lgtm.com. Avoid the warning by dropping unused
includes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
They are flagged by lgtm.com. Avoid the warning by dropping unused
includes.
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: drop confusing UID handling in "vpn.py" example</title>
<updated>2021-05-26T22:02:19+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-26T21:44:30+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=f1a1921edc7247c28a9e4baf60d20b57987503ac'/>
<id>f1a1921edc7247c28a9e4baf60d20b57987503ac</id>
<content type='text'>
First of all, the "os.setuid()" call is never reached. lgtm.com warns about
that, and warnings are annoying because they require investigation.

This code is only in the example, so that the user would understand that
they should edit the source and set the desired UID. But you can only
call setuid() if you have CAP_SETUID, so commonly this anyway doesn't
work -- unless you are root already, and then you actually don't need
it either.

Let's drop this code from the example.

Maybe this example really should be dropped. Does the "dbus" python
module even still work? Doesn't for me...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
First of all, the "os.setuid()" call is never reached. lgtm.com warns about
that, and warnings are annoying because they require investigation.

This code is only in the example, so that the user would understand that
they should edit the source and set the desired UID. But you can only
call setuid() if you have CAP_SETUID, so commonly this anyway doesn't
work -- unless you are root already, and then you actually don't need
it either.

Let's drop this code from the example.

Maybe this example really should be dropped. Does the "dbus" python
module even still work? Doesn't for me...
</pre>
</div>
</content>
</entry>
<entry>
<title>examples: fix usage of input() with Python2</title>
<updated>2021-05-26T16:03:13+00:00</updated>
<author>
<name>Thomas Haller</name>
<email>thaller@redhat.com</email>
</author>
<published>2021-05-26T16:03:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/NetworkManager.git/commit/?id=e1d40d89f0c6ed1ca894e1aa3c4b01040e626cd9'/>
<id>e1d40d89f0c6ed1ca894e1aa3c4b01040e626cd9</id>
<content type='text'>
input() in Python2 evaluated the string and was thus unsafe. On
Python2, the right choice is raw_input. In Python3, input does
what raw_input did.

Work around this.

The main "problem" is that lgtm.com flags this as error. The fix
in the example is not important, but getting a low number of warnings
is.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
input() in Python2 evaluated the string and was thus unsafe. On
Python2, the right choice is raw_input. In Python3, input does
what raw_input did.

Work around this.

The main "problem" is that lgtm.com flags this as error. The fix
in the example is not important, but getting a low number of warnings
is.
</pre>
</div>
</content>
</entry>
</feed>
