1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-12 08:59:36 +03:00
Commit Graph

527 Commits

Author SHA1 Message Date
c5bbd5bd9d override: add virDomainFSFreeze and virDomainFSThaw API
Add binding for the new virDomainFSFreeze and virDomainFSThaw functions
added in libvirt 1.2.5. These require override since these take a list
of mountpoints path string. The methods are named 'fsFreeze' and
'fsThaw'.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-05-16 15:45:25 +02:00
e8e1de7f1f Bump version to 1.2.5 for new dev cycle
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-05-05 15:46:47 +02:00
959629a801 build: add BuildRequires for python-lxml and python3-lxml
python-lxml is likely always already present anyway (due to so many
packages being dependent on it), but at least on my F20 system,
python3-lxml wasn't installed, leading to a failure of "python
setup.py rpm" without an informative error message.
v1.2.4
2014-04-07 15:33:24 +03:00
2419f29435 increment version post-release
As is now done with libvirt. git head will always have the version
number of the expected *next* release.
2014-04-07 15:33:24 +03:00
0eaf951979 Fix nosetests usage with python3
Add RPM deps on python/python3-nose, make RPM build run the
test suite and invoke nosetests using correct python binary

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
v1.2.3
2014-04-02 16:33:53 +02:00
71fd954092 Fix potential crash when setting partial cpu/memory/numa/interface limits on domains
The number of parameters in new_params is not guaranteed to be the
same as the number of parameters in params.  Use the correct count
when freeing new_params to avoid crashes.
2014-03-31 14:09:40 +02:00
a180fd981b setup.py: Allow running --help or clean without pkg-config
If pkg-config isn't installed, or a too old libvirt, we can't even
do 'python setup.py --help' without throwing an exception.

Have the pkg-config checks and validation only throw an exception if
being called from the 'build' step.

https://bugzilla.redhat.com/show_bug.cgi?id=1074170
2014-03-25 13:37:02 -04:00
115760f6f0 setup.py: Make have_libvirt_lxc a function
This means we call it twice for a build operation, but I don't think
that's a big deal.
2014-03-25 13:37:02 -04:00
cac45e1b1c setup.py: Move module list building to its own function
Makes it a bit more clear what all that code is used for, rather than
intermixing it with function definitions.

Besides the comment additions, this is a no-op and just reindents the
block, into a function.
2014-03-25 13:37:02 -04:00
61529f54d2 setup.py: Remove unused import 2014-03-25 13:37:02 -04:00
e3da8f178e qemu: support arbitrary monitor events
Wrap the new virConnectDomainQemuMonitorEventRegister function
added in libvirt 1.2.3.  This patch copies heavily from
network events (commit 6ea5be0) and from event loop callbacks
in libvirt-override.c, since in the libvirt_qemu module, we
must expose top-level functions rather than class members.

* generator.py (qemu_skip_function): Don't generate event code.
(qemuBuildWrappers): Delay manual portion until after imports.
* libvirt-qemu-override.py (qemuMonitorEventRegister)
(qemuMonitorEventDeregister): New file.
* libvirt-qemu-override.c
(libvirt_qemu_virConnectDomainQemuMonitorEventFreeFunc)
(libvirt_qemu_virConnectDomainQemuMonitorEventCallback)
(libvirt_qemu_virConnectDomainQemuMonitorEventRegister)
(libvirt_qemu_virConnectDomainQemuMonitorEventDeregister)
(libvirt_qemu_lookupPythonFunc, getLibvirtQemuDictObject)
(getLibvirtQemuModuleObject): New functions.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-03-25 09:12:22 -06:00
493ca0883d event: fix domain reference bugs
Noticed this bug while adding qemu monitor events; there's probably
lots of other misuse of libvirt_virDomainPtrWrap, but for now I'm
limiting the fix to all copied-and-pasted event callbacks, since
I'm about to copy it again in the next patch.  While at it, check
for failure to extract the "conn" key from the opaque callback
struct, and hoist that check to occur before we reach the point
where it is harder to undo on failure (the network code was the
only code that had it in the right place, but then it failed to
restore thread state on failure).

The graphics callback is still not clean; but incremental
improvements are better than nothing.

* libvirt-override.c (libvirt_virConnectDomainEventCallback)
(libvirt_virConnectDomainEvetnLifecycleCallback)
(libvirt_virConnectDomainEventGenericCallback)
(libvirt_virConnectDomainEventRTCChangeCallback)
(libvirt_virConnectDomainEventWatchdogCallback)
(libvirt_virConnectDomainEventIOErrorCallback)
(libvirt_virConnectDomainEventIOErrorReasonCallback)
(libvirt_virConnectDomainEventGraphicsCallback)
(libvirt_virConnectDomainEventBlockJobCallback)
(libvirt_virConnectDomainEventDiskChangeCallback)
(libvirt_virConnectDomainEventTrayChangeCallback)
(libvirt_virConnectDomainEventPMWakeupCallback)
(libvirt_virConnectDomainEventPMSuspendCallback)
(libvirt_virConnectDomainEventBalloonChangeCallback)
(libvirt_virConnectDomainEventPMSuspendDiskCallback)
(libvirt_virConnectDomainEventDeviceRemovedCallback): Don't pass
NULL to PyObject_CallMethod.
(libvirt_virConnectNetworkEventLifecycleCallback): Likewise, and
don't corrupt thread state.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-03-25 09:12:22 -06:00
4b85a34448 generator: Add virConnectDomainQemuMonitorEventCallback to skipped_types
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-25 11:49:42 +01:00
df17d37276 maint: balance {} usage
Emacs gets lost when finding function boundaries when #ifdef
sections do not have balanced {}.

* libvirt-override.c (libvirt_PyString_Check): New define.
(virPyDictToTypedParams): Avoid unbalanced {} across ifdef.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-03-24 12:48:46 -06:00
f4c557b4ec maint: Add ctags configuration file and ignore the output
Add the config file to ease creation of tags to help navigation in
editors.
2014-03-24 19:15:02 +01:00
ac532c69ea maint: set up preferred emacs settings
Copy the relevant settings from libvirt.git, so that emacs users
maintain the style previously used before the two repos split.

* .dir-locals.el: New file.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-03-24 11:04:15 -06:00
d4dd0d519c maint: ignore .pyc files
* .gitignore: Add exemption.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-03-21 12:51:33 -06:00
097a479e91 override: Return NULL on python failure in getCPUModelNames
Eric pointed this out on the last patch, but I pushed it before noticing
his message.
2014-03-20 13:57:24 -04:00
33e39093ca override: GetCPUModelNames should return None on failure
Right now, on failure, libvirt.py doesn't raise an exception and just
returns -1 to the user.
2014-03-20 13:53:25 -04:00
71fda98981 Add test for setting scheduler parameters
Add a test setting scheduler parameters to validate the
previous bugfix to strncpy of field names.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 15:16:15 +00:00
eaded7bdad Add support for running unit tests with nose
Make the 'python setup.py test' able to run unit tests
found under tests/ through the 'nosetests' command

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-19 15:16:15 +00:00
69c4600d61 setPyVirTypedParameter: free whole return variable on error
The @ret value is built in a loop. However, if in one iteration
there's an error, we should free all the fields built so far. For
instance, if there's an error and the previous item was
type of VIR_TYPED_PARAM_STRING we definitely must free it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-03-18 14:43:10 +01:00
412c93a7b9 setPyVirTypedParameter: Copy full field name
In the setPyVirTypedParameter we try to produce virTypedParameter
array from a python dictionary. However, when copying field name into
item in returned array, we use strncpy() as the field name is fixed
length array. To determine its size we use sizeof() but mistakenly
dereference it resulting in sizeof(char) which equals to 1 byte.
Moreover, there's no need for using sizeof() when we have a global
macro to tell us the length of the field name:
VIR_TYPED_PARAM_FIELD_LENGTH.

And since array is allocated using VIR_ALLOC() we are sure the memory
is initially filled with zeros. Hence, there's no need to terminate
string we've just copied into field name with '\0' character. It's
there for sure too as we copy up to field length - 1.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2014-03-18 14:43:00 +01:00
f738e4162e Post release version bump to 1.2.3
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-03 12:04:07 +00:00
4382fc518c Release of libvirt-python 1.2.2 v1.2.2 2014-03-02 22:42:36 +08:00
014d9bbaf3 generator: Skip exporting only sentinels
When enum type has '_LAST' in its name, but is not the last type in
that enum, it's skipped even though it shouldn't be.  Currently, this
is the case for only VIR_NETWORK_UPDATE_COMMAND_ADD_LAST inside an
enum virNetworkUpdateCommand.

Also, since _LAST types can have other enums instead of values, that
needs to be filtered out using a try-except when converting the value.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
v1.2.2-rc2
2014-02-20 17:12:45 +01:00
bde9d463f3 Fix stream related spelling mistakes
Consistent spelling of all-uppercase I/O.

Signed-off-by: Philipp Hahn <hahn@univention.de>
2014-02-13 11:17:29 +01:00
44be62beee examples: demonstrate network events
Commit 6ea5be0 added network event callback support, so we might
as well demonstrate that it works by updating our example.

* examples/event-test.py: Add network event, fix typos.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-02-11 17:58:48 -07:00
6df78db098 maint: ignore editor files
* .gitignore: Exclude emacs cruft.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-02-04 16:35:14 -07:00
92c5aa6e27 Merge tag 'v1.2.1'
Release of libvirt-python-1.2.1
2014-02-03 14:28:09 -07:00
ea9339c878 Fix calling of virStreamSend method
Change d40861 removed the 'len' argument from the virStreamSend
C level wrapper, but forgot to remove it from the python level
wrapper.

Reported-by: Robie Basak <robie.basak@canonical.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-01-23 14:29:16 +00:00
c8e1ae3ecd Release of libvirt-python-1.2.1 v1.2.1 2014-01-16 17:33:29 +08:00
de8361627c virStream.sendAll() fix raising an undeclared var
The exception is raised from the variable 'e', which was undeclared in
this context. Used code that is compatible with old and new Python
versions.
v1.2.1-rc2
2014-01-10 21:16:34 -06:00
80c53727f3 Add space after comma for consistency with code style v1.2.1-rc1 2014-01-02 09:52:13 -06:00
c6ff569fb6 define __GNUC_PREREQ macro before using it
We brought over use of the __GNUC_PREREQ macro from libvirt but didn't
bring over the definition of it. This brings over the macro from libvirt
sources.
2013-12-30 12:36:31 -06:00
a06d78b4a1 Rewrite libvirt_charPtrUnwrap to work with Python 3.0->3.2
The PyUnicode_AsUTF8 method doesn't exist prior to Python 3.3.
It is also somewhat inefficient, so rewrite it to use an
intermediate PyBytes object.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-12 18:15:05 +00:00
c95c635d9b Add python3 to the automated build and RPM
This updates autobuild.sh to test the python3 build process.
The RPM specfile is changed to build a libvirt-python3 RPM
on Fedora > 18

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-12 11:26:11 +00:00
ab2b22aa7d Skip network event callbacks in sanity test
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:39:13 +00:00
faaf2a4835 Fix return type in override method for virStreamRecv
The virStreamRecv override returns a PyObject not an int

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:27:27 +00:00
d499f4a7c1 sanitytest: remove use of string.lower()
Call lower() directly on the string object instance, not
the class

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:14:46 +00:00
919bb0cc3b sanitytest: Fix broken comparison between int and string
Python2 was forgiving of a comparison between an int and string
but Python3 gets very upset.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:14:46 +00:00
d40861012c override: Switch virStreamSend wrapper to use libvirt_charPtrSizeUnwrap
Instead of using a 'z#i' format string to receive byte array,
use 'O' and then libvirt_charPtrSizeUnwrap. This lets us hide
the Python 3 vs 2 differences in typewrappers.c

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:14:46 +00:00
e6551e60ce override: Conditionalize use of PyString_Check and PyInt_Check
The PyString and PyInt classes are gone in Python 3, so we must
conditionalize their use to be Python 2 only.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:14:46 +00:00
a65df7c7a5 typewrappers: PyInt/PyLong merge for Python3
In Python3 the PyInt / PyLong types have merged into a single
PyLong type. Conditionalize the use of PyInt to Python 2 only

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:14:46 +00:00
b4d8863469 typewrappers: Replace use of PyString class
Replace use of PyString with either PyBytes or PyUnicode.
The former is used for buffers with explicit sizes, which
are used by APIs processing raw bytes.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:14:46 +00:00
d021f89dfc override: Replace PyInt_AsLong with helper
Replace use of the PyInt_AsLong libvirt_intUnwrap helper.
This isolates the need for Python3 specific code in one
place

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00
a933b7f5d1 override: Replace Py{Int,Long}_FromLong with helpers
Replace use of the PyInt_FromLong and PyLong_FromLongLong
with libvirt_{int,uint,longlong,ulonglong}Wrap helpers.
This isolates the need for Python3 specific code in one
place.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00
aac76e7630 override: Replace PyString_AsString with libvirt_charPtrUnwrap
Replace calls to PyString_AsString with the helper method
libvirt_charPtrUnwrap. This isolates the code that will
change in Python3.

In making this change, all callers now have responsibility
for free'ing the string.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00
e5161dec9e override: Replace PyString_FromString with libvirt_constcharPtrWrap
Make use of libvirt_constcharPtrWrap in all override code,
to match generated code. This will isolate Python3 specific
changes in one place.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00
c6dcaef7d9 sanitytest: Fix libvirtError class handling for Python 2.4
The Exception class hiearchy in Python 2.4 reports different
data types than in later Python versions. As a result the
type(libvirt.libvirtError) does not return 'type'. We just
special case handling of this class.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-12-11 16:12:54 +00:00