summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* ci: Replace OpenSUSE Leap 15.4 target with Leap 15 nameErik Skultety2023-05-035-8/+8
| | | | | | We now refer to the latest Leap 15.X simply as Leap 15 in lcitool. Signed-off-by: Erik Skultety <eskultet@redhat.com>
* Post-release version bump to 9.4.0Jiri Denemark2023-05-021-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* rpm: convert license to SPDX formatv9.3.0Daniel P. Berrangé2023-04-261-1/+1
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Post-release version bump to 9.3.0Jiri Denemark2023-04-191-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* setup: limit pytest to 'tests' subdirDaniel P. Berrangé2023-04-191-1/+1
| | | | | | | | | | | | | | | | | | The libvirt git repo contains test data that represents the layout of files in sysfs, which has two subdirs that mutually reference each other with symlinks. When pytest does test discovery it will traverse every directory it finds underneath the libvirt-python checkout. Since we checkout libvirt as a sub-dir, pytest traverses everything in libvirt git and gets stuck in an infinite loop following symlinks in the libvirt test data. Telling pytest to only look at the 'tests' subdir avoids this extra traversal. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* ci: pass --break-system-packages on Debian SidDaniel P. Berrangé2023-04-193-2/+6
| | | | | | | | Debian Sid python packages block users from installing packages using pip unless using a venv. A venv has no benefit when we are running in a throwaway container which has no need for software upgrades. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* ci: mark bleeding edge distros as non-gatingDaniel P. Berrangé2023-04-193-11/+18
| | | | | | | | Fedora Rawhide, Debian Sid and OpenSUSE Tumbleweed are all liable to have sporadic failures due to being bleeding edge distros. Thus they should not gate contributor changes that are otherwise correct. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* ci: regenerated with lcitool manifestDaniel P. Berrangé2023-04-1911-18/+39
| | | | | | This replaces OpenSUSE Leap 15.3 with 15.4 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Post-release version bump to 9.2.0v9.2.0Jiri Denemark2023-03-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* Fix sign compare offendersv9.1.0Michal Privoznik2023-02-132-11/+14
| | | | | | | | | | | | | | In a few places we compare signed and unsigned integers. In majority of cases it's because the iteration variable is declared as ssize_t but then in the for() loop it's compared against an unsigned int. But there is one case where the opposite happens (libvirt_virDomainSendKey()), or where an UINT_MAX (which is inherently unsigned) is compared against signed long. Also, use this opportunity to decrease scope of 'j' variable inside of libvirt_virDomainInterfaceAddresses(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Stop typecasting libvirt_intWrap() argumentsMichal Privoznik2023-02-131-35/+35
| | | | | | | There's no need to explicitly typecast arguments passed to libvirt_intWrap() as they are int or long already. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* libvirt-override: Don't typecast strlen() in debug printingsMichal Privoznik2023-02-131-2/+2
| | | | | | | | | | After some data was read from an incoming stream, we debug print their length using strlen() (assuming its text stream, not binary stream). Anyway, the debug format uses %d which then requires strlen() to be typecasted. Well, we can use %zu and drop the typecast. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* libvirt_virConnectOpenAuth: Avoid plain PyLong_AsLong() callMichal Privoznik2023-02-131-2/+4
| | | | | | | | | | | | | When constructing the list of credentials to pass to virConnectOpenAuth(), the virConnectAuth.credtype member is set via plain PyLong_AsLong() without any error checking. Well, the code relies on virConnectOpenAuth() to do sanity check of passed arguments. Switch to libvirt_intUnwrap() which does check for errors and avoid needless trip to libvirt's public API upon error. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* libvirt_virNodeGetInfo fixMichal Privoznik2023-02-131-1/+1
| | | | Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* typewrappers: Drop typecast in libvirt_intWrap()Michal Privoznik2023-02-131-1/+1
| | | | | | | | The libvirt_intWrap() accepts an integer and passes it to PyLong_FromLong() which accepts a long. It's perfectly okay to let compiler do that implicitly. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* typewrappers: Rework libvirt_uintWrap()Michal Privoznik2023-02-131-1/+1
| | | | | | | Python C API offers PyLong_FromUnsignedLong() which allows us to drop typecast. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* typewrappers: Rework libvirt_uintUnwrap()Michal Privoznik2023-02-131-4/+4
| | | | | | | | Python C API offers PyLong_AsUnsignedLong() which already raises an exception on negative values. Rewrite our libvirt_uintUnwrap() to use that and drop check for negative values. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Post-release version bump to 9.1.0Jiri Denemark2023-01-161-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* override: domain: Implement override for virDomainFDAssociatev9.0.0Peter Krempa2023-01-123-0/+85
| | | | | | | | The bindings generator can't generate proper bindings for FD passing so the bindings need to be implemented manually both the python wrapper and the C backend. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
* ci: manifest: Define RPM artifacts for regular CentOS Stream 8 buildErik Skultety2023-01-062-0/+13
| | | | | | | | | | | | | | | Commit 7360326 missed the fact that artifacts were only defined for the libvirt Git type of libvirt-python build (git is cloned, libvirt is built and then libvirt-python) based on the 'native_git_build_job_prebuilt_env' job template whereas libvirt CI expects the RPM artifacts to come from a job based on the 'native_build_job' template instead. Note that this patch is a hotfix to something which requires a proper cleanup to stay consistent with the way we're handling the same thing in libvirt-perl. Signed-off-by: Erik Skultety <eskultet@redhat.com>
* .gitignore: Ignore more common Python build artifactsErik Skultety2023-01-061-1/+7
| | | | Signed-off-by: Erik Skultety <eskultet@redhat.com>
* ci: manifest: Define artifacts cacheErik Skultety2023-01-052-3/+45
| | | | | | | | | | | | After commit 6e0d4d53 we lost RPM artifacts cache breaking the whole integration CI. The reason for that is that we manually defined the artifacts cache in gitlab.yml instead of manifest.yml. Naturally with the next lcitool update, gitlab.yml got overwritten according to manifest.yml which didn't define any artifacts cache. Fixes: 6e0d4d53d51e8aa9d537e404a886eab131e311cc Signed-off-by: Erik Skultety <eskultet@redhat.com>
* ci: manifest: Replace 'expiry' with 'expire_in'Erik Skultety2023-01-051-1/+1
| | | | | | | | 'expiry' isn't a keyword in lcitool anymore, the only reason why everything has kept working despite lcitool updates is that lcitool sets 'expire_in' to 2 days by default. Signed-off-by: Erik Skultety <eskultet@redhat.com>
* ci: Refresh and add Fedora 37 targetErik Skultety2023-01-049-59/+32
| | | | Signed-off-by: Erik Skultety <eskultet@redhat.com>
* Post-release version bump to 9.0.0Jiri Denemark2022-12-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* rpm: add explicit build dep on python3-setuptoolsv8.10.0Daniel P. Berrangé2022-11-231-0/+1
| | | | | | | | We previously got this implicitly via a dep from python3-pytest so never noticed that it was missing. The implicit dep is going away in rawhide real soon. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Post-release version bump to 8.10.0Jiri Denemark2022-11-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* ci: Expose built RPMs as artifactsv8.9.0Peter Krempa2022-10-132-2/+42
| | | | | | | | | | | Expose the artifacts from the centos-stream-8/9 and fedora 35/36 jobs so that the main libvirt integration testing project can consume them. The new libvirt sub-rpm containing a python helper to access QMP directly requires python environment which we didn't yet install in the integration job. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
* Fix memory leak in libvirt_virStreamRecv.Chris Gunn2022-10-101-2/+6
| | | | | | | | | The libvirt_virStreamRecv function uses a temporary allocated buffer to receive data before copying the data into a Python byte array. But there are some error paths where this buffer is not freed. This change fixes that memory leak. Signed-off-by: Chris Gunn <chrisgun@microsoft.com>
* ci: Fix the stage of the api-coverage jobErik Skultety2022-10-031-2/+2
| | | | | | | | | | | | | The 'extends' stanza supports a list, however there's a merge algorithm in place where a subsequent list entry overwrites all conflicting settings from the previous one - which is exactly what happened here as the gitlab-build-{local,prebuilt}-env job template overwrote api-coverage's stage to 'builds' whereas the original was 'sanity_checks'. Fixes: 4733e2a2d13cb9a85127ba17c04cc29278b31e89 Signed-off-by: Erik Skultety <eskultet@redhat.com>
* Post-release version bump to 8.9.0Jiri Denemark2022-10-031-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* ci: refresh with latest lcitool manifestDaniel P. Berrangé2022-09-3030-341/+1166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This refresh switches the CI for contributors to be triggered by merge requests. Pushing to a branch in a fork will no longer run CI pipelines, in order to avoid consuming CI minutes. To regain the original behaviour contributors can opt-in to a pipeline on push git push <remote> -o ci.variable=RUN_PIPELINE=1 This variable can also be set globally on the repository, though this is not recommended. Upstream repo pushes to branches will run CI. The use of containers has changed in this update, with only the upstream repo creating containers, in order to avoid consuming contributors' limited storage quotas. A fork with existing container images may delete them. Containers will be rebuilt upstream when pushing commits with CI changes to the default branch. Any other scenario with CI changes will simply install build pre-requisite packages in a throaway environment, using the ci/buildenv/ scripts. These scripts may also be used on a contributor's local machines. With pipelines triggered by merge requests, it is also now possible to workaround the inability of contributors to run pipelines if they have run out of CI quota. A project member can trigger a pipeline from the merge request, which will run in context of upstream, however, note this should only be done after reviewing the code for any malicious CI changes. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Link libvirtmod_* modules also with libvirtv8.8.0Bastian Germann2022-09-091-2/+2
| | | | | | | The -lvirt linker flag has to be added to the libvirtmod_qemu and libvirtmod_lxc modules as well. Signed-off-by: Bastian Germann <bage@linutronix.de>
* Replace uint with unsigned intBastian Germann2022-09-092-2/+2
| | | | | | Mingw-w64 target does not support uint definition. Signed-off-by: Bastian Germann <bage@linutronix.de>
* Post-release version bump to 8.8.0Jiri Denemark2022-09-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* Post-release version bump to 8.7.0v8.7.0Jiri Denemark2022-08-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* libvirt-utils: Clear error when guessing typed param typev8.6.0Michal Privoznik2022-07-081-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our APIs which accept typed parameters are usually exposed in python as accepting dictionary, for instance: virDomainSetIOThreadParams(..., virTypedParameterPtr params, ...) -> virDomain.setIOThreadParams(..., {}, ...) Now, before calling the C API, the dictionary is processed by virPyDictToTypedParams() which accepts an additional argument: array that hints types for each typed parameter. However, if a key is not in the array we guess what the correct type might be. This is done by attempting conversion from python into string, if that fails then into boolean, then into long, only to fall back to double. Now, for the long type we can have two cases: the value is non-negative (ULL) or it is negative (LL). Therefore, we firstly attempt ULL case and if that fails we stick with the latter. However, after we attempted the ULL conversion, python records an error internally (which is then queried via PyErr_Occurred()), but the error is never cleared out. This leads to spurious paths taken afterwards: e.g. when libvirt_longlongUnwrap() is trying to convert -1, it fails. But not rightfully - the PyErr_Occurred() check it performs has nothing to do with any of its actions, rather than our guessing work done before. Therefore, clear the error after we've guessed the type. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Add VIR_DOMAIN_IOTHREAD_THREAD_POOL_{MIN,MAX} macrosMichal Privoznik2022-07-081-0/+4
| | | | | | | | | | | | | | The python version of virDomainSetIOThreadParams (setIOThreadParams()), expects two arguments on input: the thread ID and a dictionary which is then translated into our typed parameters. During this translation we use a helper array which holds type for each typed parameter supported (virPyDomainSetIOThreadParams[]). Otherwise we guess what the correct type is. Now, when introducing VIR_DOMAIN_IOTHREAD_THREAD_POOL_{MIN,MAX} typed params into libvirt I forgot to update the array. Do that now. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
* Post-release version bump to 8.6.0Jiri Denemark2022-07-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* setup: make 'clean' command compatible again with distutilsv8.5.0Pino Toscano2022-06-251-0/+10
| | | | | | | | | | | | | | | | | | After the switch of 'my_clean' to a simple Command, the 'clean' command has no more bits for options, resulting in distutils (either external or embedded in setuptools) complaining about it: distutils.errors.DistutilsClassError: command class <class '__main__.my_clean'> must provide 'user_options' attribute (a list of tuples) To overcome that, provide all the standard bits from options, i.e. the 'user_options' list, and the 'initialize_options' & 'finalize_options' methods. In addition, add a dummy 'all' option, as distutils wants it: error: error in [...]/.pydistutils.cfg: command 'my_clean' has no such option 'all' Fixes commit a965c91c6fa1275613edbbef75c0422574eb9ff2 Signed-off-by: Pino Toscano <ptoscano@redhat.com>
* setup: advertize Python 3.9 and 3.10 supportDaniel P. Berrangé2022-06-081-0/+2
| | | | | | | Add classifiers that indicate we intend to support python versions 3.9 and 3.10. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* examples: remove use of deprecated setDaemon methodDaniel P. Berrangé2022-06-081-6/+10
| | | | | | | | In Python 3.10 the setDaemon method was deprecated. It is redundant since the 'daemon' parameter can be given when creating the thread, or the 'daemon' attribute can be set after it was created. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* tests: expand AIO tests and add more commentsDaniel P. Berrangé2022-06-081-8/+40
| | | | | | | | | | | | | Add a test for one more usage scenario that was possible in the past, whereby libvirt events are registered before starting the asyncio loop, but we let libvirt find the loop associated with the current thread. Skip the test relies on auto-creating an event loop with Python >= 3.10 since it now triggers a deprecation warning which will soon turn into a RuntimeError. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* tests: use mocks to allow calling virEventRegisterImpl many timesDaniel P. Berrangé2022-06-084-25/+102
| | | | | | | | | | | | | | We currently have to run each of the test_aio.py test cases in a separate process, because libvirt.virEventRegisterImpl can only be called once per process. This leads to quite unpleasant console output when running tests. By introducing a mock for libvirt.virEventRegisterImpl we can regain the ability to run everything in a single process. The only caveat is that it relies on tests to fully cleanup, but in practice this is ok for our current tests. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* tests: add libvirtaio test coverageChris Gunn2022-06-083-1/+129
| | | | Signed-off-by: Chris Gunn <chrisgun@microsoft.com>
* libvirtaio: add better docs on best practice usage patternDaniel P. Berrangé2022-06-081-2/+21
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* libvirtio: lazy create the Event object in drain()Daniel P. Berrangé2022-06-081-5/+11
| | | | | | | | | | | | | | | | | | | | | The drain method uses an asyncio.Event object to be notified when other coroutines have removed all registered callbacks. The Event object needs to be associated with the coroutine that the event loop is running with and currently this is achieved by passing in the 'loop' parameter. Unfortunately Python 3.10 has removed the 'loop' parameter and now the object is associated implicitly with the current thread's event loop. At the time the virEventAsyncIOImpl constructor is called, however, there is no guarantee that an event loop has been set for the thread. The explicitly passed in 'loop' parameter would handle this scenario. For portability with Python >= 3.10 we need to delay creation of the Event object until we have a guarantee that there is a loop associated with the current thread. This is achieved by lazily creating the Event object inside the 'drain' method, which is expected to be invoked from coroutine context and thus ensure a loop is associated. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* libvirtaio: convert to using 'async' / 'await' syntaxChris Gunn2022-06-081-9/+6
| | | | | | | | | | | | | The 'async' keyword is new in Python 3.5, as a way to declare that a method is a coroutine. This replaces the '@asyncio.coroutine' decorator that is deprecated since 3.8 and scheduled to be removed in 3.11 The 'await' keyword has to be used instead of 'yield' from any coroutines declared with 'async'. Signed-off-by: Chris Gunn <chrisgun@microsoft.com> [DB: Split off from a larger patch mixing multiple changes] Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* libvirtaio: drop back compat for python < 3.4.4Chris Gunn2022-06-081-11/+3
| | | | | | | | | | setup.py ensures we have python >= 3.5, so there is no need to do back compat with the 'asyncio.ensure_future' method, which was new in 3.4.4 Signed-off-by: Chris Gunn <chrisgun@microsoft.com> [DB: Split off from a larger patch mixing multiple changes] Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Post-release version bump to 8.5.0Jiri Denemark2022-06-011-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>