1
0
mirror of https://github.com/lxc/python3-lxc.git synced 2026-02-05 09:48:21 +01:00

43 Commits

Author SHA1 Message Date
Stéphane Graber
8559ce0a10 Merge pull request #39 from warhodes-dev/fix-api_test.py
Update configuration for examples/api_test.py
2025-12-10 10:51:12 -05:00
Austin Rhodes
fd8f7d1ff0 Update configuration for examples/api_test.py
This example script is guaranteed to fail on modern Ubuntu releases due to outdated configuration. These changes allow the script to pass:

- Fixes container.create arguments to request Noble image instead of Xenial, as Xenial images are no longer available

- Changes cgroups key strings to use cgroups v2 nomenclature ('max' instead of 'limit_in_bytes', 'peak' instead of 'max_usage_in_bytes')

Signed-off-by: Austin Rhodes <austin.rhodes@canonical.com>
2025-12-09 18:17:26 -05:00
Stéphane Graber
672060b7eb Merge pull request #38 from thomasjfox/fix-personality-corruption
Fix random "personality" corruption when linking against lxc 6
2025-06-16 15:27:46 -04:00
Thomas Jarosch
f8d5ddc689 Fix random "personality" corruption when linking against lxc 6
When using python3-lxc with liblxc from lxc 6.0.x, we could observe
random systemd startup failures on containers.

systemd will report this on startup when the corruption hit:
"Warning! Reported kernel version 2.6.74-300.fc42.x86_64 is older than systemd's required baseline kernel version 4.15. Your mileage may vary."

Some systemd services fail to start properly, including systemd-journald.

The root problem is that other lxc library code unexpectedly calls into
lxc_config_parse_arch() from python3-lxc instead of the function from liblxc.

The function signature of lxc_config_parse_arch() changed throughout the years
and the second "persona" pointer argument was added. The older python3-lxc copy
of the function would not initialize the provided memory location of "persona".
It will therefore contain a random value.

Additionally the symbol visibility of liblxc's lxc_config_parse_arch()
changed with this commit in lxc 6.0:

******************************************
commit 42eeffcb05c468fd7b3a90eeda4a3abe9f26844b
AuthorDate: Sun Feb 18 15:43:20 2024 +0100

    confile: unhide lxc_config_parse_arch() helper

    Looks safe enough to be available for liblxc users.
******************************************

This results in two symbols with the same name and
the python3-lxc symbol takes precedence.

Fix the issue by making the function static in python3-lxc,
so python3-lxc stays compatible with lxc 5.x and 6.x.

A future python3-lxc version might remove the local function
and use lxc_config_parse_arch() from liblxc 6.0 and later.

Side quest: Even though lxc 5.0 already has the "persona" function argument in
lxc_config_parse_arch() since 7c43fa56e70c65607f63dec8ff5a9682a3091ab2 (from 2021),
it is not affected since the symbol visibility is still hidden.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
2025-06-16 21:15:02 +02:00
Stéphane Graber
018c4ed482 Merge pull request #36 from voegelas/after-fork
Replace the deprecated PyOS_AfterFork() function
2025-05-13 13:26:50 -04:00
Stéphane Graber
f2f604b712 github: Bump to latest Ubuntu
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2025-05-13 13:26:10 -04:00
Andreas Vögele
5c603a7665 Replace the deprecated PyOS_AfterFork() function
Container_attach_and_possibly_wait() fails in Python 3.13 with
"PyMutex_Unlock: unlocking mutex that is not locked" if PyOS_AfterFork()
is used.

Signed-off-by: Andreas Vögele <andreas@andreasvoegele.com>
2025-05-13 17:38:53 +02:00
Andreas Vögele
ac1f123b55 github: Add basic tests
Signed-off-by: Andreas Vögele <andreas@andreasvoegele.com>
2025-05-13 17:38:53 +02:00
Stéphane Graber
59e03d973a github: Update for main branch
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2023-07-24 11:09:03 -04:00
Stéphane Graber
93c439e41a github: Add DCO/target tests
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2023-06-21 21:36:25 -04:00
Stéphane Graber
aaab3be45d Release python3-lxc 5.0.0
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-5.0.0
2023-01-24 23:34:00 -05:00
Stéphane Graber
33b1be0361 Merge pull request #32 from Cypresslin/api-test-loop
api_test: fix possible infinite loop when trying to get the ip address
2021-11-25 10:49:20 -05:00
Po-Hsu Lin
37ac09d7a4 api_test: fix possible infinite loop when trying to get the ip address
If the the ips can not be correctly obtained with container.get_ips()
this while loop will never ends.

Fix this by using:
  while not ips and count != 30

So that even if the ips is empty, the loop will get terminated after
30 attempts (30 seconds later). This retry limit was bumped from 10
to 30 to give it a chance to get the ip address.

If the ip address cannot be obtained, this test will failed with:
  Traceback (most recent call last):
    File "/usr/share/doc/python3-lxc/examples/api_test.py", line 131, in <module>
      assert(len(ips) > 0)
  AssertionError

Signed-off-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
2021-11-25 16:22:33 +08:00
Stéphane Graber
fe79d87fe3 Merge pull request #29 from Consolatis/fix/allow_threads_create
Unlock GIL while creating container
2021-10-05 08:32:01 -04:00
Consolatis
a869854777 Unlock GIL while creating container
Signed-off-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2021-10-05 07:25:19 +02:00
Stéphane Graber
ef87230acc Merge pull request #28 from Consolatis/fix/allow_threads_clone
Unlock GIL while cloning container
2021-10-04 22:32:21 -04:00
Stéphane Graber
ba6f4ba68c Merge pull request #30 from Consolatis/feature/add_bdev_specs
Add optional fssize argument to create() to make bdevtype=loop work
2021-10-04 22:31:06 -04:00
Consolatis
6b8f507988 Unlock GIL while cloning container
Signed-off-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2021-10-05 02:34:40 +02:00
Consolatis
ca1d8446ce Add optional fssize argument to create() to make bdevtype=loop (and possibly others) work by falling back to their defaults instead of returning -1 because bdev_specs is NULL
Signed-off-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
2021-10-05 02:32:34 +02:00
Stéphane Graber
b22832aa7f Merge pull request #24 from michaelsatanovsky/master
Allows setting of multiple network devices at creation.
2020-12-09 14:44:34 -05:00
Michael Satanovsky
bbdf39a1f1 Added logic to add new network device when needed.
Signed-off-by: Michael Satanovsky <michael.satanovsky@gmail.com>

Got rid of some extraneous lines

Signed-off-by: Michael Satanovsky <michael.satanovsky@gmail.com>

Got rid of some extraneous lines

Signed-off-by: Michael Satanovsky <michael.satanovsky@gmail.com>

Removed print statement.

Signed-off-by: Michael Satanovsky <michael.satanovsky@gmail.com>

Formatting: removed blank line.

Signed-off-by: Michael Satanovsky <michael.satanovsky@gmail.com>
2020-12-09 11:09:49 -08:00
Stéphane Graber
8b54225adf Merge pull request #23 from anirudh-goyal/create-after-destroy-#16
Fixes incorrect behavior with create() after destroy()
2020-12-03 12:54:21 -05:00
anirudh-goyal
1cacd96625 Fixes incorrect behavior of using create() after destroy().
Signed-off-by: Anirudh Goyal <anirudhgoyal@utexas.edu>
2020-12-03 21:57:37 +05:30
Stéphane Graber
d80523b93d Merge pull request #21 from chang-andrew/chang-andrew/master/issue-15
Fix ContainerNetworkList throwing KeyError
2020-12-02 15:27:29 -05:00
Andrew Chang
1e64954bad python3-lxc: Change ContainerNetworkList len function to not throw KeyError
Signed-off-by: Andrew Chang <chang331006@gmail.com>
2020-09-17 17:17:04 -05:00
Stéphane Graber
b1e77f053e Merge pull request #13 from vicamo/for-upstream/fix-api-test-interfaces-comparison
api_test: fix interfaces comparison failure
2019-09-19 10:48:15 +02:00
You-Sheng Yang
69c41ef513 api_test: fix interfaces comparison failure
When the host has kernel module sit or ipip inserted, additional network
interfaces sit0 and/or tunl0 would appear inside the container by
default as well, which fails the api_test.

This change append sit0/tunl0 to expected interfaces when applicable.

Closes: #2
Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
2019-09-18 17:23:41 +08:00
Stéphane Graber
0c5bc706b5 Release python3-lxc 3.0.4
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-3.0.4
2019-06-21 18:58:37 -04:00
Stéphane Graber
6658caec7e Release python3-lxc 3.0.3
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-3.0.3
2018-11-22 19:49:43 -05:00
Stéphane Graber
4d034205fb Release python3-lxc 3.0.2
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-3.0.2
2018-08-16 16:15:48 -04:00
Christian Brauner
93b1f2f090 Merge pull request #1 from thmo/patch-1
Fix typo in README.md
2018-04-05 15:37:25 +02:00
Thomas Moschny
89c9e8ea00 Fix typo in README.md
Signed-off-by: Thomas Moschny <thomas.moschny@gmx.de>
2018-04-05 10:43:19 +02:00
Stéphane Graber
90c37feb95 Release python3-lxc 3.0.1
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-3.0.1
2018-03-27 00:06:53 -04:00
Stéphane Graber
fe25da86c4 Fix building with newer setuptools
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-03-27 00:06:42 -04:00
Stéphane Graber
3304281273 Fix bad MANIFEST.in
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-03-26 23:54:03 -04:00
Stéphane Graber
3fdbac90cd Release python3-lxc 3.0.0
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-3.0.0
2018-03-26 23:31:38 -04:00
Stéphane Graber
b69f086d54 Release 3.0.0.beta1
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
python3-lxc-3.0.0.beta1
2018-02-28 17:31:50 -05:00
Stéphane Graber
95da8c5534 Ignore build directories
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-28 17:31:50 -05:00
Stéphane Graber
3a0c6e5cca Include some missing files
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-28 17:31:47 -05:00
Stéphane Graber
e4f3bac0ad Fix encoding
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-28 15:46:51 -05:00
Stéphane Graber
856be4dba5 Fix package name
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
2018-02-28 15:34:29 -05:00
Stéphane Graber
07ab1e2f20 setup.py: Don't mangle our version numbers 2018-02-28 15:30:02 -05:00
Christian Brauner
8c49ddee6f initial commit
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2018-02-14 18:34:35 +01:00