[GSoC] Take migration in Salt virt module to the next level

2020-09-01 Thread Radostin Stoyanov
Hello again libvirt community! This summer, I once again worked on a GSoC project with libvirt. This time, the goal of my project was to improve the libvirt integration with SaltStack and, in particular, the support for VM migration. SaltStack is an incredibly valuable tool that helps with

[GSoC] Take migration in Salt virt module to the next level

2020-08-29 Thread Radostin Stoyanov
Hello again libvirt community! This summer, I once again worked on a GSoC project with libvirt. This time, the goal of my project was to improve the libvirt integration with SaltStack and, in particular, the support for VM migration. SaltStack is an incredibly valuable tool that helps with

[GSoC] Introduction

2020-05-07 Thread Radostin Stoyanov
Hello everyone, As a quick introduction, I’m Radostin Stoyanov, a Google Summer of Code student from University of Cambridge. In the next few months I’ll be working with my mentors Cédric Bosdonnat, Pavel Hrdina and Tyler Johnson (Akmod) on the project "Take migration in Salt virt m

[PATCH python] tox: Test with Python 3.6, 3.7 and 3.8

2020-03-29 Thread Radostin Stoyanov
Support for Python 2.X has been dropped with commit b22e4f2. Signed-off-by: Radostin Stoyanov --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index e8c33f1..de683b9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26,py27

Re: [libvirt] [PATCH] remote: remove unused constant for libvirtd config file

2019-07-03 Thread Radostin Stoyanov
$ grep -R LIBVIRTD_CONFIGURATION_FILE . ./docs/news-2013.html.in:  Fix LIBVIRTD_CONFIGURATION_FILE constant (Christophe Fergeau), ./src/remote/remote_daemon.c: LIBVIRTD_CONFIGURATION_FILE, and make fails with:   CC   xenconfig/libvirt_xenconfig_libxl_la-xen_sxpr.lo

[libvirt] [PATCH] config-post: Remove duplicated 'undef WITH_CAPNG'

2019-01-21 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov --- config-post.h | 1 - 1 file changed, 1 deletion(-) diff --git a/config-post.h b/config-post.h index dd4ef8fc0b..54731feff7 100644 --- a/config-post.h +++ b/config-post.h @@ -69,7 +69,6 @@ # undef WITH_VIRTUALPORT # undef WITH_SECDRIVER_SELINUX # undef

Re: [libvirt] may be bug in some scripts that push libvirt docs to site

2018-12-23 Thread Radostin Stoyanov
Yes, I can confirm that. The following google query shows more of the .html.in pages:     inurl:html.in site:libvirt.org https://www.google.com/search?=inurl%3Ahtml.in+site%3Alibvirt.org On 22/12/2018 22:13, Vasiliy Tolstov wrote: > Hi. I found in google that for some docs it have two pages, one

[libvirt] [PATCH] lxc: Set max uid/gid mappings for user namespace

2018-12-15 Thread Radostin Stoyanov
/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6397fac4915ab3002dc15aae751455da1a852f25 Signed-off-by: Radostin Stoyanov --- src/lxc/lxc_controller.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 99360397a7..2bec8846aa

[libvirt] [sandbox PATCH 1/2] builder: Use prefix '=> /' to identify lib path

2018-11-20 Thread Radostin Stoyanov
ibexec/libvirt-sandbox-init-common | grep ld /lib64/ld-linux-x86-64.so.2 (0x7f18135eb000) Signed-off-by: Radostin Stoyanov --- libvirt-sandbox/libvirt-sandbox-builder.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/libvirt-sandbox/libvirt-sandbox-builde

[libvirt] [sandbox PATCH 0/2] Resolve builder issues

2018-11-20 Thread Radostin Stoyanov
Radostin Stoyanov (2): builder: Use prefix '=> /' to identify lib path Use "/boot/vmlinuz-linux" as default kernel path bin/virt-sandbox.c| 5 +++-- libvirt-sandbox/libvirt-sandbox-builder-machine.c | 4 libvirt-sandbox/libvirt-sand

[libvirt] [sandbox PATCH 2/2] Use "/boot/vmlinuz-linux" as default kernel path

2018-11-20 Thread Radostin Stoyanov
On some linux distributions "/boot/vmlinuz-linux" is set as default kernel path. If this file does not exist we fallback to the value "/boot/vmlinuz-$KERNEL-VERSION" Signed-off-by: Radostin Stoyanov --- bin/virt-sandbox.c| 5 +++-- libvirt-san

Re: [libvirt] [RFC v2 0/4] LXC with block device and enabled userns

2018-06-13 Thread Radostin Stoyanov
On 13/06/18 11:46, Daniel P. Berrangé wrote: > On Sun, Jun 10, 2018 at 12:14:22PM +0100, Radostin Stoyanov wrote: >> Hi all, >> >> This patch series aims to resolve >> https://bugzilla.redhat.com/show_bug.cgi?id=1328946 >> >> For background information about

[libvirt] [RFC v2 4/4] lxc: Remove unused lxcContainerPrepareRoot

2018-06-10 Thread Radostin Stoyanov
kes the following condition tautology: if (root->type == VIR_DOMAIN_FS_TYPE_MOUNT) return 0; Signed-off-by: Radostin Stoyanov --- src/lxc/lxc_container.c | 53 - 1 file changed, 53 deletions(-) diff --git a/src/lxc/lxc_container.c b/s

[libvirt] [RFC v2 3/4] lxc: Mount NBD devices before clone

2018-06-10 Thread Radostin Stoyanov
When user-namespace is enabled we are not allowed to mount block/NBD devices. Instead, mount /dev/nbdX to /run/libvirt/lxc/.root and set: fs->src->path = /run/libvirt/lxc/.root fs->type = VIR_DOMAIN_FS_TYPE_MOUNT --- src/lxc/lxc_controller.c | 62

[libvirt] [RFC v2 2/4] lxc: Move up virLXCControllerAppendNBDPids

2018-06-10 Thread Radostin Stoyanov
There is no functional change in this patch. It only moves virLXCControllerAppendNBDPids above virLXCControllerSetupNBDDeviceFS. --- src/lxc/lxc_controller.c | 96 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/src/lxc/lxc_controller.c

[libvirt] [RFC v2 1/4] lxc: Make lxcContainerMountFSBlock non static

2018-06-10 Thread Radostin Stoyanov
--- src/lxc/lxc_container.c | 5 + src/lxc/lxc_container.h | 4 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 665b93a0ac..3f6be9f44d 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -113,9

[libvirt] [RFC v2 0/4] LXC with block device and enabled userns

2018-06-10 Thread Radostin Stoyanov
do nsenter \ --mount=/proc/$CT_PID/task/$CT_PID/ns/mnt \ /bin/bash -c "umount /var/run/libvirt/lxc/guest.root/" I noticed that we already have the functions lxcContainerUnmountSubtree and virProcessRunInMountNamespace. Any suggestions on how to properly implement this

Re: [libvirt] [PATCH] virFork: Remove redundant forkRet variable

2018-06-05 Thread Radostin Stoyanov
On 05/06/18 07:50, Ján Tomko wrote: > On Tue, Jun 05, 2018 at 07:32:57AM +0100, Radostin Stoyanov wrote: >> The variable forkRest is not used after commit 25f8781 >> > > forkRet > >> https://github.com/libvirt/libvirt/commit/25f8781#diff-d2023c1

[libvirt] [PATCHv2] virFileAccessibleAs: Remove redundant forkRet

2018-06-05 Thread Radostin Stoyanov
The variable forkRet is not used after commit 25f8781 Signed-off-by: Radostin Stoyanov --- src/util/virfile.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 523241f64f..a2c4cebb56 100644 --- a/src/util/virfile.c +++ b/src/util

[libvirt] [PATCH] virFileAccessibleAs: Remove redundant forkRet

2018-06-05 Thread Radostin Stoyanov
The variable forkRet is not used after commit 25f8781 https://github.com/libvirt/libvirt/commit/25f8781#diff-d2023c1ac4f688aa2021e21cfb60d4f0L1861 Signed-off-by: Radostin Stoyanov --- src/util/virfile.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/util/virfile.c b/src

[libvirt] [PATCH] virFileAccessibleAs: Remove redundant forkRet

2018-06-05 Thread Radostin Stoyanov
The variable forkRest is not used after commit 25f8781 https://github.com/libvirt/libvirt/commit/25f8781#diff-d2023c1ac4f688aa2021e21cfb60d4f0L1861 Signed-off-by: Radostin Stoyanov --- src/util/virfile.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/util/virfile.c b/src

Re: [libvirt] [PATCH] virFork: Remove redundant forkRet variable

2018-06-05 Thread Radostin Stoyanov
I will resend this patch with more appropriate title. On 05/06/18 07:32, Radostin Stoyanov wrote: > The variable forkRest is not used after commit 25f8781 > > https://github.com/libvirt/libvirt/commit/25f8781#diff-d2023c1ac4f688aa2021e21cfb60d4f0L1861 > > Signed-off-by: Ra

[libvirt] [PATCH] virFork: Remove redundant forkRet variable

2018-06-05 Thread Radostin Stoyanov
The variable forkRest is not used after commit 25f8781 https://github.com/libvirt/libvirt/commit/25f8781#diff-d2023c1ac4f688aa2021e21cfb60d4f0L1861 Signed-off-by: Radostin Stoyanov --- src/util/virfile.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/util/virfile.c b/src

[libvirt] [PATCH sandbox-image 9/9] docker: Add missing import base64

2018-04-18 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/sources/docker.py | 1 + 1 file changed, 1 insertion(+) diff --git a/libvirt_sandbox_image/sources/docker.py b/libvirt_sandbox_image/sources/docker.py index 3ca1b10..8a231ee 100755 --- a/libvirt_sandbox

[libvirt] [PATCH sandbox-image 3/9] pylint: Use consistent indentation of 4 spaces

2018-04-18 Thread Radostin Stoyanov
Pylint warning W0311 - Bad indentation http://pylint-messages.wikidot.com/messages:w0311 Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/sources/docker.py | 4 ++-- scripts/virt-sandbox-image | 2 +- setup.py

[libvirt] [PATCH sandbox-image 7/9] cli: Remove unused constants

2018-04-18 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/cli.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/libvirt_sandbox_image/cli.py b/libvirt_sandbox_image/cli.py index 08c88a4..e96d422 100644 --- a/libvirt_sandbox_image/cli.py +++ b/libvirt_sandbox

[libvirt] [PATCH sandbox-image 2/9] pylint: Move standard library imports on top

2018-04-18 Thread Radostin Stoyanov
-by: Radostin Stoyanov <rstoyan...@gmail.com> --- scripts/virt-sandbox-image | 3 ++- setup.py | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/virt-sandbox-image b/scripts/virt-sandbox-image index 9be4f8c..9d0ff82 100755 --- a/scripts/virt-s

[libvirt] [PATCH sandbox-image 0/9] Tweaks

2018-04-18 Thread Radostin Stoyanov
This patch series introduces a few small changes towards making the code of virt-sandbox-image compatible with PEP8. Radostin Stoyanov (9): pylint: Remove unused import statements pylint: Move standard library imports on top pylint: Use consistent indentation of 4 spaces py3: Use

[libvirt] [PATCH sandbox-image 1/9] pylint: Remove unused import statements

2018-04-18 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/cli.py| 3 --- libvirt_sandbox_image/sources/docker.py | 1 - setup.py| 3 --- 3 files changed, 7 deletions(-) diff --git a/libvirt_sandbox_image/cl

[libvirt] [PATCH sandbox-image 5/9] pylint: Fix white-space around keywords

2018-04-18 Thread Radostin Stoyanov
This changes aim to resolve Pylint C0326. http://pylint-messages.wikidot.com/messages:c0326 Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/cli.py | 26 +- libvirt_sandbox_image/sources/base.py

[libvirt] [PATCH sandbox-image 6/9] setup: Add shebang

2018-04-18 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- setup.py | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 setup.py diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index 0b16ae7..aec7f03 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +#

[libvirt] [PATCH sandbox-image 8/9] cli: Remove redundant global statements

2018-04-18 Thread Radostin Stoyanov
-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/cli.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/libvirt_sandbox_image/cli.py b/libvirt_sandbox_image/cli.py index e96d422..95c5147 100644 --- a/libvirt_sandbox_image/cli.py +++ b/libvirt_sandbox_image/cli.py @@ -

[libvirt] [PATCH sandbox-image 4/9] py3: Use 'builtins' instead of '__builtin__'

2018-04-18 Thread Radostin Stoyanov
In Python3, the __builtin__ module is renamed to builtins. https://docs.python.org/3/library/builtins.html#module-builtins Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- libvirt_sandbox_image/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

Re: [libvirt] [PATCH 2/2] lxc: Clean up /.oldroot

2018-04-16 Thread Radostin Stoyanov
On 16/04/18 10:33, Daniel P. Berrangé wrote: > On Sun, Apr 15, 2018 at 04:30:11PM +0100, Radostin Stoyanov wrote: >> Remove the /.oldroot directory after it has been unmounted (at the end >> of lxcContainerSetupPivotRoot). Ignore errors silently. >> >> Signed-off-by:

[libvirt] [RFC 3/3] lxc: Mount NBD devices before clone

2018-04-15 Thread Radostin Stoyanov
When user-namespace is enabled we are not allowed to mount block/NBD devices. Instead, mount /dev/nbdX to /run/libvirt/lxc/.root and set: fs->src->path = /run/libvirt/lxc/.root fs->type = VIR_DOMAIN_FS_TYPE_MOUNT --- src/lxc/lxc_container.c | 53

[libvirt] [RFC 2/3] lxc: Move up virLXCControllerAppendNBDPids

2018-04-15 Thread Radostin Stoyanov
There is no functional change in this patch. It only moves virLXCControllerAppendNBDPids above virLXCControllerSetupNBDDeviceFS. --- src/lxc/lxc_controller.c | 96 1 file changed, 49 insertions(+), 47 deletions(-) diff --git

[libvirt] [RFC 0/3] LXC with block device and enabled userns

2018-04-15 Thread Radostin Stoyanov
nnect for the specified device. References -- [1] https://libvirt.org/formatdomain.html#elementsFilesystems [2] https://bugzilla.redhat.com/show_bug.cgi?id=1328946 [3] https://pastebin.com/raw/jMBk5mtG [4] https://pastebin.com/raw/wTKbuRP9 Radostin Stoyanov (3): lxc: Make lxcContaine

[libvirt] [RFC 1/3] lxc: Make lxcContainerMountFSBlock non static

2018-04-15 Thread Radostin Stoyanov
--- src/lxc/lxc_container.c | 5 + src/lxc/lxc_container.h | 4 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 532fd0be0..3b8cb966e 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -113,9 +113,6

[libvirt] [PATCH 0/2] Trivial fixes

2018-04-15 Thread Radostin Stoyanov
Radostin Stoyanov (2): lxc: s/subtreee/subtree/ lxc: Clean up /.oldroot src/lxc/lxc_container.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 1/2] lxc: s/subtreee/subtree/

2018-04-15 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/lxc/lxc_container.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 532fd0be0..665b93a0a 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_conta

[libvirt] [PATCH 2/2] lxc: Clean up /.oldroot

2018-04-15 Thread Radostin Stoyanov
Remove the /.oldroot directory after it has been unmounted (at the end of lxcContainerSetupPivotRoot). Ignore errors silently. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/lxc/lxc_container.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lxc/lxc_container.c

Re: [libvirt] [PATCH] Remove redundant virFileIsExecutable check

2018-04-15 Thread Radostin Stoyanov
On 13/04/18 08:35, Michal Privoznik wrote: > On 04/13/2018 08:01 AM, Radostin Stoyanov wrote: >> Remove unnecessary virFileIsExecutable check after virFindFileInPath. >> Since the commit 9ae992f virFindFileInPath will reject non-executables. >> >> 9ae992f24353d

[libvirt] [PATCHv2] Remove redundant virFileIsExecutable check

2018-04-13 Thread Radostin Stoyanov
Remove unnecessary virFileIsExecutable check after virFindFileInPath. Since commit 9ae992f, virFindFileInPath will reject non-executables. 9ae992f24353d6506f570fc9dd58355b165e4472 virFindFileInPath: only find executable non-directory Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.

[libvirt] [PATCH] Remove redundant virFileIsExecutable check

2018-04-13 Thread Radostin Stoyanov
Remove unnecessary virFileIsExecutable check after virFindFileInPath. Since the commit 9ae992f virFindFileInPath will reject non-executables. 9ae992f24353d6506f570fc9dd58355b165e4472 virFindFileInPath: only find executable non-directory Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.

Re: [libvirt] [RFC PATCH 0/4] LXC - Implement save/restore domain state

2018-04-11 Thread Radostin Stoyanov
On 11/04/18 12:34, Daniel P. Berrangé wrote: > On Wed, Apr 11, 2018 at 12:29:11PM +0100, Radostin Stoyanov wrote: >> This patch set contains rebased version of Katerina's work from GSoC 2016 >> [1]. >> It allows integrates CRIU [2] with the libvirt-lxc to enable save/resore o

[libvirt] [RFC PATCH 3/4] lxc: Add restore mode for libvirt-lxc

2018-04-11 Thread Radostin Stoyanov
Extend `lxcContainerStart` with support for restore from fd of directory that contains saved state of lxc container. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/lxc/lxc_container.c | 162 +-- src/lxc/lxc_container.h | 3 +

[libvirt] [RFC PATCH 1/4] configure: Include support for CRIU

2018-04-11 Thread Radostin Stoyanov
Checkpoint/restore in User-space [1] enables the current running state of lxc containers to be stored as a set of image files. Then, one could restore the container to its previous state (before checkpointing) on the same or another system. [1] https://criu.org/ Signed-off-by: Radostin Stoyanov

[libvirt] [RFC PATCH 2/4] lxc: Add save/restore helper functions

2018-04-11 Thread Radostin Stoyanov
Add helper functions for checkpoint/restore of linux containers using CRIU. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- po/POTFILES.in | 1 + src/lxc/Makefile.inc.am | 4 + src/lxc/lxc_criu.c | 253 s

[libvirt] [RFC PATCH 4/4] lxc: Add save/restore support

2018-04-11 Thread Radostin Stoyanov
-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/lxc/lxc_driver.c | 234 +++ 1 file changed, 234 insertions(+) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index f52085ebf..871e853a0 100644 --- a/src/lxc/lxc_driver.c +++ b/s

[libvirt] [RFC PATCH 0/4] LXC - Implement save/restore domain state

2018-04-11 Thread Radostin Stoyanov
This patch set contains rebased version of Katerina's work from GSoC 2016 [1]. It allows integrates CRIU [2] with the libvirt-lxc to enable save/resore of containers. [1] https://wiki.libvirt.org/page/Google_Summer_of_Code_2016/lxc_migration [2] https://criu.org Radostin Stoyanov (4

[libvirt] [PATCH] lxc_container: Set source file description

2018-04-02 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/lxc/lxc_container.c | 2 +- src/lxc/lxc_container.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 14928e8ec..532fd0be0 100644 --- a/s

[libvirt] [PATCHv2 10/25] apibuild: Simplify conditional statements

2018-03-20 Thread Radostin Stoyanov
|[]=><".find(line[i]) == -1): Will be True for every character that is not in string: " \t(){}:;,+-*/%&!|[]=><" Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 44 +++- 1 file changed, 15 inse

[libvirt] [PATCHv2 20/25] apibuild: Simplify type checking of literals

2018-03-20 Thread Radostin Stoyanov
Reduce the number of if-statements used to assign a literals to corresponding class variables. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 31 +-- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/apibuil

[libvirt] [PATCHv2 16/25] apibuild: Drop backslash between brackets

2018-03-20 Thread Radostin Stoyanov
Backslash between brackets in Python is redundant. [1] 1: https://lintlyci.github.io/Flake8Rules/rules/E502.html Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git

[libvirt] [PATCHv2 15/25] python3: cpu-reformat: Use the print() function

2018-03-20 Thread Radostin Stoyanov
Replace the print statement, that is only available in Py2, with a print function that is available in both Py2 and Py3 and drop the explicit python version in the shebang. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- tests/cputestdata/cpu-reformat.py | 4 ++-- 1 file chan

[libvirt] [PATCHv2 18/25] apibuild: Simplify strip_lead_star()

2018-03-20 Thread Radostin Stoyanov
The method strip_lead_star() removes a single leading asterisk character from a string by ignoring leading whitespace, otherwise it returns the original string. This could be achieved with a single if-statement followed by replace. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.

[libvirt] [PATCHv2 24/25] apibuild: Remove redundant parentheses

2018-03-20 Thread Radostin Stoyanov
http://pylint-messages.wikidot.com/messages:c0325 Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 74 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py

[libvirt] [PATCHv2 04/25] python: Add whitespace around = and % operators

2018-03-20 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 18 +- docs/index.py | 6 +++--- tests/cputestdata/cpu-cpuid.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py

[libvirt] [PATCHv2 06/25] esx_vi_generator: Simplify generate_helper_header

2018-03-20 Thread Radostin Stoyanov
The function generate_helper_header() only returns a formatted string. This could be achieved without performing string concatenation. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/esx/esx_vi_generator.py | 22 +- 1 file changed, 9 insertions(

[libvirt] [PATCHv2 05/25] esx_vi_generator: Simplify generate_helper_source

2018-03-20 Thread Radostin Stoyanov
The generate_helper_source() function returns a formatted string. This could be achieved without the use of a local variable "source" and string concatenation. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/esx/esx_vi_generator.py | 31 ---

[libvirt] [PATCHv2 03/25] apibuild: Remove whitespace before ', ' and ':'

2018-03-20 Thread Radostin Stoyanov
PEP8 recommends removing whitespace immediately before a comma, semicolon, or colon [1]. In addition remove multiple spaces after keyword (PEP8 - E271). 1: https://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.

[libvirt] [PATCHv2 11/25] python: Remove space around = in keyword args

2018-03-20 Thread Radostin Stoyanov
PEP8 recommends not having spaces around = in a keyword argument or a default parameter value. https://www.python.org/dev/peps/pep-0008/#other-recommendations Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 24

[libvirt] [PATCHv2 25/25] apibuild: Simplify getline()

2018-03-20 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 14 +- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 1f9c8f12c..5e218a9ad 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -432,21 +

[libvirt] [PATCHv2 22/25] apibuild: Simplify merging of preproc tokens

2018-03-20 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 98224c7e7..4c8fa5740 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -478,8 +478,8 @@ class

[libvirt] [PATCHv2 17/25] apibuild: Fix indentation not multiple of 4

2018-03-20 Thread Radostin Stoyanov
PEP8 recommends that the number of spaces used for indentation of Python code to be a multiple of four [1] [2]. 1: https://lintlyci.github.io/Flake8Rules/rules/E111.html 2: https://lintlyci.github.io/Flake8Rules/rules/E114.html Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> ---

[libvirt] [PATCHv2 23/25] apibuild: Simplify parsing string tokens

2018-03-20 Thread Radostin Stoyanov
Improve readability and reduce the complexity of the code that is searching for string tokens (i.e. characters surrounded by a single or double quote). Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 32 ++-- 1 file chang

[libvirt] [PATCHv2 21/25] apibuild: Use list comprehension insteand of map

2018-03-20 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index f073b36c7..98224c7e7 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -471,8 +471,7 @@ class

[libvirt] [PATCHv2 19/25] apibuild: Simplify parseTypeComment()

2018-03-20 Thread Radostin Stoyanov
Improve readability and reduce complexity the method parseTypeComment(). Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 42 -- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/docs/apibuild.py

[libvirt] [PATCHv2 14/25] apibuild: Avoid double sorting of ids

2018-03-20 Thread Radostin Stoyanov
The uniq() function returns a sorted list, there is no need to sort this list again. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py

[libvirt] [PATCHv2 13/25] apibuild: Simplify uniq function

2018-03-20 Thread Radostin Stoyanov
Use a set (unordered collections of unique elements) [1] to remove repeated elements in a list. 1: https://docs.python.org/3/tutorial/datastructures.html#sets Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 6 +- 1 file changed, 1 insertion(+), 5 del

[libvirt] [PATCHv2 09/25] cfg.mk: check ctype_macros only on *.[c|h] files

2018-03-20 Thread Radostin Stoyanov
The functions like isalnum(), isalpha(), isdigit(), etc. are also available in Python, however `make syntax-check` do not intend to prohibit them. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- cfg.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/cfg.mk b/cfg.mk

[libvirt] [PATCHv2 12/25] WmiClass: Don't share "versions" between instances

2018-03-20 Thread Radostin Stoyanov
= Test() A.mylist.append("mylist from instance A") print(B.mylist) # Will print ['mylist from instance A'] Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/hyperv/hyperv_wmi_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --

[libvirt] [PATCHv2 07/25] esx_vi_generator: Simplify get_occurrence_comment

2018-03-20 Thread Radostin Stoyanov
Reduce the number of if-statements and use a single return. Utilise a dictionary to map between occurrences and values. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/esx/esx_vi_generator.py | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff

[libvirt] [PATCHv2 08/25] esx_vi_generator: Simplify alignment function

2018-03-20 Thread Radostin Stoyanov
Generate whitespace using the standard function ljust() that is available in both Py3 [1] and Py2 [2]. 1: https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.ljust 2: https://docs.python.org/2.7/library/string.html#string.ljust Signed-off-by: Radostin Stoyanov <rsto

[libvirt] [PATCHv2 01/25] apibuild: Use isinstance for type checking

2018-03-20 Thread Radostin Stoyanov
The isinstance() function [1] returns true if an object argument is an instance of a classinfo argument or of a direct, indirect subclass thereof. 1: https://docs.python.org/3/library/functions.html#isinstance Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.

[libvirt] [PATCHv2 00/25] Python tweaks

2018-03-20 Thread Radostin Stoyanov
patches were applied. Radostin Stoyanov (25): apibuild: Use isinstance for type checking apibuild: Split imports on separate lines apibuild: Remove whitespace before ',' and ':' python: Add whitespace around = and % operators esx_vi_generator: Simplify generate_helper_source esx_vi

[libvirt] [PATCHv2 02/25] apibuild: Split imports on separate lines

2018-03-20 Thread Radostin Stoyanov
PEP8 recommends imports to be on separate lines. [1] 1: https://www.python.org/dev/peps/pep-0008/#imports Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/apibuild.py b/docs/apibuild.py

Re: [libvirt] [PATCH 09/22] apibuild: Simplify conditional statements

2018-03-19 Thread Radostin Stoyanov
On 19/03/18 10:52, Daniel P. Berrangé wrote: >> -o = ord(line[i]) >> -if (o >= 97 and o <= 122) or (o >= 65 and o <= 90) or \ >> - (o >= 48 and o <= 57): >> +if re.match(r"[a-zA-Z0-9]", line[i]): > Why not just use isalnum()

Re: [libvirt] [PATCH 07/22] esx_vi_generator: Simplify get_occurrence_comment

2018-03-19 Thread Radostin Stoyanov
On 19/03/18 11:40, Marc Hartmayer wrote: > On Sat, Mar 17, 2018 at 03:23 PM +0100, Radostin Stoyanov > <rstoyan...@gmail.com> wrote: >> Reduce the number of if-statements and use a single return. >> Utilise a dictionary to map between occurrences and values. >> >&

Re: [libvirt] [PATCH 05/22] esx_vi_generator: Simplify generate_helper_source

2018-03-19 Thread Radostin Stoyanov
On 19/03/18 10:42, Daniel P. Berrangé wrote: > On Sat, Mar 17, 2018 at 02:23:23PM +0000, Radostin Stoyanov wrote: >> The generate_helper_source() function returns a formatted string. >> This could be achieved without the use of a local variable "source" >> and str

Re: [libvirt] [PATCH 00/22] Python tweaks

2018-03-19 Thread Radostin Stoyanov
On 19/03/18 11:03, Daniel P. Berrangé wrote: > On Mon, Mar 19, 2018 at 10:36:28AM +, Daniel P. Berrangé wrote: >> On Sat, Mar 17, 2018 at 02:23:18PM +, Radostin Stoyanov wrote: >>> These patches improve the code style of python code >>> by applyin

[libvirt] [PATCH 22/22] apibuild: Simplify parsing string tokens

2018-03-17 Thread Radostin Stoyanov
Improve readability and reduce the complexity of the code that is searching for string tokens (i.e. characters surrounded by a single or double quote). Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 32 ++-- 1 file chang

[libvirt] [PATCH 00/22] Python tweaks

2018-03-17 Thread Radostin Stoyanov
These patches improve the code style of python code by applying some PEP8 recommendations and simplifying some functions. Radostin Stoyanov (22): apibuild: Use isinctance for type checking apibuild: Split imports on separate lines apibuild: Remove whitespace before ',' and ':' python: Add

[libvirt] [PATCH 15/22] apibuild: Drop backslash between brackets

2018-03-17 Thread Radostin Stoyanov
Backslash between brackets in Python is redundant. [1] 1: https://lintlyci.github.io/Flake8Rules/rules/E502.html Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git

[libvirt] [PATCH 02/22] apibuild: Split imports on separate lines

2018-03-17 Thread Radostin Stoyanov
PEP8 recommends imports to be on separate lines. [1] 1: https://www.python.org/dev/peps/pep-0008/#imports Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/apibuild.py b/docs/apibuild.py

[libvirt] [PATCH 20/22] apibuild: Use list comprehension insteand of map

2018-03-17 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index 29c89fd24..f9784f9bd 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -472,8 +472,7 @@ class

[libvirt] [PATCH 14/22] python3: cpu-reformat: Use the print() function

2018-03-17 Thread Radostin Stoyanov
Replace the print statement, that is only available in Py2, with a print function that is available in both Py2 and Py3 and drop the explicit python version in the shebang. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- tests/cputestdata/cpu-reformat.py | 4 ++-- 1 file chan

[libvirt] [PATCH 10/22] python: Remove space around = in keyword args

2018-03-17 Thread Radostin Stoyanov
PEP8 recommends not having spaces around = in a keyword argument or a default parameter value. https://www.python.org/dev/peps/pep-0008/#other-recommendations Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 24

[libvirt] [PATCH 16/22] apibuild: Fix indentation not multiple of 4

2018-03-17 Thread Radostin Stoyanov
PEP8 recommends that the number of spaces used for indentation of Python code to be a multiple of four [1] [2]. 1: https://lintlyci.github.io/Flake8Rules/rules/E111.html 2: https://lintlyci.github.io/Flake8Rules/rules/E114.html Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> ---

[libvirt] [PATCH 17/22] apibuild: Simplify strip_lead_star()

2018-03-17 Thread Radostin Stoyanov
The method strip_lead_star() removes a single leading asterisk character from a string by ignoring leading whitespace, otherwise it returns the original string. This could be achieved with a single if-statement followed by replace. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.

[libvirt] [PATCH 13/22] apibuild: Avoid double sorting of ids

2018-03-17 Thread Radostin Stoyanov
The uniq() function returns a sorted list, there is no need to sort this list again. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py

[libvirt] [PATCH 11/22] WmiClass: Don't share "versions" between instances

2018-03-17 Thread Radostin Stoyanov
= Test() A.mylist.append("mylist from instance A") print(B.mylist) # Will print ['mylist from instance A'] Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/hyperv/hyperv_wmi_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --

[libvirt] [PATCH 04/22] python: Add whitespace around = and % operators

2018-03-17 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 18 +- docs/index.py | 6 +++--- tests/cputestdata/cpu-cpuid.py | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/apibuild.py

[libvirt] [PATCH 12/22] apibuild: Simplify uniq function

2018-03-17 Thread Radostin Stoyanov
Use a set (unordered collections of unique elements) [1] to remove repeated elements in a list. 1: https://docs.python.org/3/tutorial/datastructures.html#sets Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 6 +- 1 file changed, 1 insertion(+), 5 del

[libvirt] [PATCH 08/22] esx_vi_generator: Simplify alignment function

2018-03-17 Thread Radostin Stoyanov
Generate whitespace using the standard function ljust() that is available in both Py3 [1] and Py2 [2]. 1: https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.ljust 2: https://docs.python.org/2.7/library/string.html#string.ljust Signed-off-by: Radostin Stoyanov <rsto

[libvirt] [PATCH 09/22] apibuild: Simplify conditional statements

2018-03-17 Thread Radostin Stoyanov
|[]=><".find(line[i]) == -1): Will be True for every character that is not in string: " \t(){}:;,+-*/%&!|[]=><" Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 33 ++--- 1 file changed, 10 inse

[libvirt] [PATCH 21/22] apibuild: Simplify merging of preproc tokens

2018-03-17 Thread Radostin Stoyanov
Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/apibuild.py b/docs/apibuild.py index f9784f9bd..24e0eb505 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -479,8 +479,8 @@ class

[libvirt] [PATCH 07/22] esx_vi_generator: Simplify get_occurrence_comment

2018-03-17 Thread Radostin Stoyanov
Reduce the number of if-statements and use a single return. Utilise a dictionary to map between occurrences and values. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- src/esx/esx_vi_generator.py | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff

[libvirt] [PATCH 03/22] apibuild: Remove whitespace before ', ' and ':'

2018-03-17 Thread Radostin Stoyanov
PEP8 recommends removing whitespace immediately before a comma, semicolon, or colon [1]. In addition remove multiple spaces after keyword (PEP8 - E271). 1: https://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.

[libvirt] [PATCH 19/22] apibuild: Simplify type checking of literals

2018-03-17 Thread Radostin Stoyanov
Reduce the number of if-statements used to assign a literals to corresponding class variables. Signed-off-by: Radostin Stoyanov <rstoyan...@gmail.com> --- docs/apibuild.py | 31 +-- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/docs/apibuil

  1   2   >