1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-30 23:41:52 +03:00
Commit Graph

811 Commits

Author SHA1 Message Date
f58fcd69d2 event-test.py: Convert GRAPHICS events
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
dfa00dddd5 event-test.py: Convert AGENT events
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
f5928c6711 event-test.py: Convert ERROR events
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
ba45c10511 event-test.py: Convert WATCHDOG events
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
e5ecf38911 event-test.py: Convert BLOCKJOB events
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
257157c984 event-test.py: Convert LIVECYCLE events
to use new Description class

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
26350dc97d event-test.py: Add class for event descriptions
Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
37e56947cc event-test.py: Simplify event ID lists
by directly building the list with the IDs instead of appending them
explicitly.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:06:00 +02:00
73b5ae581c event-test.py: Merge livecycle callbacks
Registering the same function twice using the old domainEventRegister()
interface would not work, as the function reference is used for
un-registering.

But it is not a problem with the new interface domainEventRegisterAny(),
as that returns a unique ID.

While at it also demonstrate the 'opaque' mechanism.

Signed-off-by: Philipp Hahn <hahn@univention.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-24 09:06:00 +02:00
d408dc944d event-test.py: Use __file__
instead of sys.argv[0]

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:05:59 +02:00
655b94803e event-test.py: Add missing globale statement
to fix loop termination on exit.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:05:59 +02:00
b7d5d60274 event-test.py: Remove dead assignment
variable is unused

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:05:59 +02:00
5a7a871961 event-test.py: Remove extra parenthesis
Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:05:59 +02:00
77e700c501 event-test.py: Handle closed connection
If libvirtd terminates while event-test.py has an open connection to it,
it will crash with the following traceback:

> myConnectionCloseCallback: qemu:///session: Error
> Exception in thread libvirtEventLoop:
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
>     self.run()
>   File "/usr/lib/python2.7/threading.py", line 754, in run
>     self.__target(*self.__args, **self.__kwargs)
>   File "examples/event-test.py", line 424, in virEventLoopPollRun
>     eventLoop.run_loop()
>   File "examples/event-test.py", line 242, in run_loop
>     self.run_once()
>   File "examples/event-test.py", line 187, in run_once
>     libvirt.virEventInvokeFreeCallback(opaque)
> AttributeError: 'module' object has no attribute 'virEventInvokeFreeCallback'
>
> libvirt: XML-RPC error : internal error: client socket is closed
> Traceback (most recent call last):
>   File "examples/event-test.py", line 872, in <module>
>     main()
>   File "examples/event-test.py", line 854, in main
>     vc.secretEventDeregisterAny(id)
>   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 4987, in secretEventDeregisterAny
>     if ret == -1: raise libvirtError ('virConnectSecretEventDeregisterAny() failed', conn=self)
> libvirt.libvirtError: internal error: client socket is closed
> Closing qemu:///session

Skip unregistering the event callbacks and closing the connection if the
connection is already broken / closed.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2018-09-24 09:05:59 +02:00
d5342a9803 event-test.py: Sync list of domain lifecycle events
Add new events to prevent crash:
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/dist-packages/libvirt.py", line 4601, in _dispatchDomainEventCallbacks
>     cb(self, virDomain(self, _obj=dom), event, detail, opaque)
>   File "libvirt-python/examples/event-test.py", line 505, in myDomainEventCallback1
>     domDetailToString(event, detail)))
>   File "libvirt-python/examples/event-test.py", line 484, in domDetailToString
>     return domEventStrings[event][detail]
> IndexError: tuple index out of range

Signed-off-by: Philipp Hahn <hahn@univention.de>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-09-24 09:05:59 +02:00
fc4000152e Release of libvirt-python=4.7.0
* setup.py: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
v4.7.0
2018-09-03 19:23:31 +02:00
0159ae02df Release of libvirt-python-4.6.0
* setup.py: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
v4.6.0
2018-08-06 11:42:06 +02:00
7b4d676065 rpm: update min required rhel/fedora
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-23 14:10:58 +01:00
cc55ae62d7 rpm: add BuildRequires on gcc
The gcc RPM is no longer part of the default build root.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-23 14:10:56 +01:00
5ca2cb0018 rpm: use the versioned python2 macro names
The use of non-versioned python2 macro names is deprecated in Fedora

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-23 14:10:37 +01:00
f2b3e946e2 travis: add libvirt 4.5.0 version to build matrix
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-16 15:27:26 +01:00
d68c14e069 fix build with older libvirt missing virNWFilterBindingPtr
While we correctly disable all public API bindings that rely on
virNWFilterBindingPtr, the generator is still creating a helper function
that needs it - libvirt_virNWFilterBinding_pointer. Making this helper
conditional is a little hairy, so just provide a trivial typedef to keep
it happy.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-07-16 15:26:53 +01:00
2efd1e9ab2 spec: Remove Group: and %defattr
These are only needed for RHEL5 builds, which are no longer supported

https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/CMCUBB4SWS3URHTRRS3OPFM4HF5CGKBW/
https://fedoraproject.org/wiki/RPMGroups

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2018-07-10 13:34:44 -04:00
74b1e6d3f8 Release of libvirt-python-4.5.0
* setup.py: updated for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
v4.5.0
2018-07-02 22:17:36 +02:00
c1f06dde29 Fix bugs in nwfilter binding APIs
We did not correctly mangle the API names in two cases, and we also
forgot to specialize the lookup method name in the sanity test.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-06-28 12:29:21 +01:00
d5aae37c61 Add support for nwfilter binding objects / apis
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-06-28 12:04:05 +01:00
e27528204c libvirtaio: Fix compat with python 3.7
In python 3.7, async is now a keyword, so this throws a syntax error:

  File "/usr/lib64/python3.7/site-packages/libvirtaio.py", line 49
    from asyncio import async as ensure_future
                            ^
  SyntaxError: invalid syntax

Switch to getattr trickery to accomplish the same goal

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2018-06-27 10:07:39 -04:00
6c136b8150 Add support for virNodeGetSEVInfo
This binding allows to query the AMD's SEV firmware for various platform
specific things, like a PDH certificate and a certificate chain to
establish a trusted connection with the firmware. Because the API uses
typed params, it's exempted from generation.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-14 17:23:19 +02:00
dbae262811 Add support for virDomainGetLaunchSecurityInfo
Libvirt recently introduced support for getting launch security
parameters, most notably AMD SEV VM memory measurement. This API can't
be generated as it's using typed parameters which we need to allocate.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-14 17:22:59 +02:00
a950b08317 libvirt_charPtrUnwrap: remove unnecessary check of returned string
Function libvirt_charPtrUnwrap() either fails or always sets the
unwrapped string so there is no need to check it explicitly.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:38 +02:00
0c2d0c9be9 libvirt-override: Reset exception if the error is ignored
In virConnectCredCallbackWrapper() we ignore the error case of
libvirt_charPtrUnwrap() function so we should also reset the exception.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:36 +02:00
181a30867a typewrappers: Fix libvirt_charPtrUnwrap to set an exception if it fails
If the function fails it should always set an exception.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:33 +02:00
fb70ad1599 libvirt-utils: remove unused py_str function
Commit <57a160b5248ba47d4e1c9d22d95847dad8e0524f> removed last usage
but did not remove the function itself.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-06-12 10:27:14 +02:00
c682257e6f Blacklist virGetLastError{Code,Domain}
These methods will not be exposed to apps, since we auto raise
all errors.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-06-06 16:49:32 +01:00
8099ca5ecb Release of libvirt-python-4.4.0
* setup.py: update for release

Signed-off-by: Daniel Veillard <veillard@redhat.com>
v4.4.0
2018-06-04 22:35:30 +02:00
0f3f82e8be Add support for virConnectBaselineHypervisorCPU
The python bindings for this API cannot be generated because are
generator is not capable of handling string arrays (char **) parameters.

https://bugzilla.redhat.com/show_bug.cgi?id=1584676

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2018-06-01 08:16:48 +02:00
bae22e3eb7 event-test.py: Sync list of storage lifecycle events
https://bugzilla.redhat.com/show_bug.cgi?id=1578337

Since libvirt 3.8.0 we have 6 events: defined, undefined,
started, stopped, created, deleted. However, the last two were
missing in a string list that translates libvirt events (int)
into human readable strings.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2018-05-22 14:22:46 +02:00
d23f8bc3a3 Allow virConnect to be used as a context manager
The libvirt python bindings are now more 'pythonic' as virConnect can
now be used as a context manager.

For example, it's possible to write the following code:

with libvirt.open() as conn:
    # do something with the connection...
    print(conn.listAllDomains())

At the end of this with-block the connection will be closed
automatically.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
2018-05-16 10:40:46 +02:00
6f0456cdbc libvirt-override.py: remove unused import
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2018-05-16 10:40:46 +02:00
c84192fbd4 libvirt-override.py: fix sparseSendAll
Variable ret is used before assignment.

Signed-off-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
2018-05-16 10:40:46 +02:00
318e305512 libvirt_qemu/lxc: fix a namespace issue
Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
2018-05-16 10:40:46 +02:00
0a07908e69 libvirt_qemu/lxc: import 'sys' package
This fixes the pylint [1] warning "E: 25,16: Undefined variable
'sys' (undefined-variable)".

[1] https://www.pylint.org/

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
2018-05-16 10:40:46 +02:00
9bf6f3d46f maint: Drop autobuild.sh
The Test-AutoBuild project, that this script is supposed
to be used with, hasn't seen any activity in ~7 years;
these days, libvirt-python CI builds are happening on the
Jenkins-based CentOS CI environment under the libvirt
umbrella[1], and in that context the script is not used
at all.

[1] https://ci.centos.org/view/libvirt/

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2018-05-03 17:54:16 +02:00
41e0a95f50 git: add config file telling git-publish how to send patches
The "git-publish" tool is a useful git extension for sending patch
series for code review. It automatically creates versioned tags
each time code on a branch is sent, so that there is a record of
each version. It also remembers the cover letter so it does not
need re-entering each time the series is reposted.

With this config file present it is now sufficient[1] to run

  $ git publish

to send all patches in a branch to the list for review, with the
correct subject prefix added for this non-core libvirt module.

[1] Assuming your $HOME/.gitconfig has an SMTP server listed
at least e.g.

   [sendemail]
        smtpserver = smtp.example.com

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
v4.3.0
2018-04-24 10:46:59 +01:00
c99ed22847 Fix build with older libvirt versions
The libvirt python module is supposed to build with historical versions
of the API back to 0.9.1, which means all constants / methods must be
wrapped in conditionals. This was accidentally forgotten in:

  commit 314b2346df
  Author: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
  Date:   Wed Feb 7 17:49:30 2018 +0300

    Set hints for virPyDictToTypedParams

    Predefine hints for all parameters possible to avoid wrong type
    convert.

This broke the build against any libvirt < 2.0.0

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-19 16:07:19 +01:00
899dc23352 Post-release version bump to 4.3.0
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-03 14:27:25 +01:00
74eab13a2b Disable Python 2 on future RHEL and Fedora > 29
The end of Python 2 is nearing, so declare when it will be removed
from libvirt Python binding RPMs.

NB, this doesn't imply we'll be removing py2 support from upstream
libvirt-python on the same timeframe - we'll consider what todo
wrt that when upstream Python 2 finally goes EOL.

Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
v4.2.0
2018-03-23 15:18:51 +00:00
f9695b9b01 Post-release version bump to 4.2.0
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-03-05 15:09:24 +00:00
cdb2dcb4ea Release of libvirt-python 4.1.0
Signed-off-by: Daniel Veillard <veillard@redhat.com>
v4.1.0
2018-03-05 11:51:51 +01:00
b3f1a3adb0 Fix virPyDictToTypedParams type hint for block copy params
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2018-02-19 15:55:51 +01:00