IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
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>
With libvirt-8.2.0 there's a new API:
virDomainQemuMonitorCommandWithFiles(). Since the API has both
input and output arguments we need to provide an alternative
implementation. Moreover, since FD passing works only on
UNIX-like systems we can query the returned FDs for their flags
and construct mode for python File object.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
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>
python2 will be end of life by the time of the next
libvirt release. All our supported build targets, including
CentOS7, have a python3 build available.
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
At the end of the format string we put :virFunctionName where ':'
says "this is the end of argument list", and virFunctionName is
the prefix for error messages then. However, in some cases we
have had wrong names there. Some of them are actually quite
funny: xmlRegisterErrorHandler.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
There is a rule, python API fails, it also in those cases sets an
exception. We should follow those rules and in those cases return NULL.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
On compiling libvirt-python, we get such a warning:
libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’:
libvirt-qemu-override.c:304: warning: suggest explicit braces to avoid ambiguous ‘else’
Py_DECREF is a macro using if/else on older Python releases.
The solution is to add braces.
Python 2.7 and newer has the macro wrapped in a do { } while(0) block.
Signed-off-by: Mo Yuxiang <Moyuxiang@huawei.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
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>
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>
The way native modules are registered has completely
changed, so the code must be #ifdef'd for Python2 & 3
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Import the libvirt memory allocation functions, stripping the OOM
testing and error reporting pieces.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
We're no longer using automake, so <config.h> files are not
required. Also remove of all libvirt internal util header
files. Reference generated header files in build/ subdir.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
With this patch, include public headers in "" form is only allowed
for "internal.h". And only the external tools (examples|tools|python
|include/libvirt) can include the public headers in <> form.
Return statements with parameter enclosed in parentheses were modified
and parentheses were removed. The whole change was scripted, here is how:
List of files was obtained using this command:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \
grep -e '\.[ch]$' -e '\.py$'
Found files were modified with this command:
sed -i -e \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
Then checked for nonsense.
The whole command looks like this:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' | \
grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'