summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* examples: Replace sys.exit() with exit()Philipp Hahn2020-08-0510-28/+18
| | | | | | No need to import sys. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: Cleanup importsPhilipp Hahn2020-08-058-15/+10
| | | | | | | | | | Break import into multiple lines as recommended by PEP-8 Move imports to top Remove unused imports Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: Do not use bare exceptPhilipp Hahn2020-08-052-4/+4
| | | | | | as it also catches SystemExit, InterruptedError, SyntaxError and such. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: Convert to ArgumentParserPhilipp Hahn2020-08-0512-236/+143
| | | | | | | | Replace getopt() and hand-rolled-parser with argparse.ArgumentParser. Fix wrong header comments copy-pasted from domstart.py Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: Add/fix PEP 484 type annotationPhilipp Hahn2020-08-0511-120/+129
| | | | Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples: Add missing return valuesPhilipp Hahn2020-08-051-0/+1
| | | | | | examples/dhcpleases.py:45: error: Missing return statement Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/nodestat: Fix None comparisonPhilipp Hahn2020-08-051-3/+3
| | | | | | | | | | | | | | "is" compares for "points to the same object", which for strings is the same as comparing the byte sequence itself as Python hashes each strings to only stores a unique copy of each string. > examples/nodestats.py:86:43: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple) > examples/nodestats.py:91:12: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple) > examples/nodestats.py:94:40: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple) Use "==" and "!=" for string comparsion. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/consolecallback: Fix assorted errorsPhilipp Hahn2020-08-051-1/+2
| | | | | | | | Assert stream is opened before receiving bytes. Need to check for bytes() instead of [unicode]str(). Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/consolecallback: Add var to save callbackPhilipp Hahn2020-08-051-0/+1
| | | | | | > examples/consolecallback.py:98: error: "Console" has no attribute "stdin_watch" Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/esxlist: Fix Python 2 raw_input()Philipp Hahn2020-08-051-1/+1
| | | | | | which was renamed to input() for Python 3. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/event-test: Use atexit for Python 3Philipp Hahn2020-08-051-5/+3
| | | | | | | | Assigning sys.exitfunc no longer works with Python 3. Use atexit.register() instead. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/event-test: Remove unneeded global statementPhilipp Hahn2020-08-051-8/+0
| | | | | | It only needed when a value is assigned. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/dhcp*: Fix None comparisonPhilipp Hahn2020-08-052-2/+2
| | | | | | | None should be compared with "is None" instead of "== None", as the later would invoke a "__cmp__()" method. Signed-off-by: Philipp Hahn <hahn@univention.de>
* examples/*: Remove stray semicolonPhilipp Hahn2020-08-053-4/+4
| | | | | | This is Python, not C Signed-off-by: Philipp Hahn <hahn@univention.de>
* ci: refresh dockerfiles for changed libvirt build systemDaniel P. Berrangé2020-08-0414-123/+160
| | | | | | | Libvirt changed from autotools to meson. All the containers need refreshing and the CI recipes updated. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Post-release version bump to 6.7.0Jiri Denemark2020-08-031-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* generator: Fix parent typev6.6.0Philipp Hahn2020-07-272-34/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The constructors for virDomain, virStoragePool, virDomainCheckpoint, virDomainSnapshot expect virConnect as their first argument. The current code always uses `self`, which is okay when such an instance is created from a method of virConnect itself, but there are several cases where this is not the case: virDomain.migrate() -> virDomain virDomain.migrate2() -> virDomain virDomain.migrate3() -> virDomain virDomainCheckpoint.getParent() -> virDomainCheckpoint virDomainSnapshot.getParent() -> virDomainSnapshot virStorageVol.storagePoolLookupByVolume() -> virStoragePool > libvirt.py:1850: error: Argument 1 to "virDomain" has incompatible type "virDomain"; expected "virConnect" > libvirt.py:1871: error: Argument 1 to "virDomain" has incompatible type "virDomain"; expected "virConnect" > libvirt.py:1888: error: Argument 1 to "virDomain" has incompatible type "virDomain"; expected "virConnect" > libvirt.py:3422: error: Argument 1 to "virStorageVol" has incompatible type "virStoragePool"; expected "virConnect" > libvirt.py:6835: error: Argument 1 to "virDomainCheckpoint" has incompatible type "virDomainCheckpoint"; expected "virDomain" > libvirt.py:6943: error: Argument 1 to "virDomainSnapshot" has incompatible type "virDomainSnapshot"; expected "virDomain" >>> import libvirt >>> con = libvirt.open('test:///default') >>> dom = con.lookupByName("test") >>> first = dom.checkpointCreateXML("""<domaincheckpoint><name>First</name></domaincheckpoint>""") >>> first.domain() <libvirt.virDomain object at 0x7f728c3b6b80> ^^^^^^ >>> second = dom.checkpointCreateXML("""<domaincheckpoint><name>Second</name></domaincheckpoint>""") >>> parent = second.getParent() >>> parent.domain() <libvirt.virDomainCheckpoint object at 0x7f728c424d30> ^^^^^^^^^^^^^^^^ Signed-off-by: Philipp Hahn <hahn@univention.de>
* debug: Fix bit-rot in debug outputPhilipp Hahn2020-07-274-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the compiler optimize out the printf() call instead of doing it with the pre-processor as the later does not catch format string errors or the following case, where NULLSTR() is used but not defined: > libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’: > libvirt-qemu-override.c:271:34: warning: implicit declaration of function ‘NULLSTR’; did you mean ‘NULL’? [-Wimplicit-function-declaration] > 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags); > | ^~~~~~~ > libvirt-qemu-override.c:39:28: note: in definition of macro ‘DEBUG’ > 39 | while (0) {printf(fmt, __VA_ARGS__);} > | ^~~~~~~~~~~ > libvirt-qemu-override.c:270:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=] > 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags); > | ~~~~~~~~~~~~~~ > | | > | int > libvirt-qemu-override.c:39:23: note: in definition of macro ‘DEBUG’ > 39 | while (0) {printf(fmt, __VA_ARGS__);} > | ^~~ > libvirt-qemu-override.c:270:73: note: format string is defined here > 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n", > | ~^ > | | > | char * > | %d Copy the definition of NULLSTR from libvirt/src/internal.h to typewrappers.h Signed-off-by: Philipp Hahn <hahn@univention.de>
* libvirtaio: Fix return types of callbackPhilipp Hahn2020-07-271-6/+12
| | | | | | | | | | | | | | libvirt defines the signature for the callback functions, e.g. the functions for remove() must return -1 on error and 0 on success. Raising an exception violates that contract. _remove_timeout() did not explicitly handle a double-remove and implicitly passed on the exception. update() expects no return value, so remove the pointless return to pass on None. Signed-off-by: Philipp Hahn <hahn@univention.de>
* qemu-api: Fix return typePhilipp Hahn2020-07-271-2/+2
| | | | | | The API XML description uses "C types": "str *" is not valid. Signed-off-by: Philipp Hahn <hahn@univention.de>
* generator: Fix domainCheckpoint.listAllChildren()Philipp Hahn2020-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | virDomainCheckpoint(dom, _obj) expects a reference to the virDomain as its first argument, but virDomainCheckpoint.listAllChildren() passes `self` instead: libvirt.py:7056: error: Argument 1 to "virDomainCheckpoint" has incompatible type "virDomainCheckpoint"; expected "virDomain" >>> import libvirt >>> con = libvirt.open('test:///default') >>> dom = con.lookupByName("test") >>> first = dom.checkpointCreateXML("""<domaincheckpoint><name>First</name></domaincheckpoint>""") >>> second = dom.checkpointCreateXML("""<domaincheckpoint><name>Second</name></domaincheckpoint>""") >>> child, = first.listAllChildren() >>> second.domain() <libvirt.virDomain object at 0x7f828d777b80> ^^^^^^^^^ >>> child.domain() <libvirt.virDomainCheckpoint object at 0x7f828d8160a0> ^^^^^^^^^^^^^^^^^^^ Signed-off-by: Philipp Hahn <hahn@univention.de>
* generator: Fix domainSnapshot.listAllChildren()Philipp Hahn2020-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | virDomainSnapshot(dom, _obj) expects a reference to the virDomain as its first argument, but virDomainSnapshot.listAllChildren() passes `self` instead: libvirt.py:6459: error: Argument 1 to "virDomainSnapshot" has incompatible type "virDomainSnapshot"; expected "virDomain" >>> import libvirt >>> con = libvirt.open('test:///default') >>> dom = con.lookupByName("test") >>> first = dom.snapshotCreateXML("""<domainsnapshot><name>First</name></domainsnapshot>""") >>> second = dom.snapshotCreateXML("""<domainsnapshot><name>Second</name></domainsnapshot>""") >>> child, = first.listAllChildren() >>> second.domain() <libvirt.virDomain object at 0x7fb32be3cfd0> ^^^^^^^^^ >>> child.domain() <libvirt.virDomainSnapshot object at 0x7fb32bdb9080> ^^^^^^^^^^^^^^^^^ Signed-off-by: Philipp Hahn <hahn@univention.de>
* generator: Fix string formattingPhilipp Hahn2020-07-271-1/+1
| | | | | | remove excessive arguments. Signed-off-by: Philipp Hahn <hahn@univention.de>
* generator: Fix undefined variables filePhilipp Hahn2020-07-271-2/+2
| | | | | | | generator.py:931:15: F821 undefined name 'file' generator.py:951:15: F821 undefined name 'file' Signed-off-by: Philipp Hahn <hahn@univention.de>
* Post-release version bump to 6.6.0Jiri Denemark2020-07-231-1/+1
| | | | Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
* generator: Fix typosRadostin Stoyanov2020-07-171-7/+7
| | | | Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
* examples: Refactor domipaddrsRadostin Stoyanov2020-07-151-51/+55
| | | | | | This patch makes domipaddrs example compatible with Python3. Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
* Fix PY_SSIZE_T_CLEAN deprecation warningCole Robinson2020-07-061-9/+10
| | | | | | | | | | | | | | | | | | | | Seen running on fedora 32: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats ret = libvirtmod.virDomainLookupByUUID(self._o, uuid) This comes from here: https://bugs.python.org/issue36381 See the section about PY_SSIZE_T_CLEAN here: https://docs.python.org/3/c-api/arg.html#strings-and-buffers Solution is to use Py_ssize_t instead of int for unpacked '#' values, combined with defined PY_SSIZE_T_CLEAN before importing Python.h. The latter turns these deprecation warnings into runtime segfaults though if we missed an instance. I verified the virt-manager's test suite works fine after this change Signed-off-by: Cole Robinson <crobinso@redhat.com>
* generator: Fix SyntaxWarningCole Robinson2020-07-051-1/+1
| | | | | | | | | | | | $ ./setup.py build running build /usr/bin/pkg-config --print-errors --atleast-version=0.9.11 libvirt /usr/bin/python3 generator.py libvirt /usr/share/libvirt/api/libvirt-api.xml generator.py:1562: SyntaxWarning: "is" with a literal. Did you mean "=="? if classname is "virStorageVol": ... Signed-off-by: Cole Robinson <crobinso@redhat.com>
* virStream: Use larger buffer for sendAll/recvAll methodsMichal Privoznik2020-07-032-4/+10
| | | | | | | | | | | | | | | | | | | | There are four methods which receive/send entire stream (sendAll(), recvAll(), sparseSendAll() and sparseRecvAll()). All these have an intermediary buffer which is either filled by incoming stream and passed to a user provided callback to handle the data, or the other way round - user fills it with data they want to send and the buffer is handed over to virStream. But the buffer is incredibly small which leads to smaller packets being sent and thus increased overhead. What we can do is to use the same buffer as their C counterparts do (e.g. virStreamSendAll()) - they all use VIR_NET_MESSAGE_LEGACY_PAYLOAD_MAX long buffer (which is the maximum size of a stream packet we send) - this is almost exactly 256KiB (it's 256KiB - 24B for the header). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* MANIFEST: Distribute sparsestream.py exampleMichal Privoznik2020-07-031-0/+1
| | | | | Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
* setup: post-release version bump to 6.5.0v6.5.0Daniel P. Berrangé2020-06-081-1/+1
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* ci: Test installationv6.4.0Andrea Bolognani2020-05-221-0/+2
| | | | Signed-off-by: Andrea Bolognani <abologna@redhat.com>
* ci: Make job skips more flexibleAndrea Bolognani2020-05-221-2/+4
| | | | | | | | Instead of hardcoding the names of the targets for which certain steps should be skipped, use a separate variable to store that information. Signed-off-by: Andrea Bolognani <abologna@redhat.com>
* examples: remove docs about non-existent XML filesDaniel P. Berrangé2020-05-141-5/+0
| | | | | | | | The docs refers to XML files that don't exist in the python binding since it was split off from the main libvirt.git repo. Fixes #3 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Drop largely empty and unused NEWS fileDaniel P. Berrangé2020-05-143-11/+1
| | | | | | | | We bundle a git generated ChangeLog file in the dist, and never add any entries to the NEWS file. Fixes #2 Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* gitlab: add testing of the rpmbuild processDaniel P. Berrangé2020-05-141-0/+4
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* gitlab: add CONTRIBUTING.rst file to indicate use of merge requestsDaniel P. Berrangé2020-05-052-4/+28
| | | | | | | | | With the introduction of automated CI pipelines, we are now ready to switch to using merge requests for the project. With this switch we longer wish to have patches sent to the mailing list, and thus the git-publish config is removed. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* setup: post-release version bump to 6.4.0Daniel P. Berrangé2020-05-051-1/+1
| | | | Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Release of libvirt-python 6.3.0v6.3.0Daniel Veillard2020-05-051-1/+1
| | | | | | * setup.py: updated for the release Signed-off-by: Daniel Veillard <veillard@redhat.com>
* gitlab: fix typo s/perl/python/ in docker cached image nameDaniel P. Berrangé2020-05-011-1/+1
| | | | | Reported-by: Pavel Hrdina <phrdina@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* travis: delete redundant configurationDaniel P. Berrangé2020-05-011-55/+0
| | | | | | | | | Now that we're standardizing on GitLab CI for both official gating CI and developer CI, there's no compelling reason to continue to support Travis CI. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* gitlab: introduce CI jobs testing git master & distro libvirtDaniel P. Berrangé2020-05-0114-0/+861
| | | | | | | | | | | | | | | | The python build needs to validate two axis - A variety of libvirt versions - A variety of python versions We get coverage for both these axis by running a build against the distro provided libvirt packages. All that is then missing is a build against the latest libvirt git master, which only needs to be run on a single distro, for which CentOS 8 is picked as a stable long life base. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* test: workaround missing VIR_TYPED_PARAM enums in API definitionDaniel P. Berrangé2020-05-011-1/+5
| | | | | | | | | | | | | | | | On Ubuntu 18.04 with libvirt 4.0.0 libvirt-python build fails running test /usr/bin/python3 sanitytest.py build/lib.linux-x86_64-3.6 /usr/share/libvirt/api/libvirt-api.xml Cannot get a value of enum VIR_TYPED_PARAM_BOOLEAN (originally VIR_DOMAIN_BLKIO_PARAM_BOOLEAN) Cannot get a value of enum VIR_TYPED_PARAM_DOUBLE (originally VIR_DOMAIN_BLKIO_PARAM_DOUBLE) Cannot get a value of enum VIR_TYPED_PARAM_INT (originally VIR_DOMAIN_BLKIO_PARAM_INT) ...snip... The code generated for the binding is still correct and so we can just whitelist this error scenario. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* gitlab: add CI job for validating DCO signoffDaniel P. Berrangé2020-04-301-0/+16
| | | | | | | | This job uses the shared "check-dco" image to validate that all commits on a branch in a developer's repo fork have a suitable Signed-off-by statement present. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* examples: Fix connection error handling 2Philipp Hahn2020-04-272-4/+6
| | | | | | | | | Fix two more cases in examples as libvirt.open*() does not return None but raises an exception Fixes: 283e2bc693746164b22226e14d6fe3ccd38a07bf Signed-off-by: Philipp Hahn <hahn@univention.de> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
* setup: require python >= 3.5 to buildDaniel P. Berrangé2020-04-221-2/+6
| | | | | | | | Python 3.5 is the oldest Python version available across our supported build platforms. Reviewed-by: Philipp Hahn <hahn@univention.de> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* examples: Fix connection error handlingPhilipp Hahn2020-04-205-11/+15
| | | | | | libvirt.open*() does not return None but raises an exception Signed-off-by: Philipp Hahn <hahn@univention.de>
* github: enable lockdown of issues and merge requestsDaniel P. Berrangé2020-04-071-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Libvirt uses GitHub as an automated read-only mirror. The goals were to have a disaster recovery backup for libvirt.org, a way to make it easy for people to clone their own private copy of libvirt Git, and finally as a way to interact with apps like Travis. The project description was set to a message telling people that we don't respond to pull requests. This was quite a negative message to potential contributors, and also did not give them any guidance about the right way to submit to libvirt. Many also missed the description and submitted issues or pull requests regardless. It is possible to disable the issue tracker in GitHub, but there is no way to disable merge requests. Disabling the issue tracker would also leave the problem of users not being given any positive information about where they should be reporting instead. There is a fairly new 3rd party application built for GitHub that provides a bot which auto-responds to both issues and merge requests, closing and locking them, with a arbitrary comment: https://github.com/apps/repo-lockdown This commit adds a suitable configuration file for libvirt, which tries to give a positive response to user's issue/pullreq and guide them to the desired contribution path on GitLab. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Release of libvirt-python 6.2.0v6.2.0Daniel Veillard2020-04-021-1/+1
| | | | | | * setup.py: bumped version to 6.2.0 Signed-off-by: Daniel Veillard <veillard@redhat.com>