[Qemu-devel] [PATCH 2/2] qemu-iotests: set exec permission for tests lacking it

2018-03-09 Thread Amador Pahim
Some tests are not executables. This patch sets the executable permission for those tests lacking that. Signed-off-by: Amador Pahim --- tests/qemu-iotests/096 | 0 tests/qemu-iotests/124 | 0 tests/qemu-iotests/129 | 0 tests/qemu-iotests/132 | 0 tests/qemu-iotests/136 | 0 tests/qemu-iotests

[Qemu-devel] [PATCH 0/2] qemu-iotests fixes

2018-03-09 Thread Amador Pahim
- Skipping test 205 for unsupported formats. - Setting execution permission on test files. Amador Pahim (2): qemu-iotests: skip test 205 for unsupported formats qemu-iotests: set exec permission for tests lacking it tests/qemu-iotests/096 | 0 tests/qemu-iotests/124 | 0 tests/qemu-iotests

[Qemu-devel] [PATCH 1/2] qemu-iotests: skip test 205 for unsupported formats

2018-03-09 Thread Amador Pahim
Using bochs or cloop, qemu-img will fail with: Format driver 'bochs' does not support image creation Signed-off-by: Amador Pahim --- tests/qemu-iotests/205 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qemu-iotests/205 b/tests/qemu-iotests/205 index e7b2eae51d..

[Qemu-devel] [PATCH v12 5/6] qemu.py: cleanup redundant calls in launch()

2018-01-22 Thread Amador Pahim
Now that shutdown() is guaranteed to always execute self._load_io_log() and self._post_shutdown(), their calls in 'except' became redundant and we can safely replace it by a call to shutdown(). Reviewed-by: Fam Zheng Reviewed-by: Eduardo Habkost Signed-off-by: Amador Pahim --- scrip

[Qemu-devel] [PATCH v12 6/6] qemu.py: don't launch again before shutdown()

2018-01-22 Thread Amador Pahim
shutdown() is not called after the previous launch(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 8 1 file changed, 8 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 42a3fa5251..6c80edfd04 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -91,6 +91,7 @@ class

[Qemu-devel] [PATCH v12 3/6] qemu.py: always cleanup on shutdown()

2018-01-22 Thread Amador Pahim
Signed-off-by: Amador Pahim --- scripts/qemu.py | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 0c690499be..d6661870ab 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -164,8 +164,9 @@ class QEMUMachine(object): return

[Qemu-devel] [PATCH v12 1/6] qemu.py: better control of created files

2018-01-22 Thread Amador Pahim
if it already exists, we are currently removing it, even if it's not created by us. This patch moves to _pre_launch() the responsibility to create a temporary directory to host the files so we can remove the whole directory on _post_shutdown(). Signed-off-by: Amador Pahim --- scripts/qe

[Qemu-devel] [PATCH v12 4/6] qemu.py: use poll() instead of 'returncode'

2018-01-22 Thread Amador Pahim
ll() to check whether the process is running and to get the updated process exit code, when the process is finished. Reviewed-by: Fam Zheng eviewed-by: Eduardo Habkost Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/

[Qemu-devel] [PATCH v12 2/6] qemu.py: refactor launch()

2018-01-22 Thread Amador Pahim
This is just an refactor to separate the exception handler from the actual launch procedure, improving the readability and making future maintenances in this piece of code easier. Reviewed-by: Fam Zheng Reviewed-by: Eduardo Habkost Signed-off-by: Amador Pahim --- scripts/qemu.py | 29

[Qemu-devel] [PATCH v12 0/6] scripts/qemu.py fixes and cleanups

2018-01-22 Thread Amador Pahim
irst commits since they are co-dependant. - Cleanup launch() and shutdown(). - Reorder the commits, putting the rename of self._args first. - Rebased. Changes v2->v3: - Fix typo in patch 3 ("qemu.py: make 'args' public") commit message. Changes v1->v2: - Style fixes to m

Re: [Qemu-devel] Functional tests (AKA Avocado-based tests)

2018-01-18 Thread Amador Pahim
On Thu, Jan 18, 2018 at 1:47 AM, Cleber Rosa wrote: > > > On 01/17/2018 06:41 PM, Alistair Francis wrote: >> On Wed, Jan 17, 2018 at 12:05 AM, Cleber Rosa wrote: >>> TL;DR >>> = >>> >>> This is about how QEMU developers can get started with functional >>> tests that are built on top of the Av

[Qemu-devel] [PATCH v11 7/8] qemu.py: launch vm only if it's not running

2017-11-14 Thread Amador Pahim
If we allow launching VM again we will loose track of the first launched VM. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 305d7bd098..0b0b61be39 100644 --- a/scripts/qemu.py

[Qemu-devel] [PATCH v11 4/8] qemu.py: always cleanup on shutdown()

2017-11-14 Thread Amador Pahim
Currently we only cleanup on shutdown() if the VM is running. To make sure we will always cleanup, this patch makes the self._load_io_log() and the self._post_shutdown() to always be called on shutdown(), regardless the VM running state. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim

[Qemu-devel] [PATCH v11 5/8] qemu.py: use poll() instead of 'returncode'

2017-11-14 Thread Amador Pahim
ll() to check whether the process is running and to get the updated process exit code, when the process is finished. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py ind

[Qemu-devel] [PATCH v11 3/8] qemu.py: refactor launch()

2017-11-14 Thread Amador Pahim
This is just an refactor to separate the exception handler from the actual launch procedure, improving the readability and making future maintenances in this piece of code easier. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 29 ++--- 1 file

[Qemu-devel] [PATCH v11 2/8] qemu.py: better control of created files

2017-11-14 Thread Amador Pahim
if it already exists, we are currently removing it, even if it's not created by us. This patch moves to _pre_launch() the responsibility to create a temporary directory to host the files so we can remove the whole directory on _post_shutdown(). Signed-off-by: Amador Pahim --- scripts/qe

[Qemu-devel] [PATCH v11 8/8] qemu.py: don't launch again before shutdown()

2017-11-14 Thread Amador Pahim
shutdown() is not called after the previous launch(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 0b0b61be39..862920099c 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -89,6 +89,7 @@ class

[Qemu-devel] [PATCH v11 0/8] scripts/qemu.py fixes and cleanups

2017-11-14 Thread Amador Pahim
dependant. - Cleanup launch() and shutdown(). - Reorder the commits, putting the rename of self._args first. - Rebased. Changes v2->v3: - Fix typo in patch 3 ("qemu.py: make 'args' public") commit message. Changes v1->v2: - Style fixes to make checkpatch.pl happ

[Qemu-devel] [PATCH v11 6/8] qemu.py: cleanup redundant calls in launch()

2017-11-14 Thread Amador Pahim
Now that shutdown() is guaranteed to always execute self._load_io_log() and self._post_shutdown(), their calls in 'except' became redundant and we can safely replace it by a call to shutdown(). Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 6 +- 1 file

[Qemu-devel] [PATCH v11 1/8] qemu.py: remove unused import

2017-11-14 Thread Amador Pahim
Removing 'import sys' as it's not used anywhere. Signed-off-by: Amador Pahim --- scripts/qemu.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 9bfdf6d37d..65d9ad688c 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -15,7 +15,6 @

Re: [Qemu-devel] [PATCH v9 2/8] qemu.py: better control of created files

2017-11-13 Thread Amador Pahim
On Tue, Nov 14, 2017 at 1:08 AM, Murilo Opsfelder Araújo wrote: > On 11/13/2017 07:39 PM, Amador Pahim wrote: >> To launch a VM, we need to create basically two files: the monitor >> socket (if it's a UNIX socket) and the qemu log file. >> >> For the qemu log file,

Re: [Qemu-devel] [PATCH v10 2/8] qemu.py: better control of created files

2017-11-13 Thread Amador Pahim
On 13 Nov 2017 11:24 pm, "Amador Pahim" wrote: To launch a VM, we need to create basically two files: the monitor socket (if it's a UNIX socket) and the qemu log file. For the qemu log file, we currently just open the path, which will create the file if it does not exist or ove

[Qemu-devel] [PATCH v10 8/8] qemu.py: don't launch again before shutdown()

2017-11-13 Thread Amador Pahim
shutdown() is not called after the previous launch(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index ab172c3670..c1b0895e94 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -89,6 +89,7 @@ class

[Qemu-devel] [PATCH v10 5/8] qemu.py: use poll() instead of 'returncode'

2017-11-13 Thread Amador Pahim
ll() to check whether the process is running and to get the updated process exit code, when the process is finished. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py ind

[Qemu-devel] [PATCH v10 7/8] qemu.py: launch vm only if it's not running

2017-11-13 Thread Amador Pahim
If we allow launching VM again we will loose track of the first launched VM. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index df2fca9e71..ab172c3670 100644 --- a/scripts/qemu.py

[Qemu-devel] [PATCH v10 6/8] qemu.py: cleanup redundant calls in launch()

2017-11-13 Thread Amador Pahim
Now that shutdown() is guaranteed to always execute self._load_io_log() and self._post_shutdown(), their calls in 'except' became redundant and we can safely replace it by a call to shutdown(). Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 6 +- 1 file

[Qemu-devel] [PATCH v10 4/8] qemu.py: always cleanup on shutdown()

2017-11-13 Thread Amador Pahim
Currently we only cleanup on shutdown() if the VM is running. To make sure we will always cleanup, this patch makes the self._load_io_log() and the self._post_shutdown() to always be called on shutdown(), regardless the VM running state. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim

[Qemu-devel] [PATCH v10 2/8] qemu.py: better control of created files

2017-11-13 Thread Amador Pahim
if it already exists, we are currently removing it, even if it's not created by us. This patch moves to pre_launch() the responsibility to create a temporary directory to host the files so we can remove the whole directory on post_shutdown(). Signed-off-by: Amador Pahim --- scripts/qe

[Qemu-devel] [PATCH v10 0/8] scripts/qemu.py fixes and cleanups

2017-11-13 Thread Amador Pahim
se a temporary directory. - Better naming for variable controlling the need of a shutdown before next launch. Changes v9->v10: - Keep method _remove_if_exists(). Amador Pahim (8): qemu.py: remove unused import qemu.py: better control of created files qemu.py: refactor launch() qem

[Qemu-devel] [PATCH v10 3/8] qemu.py: refactor launch()

2017-11-13 Thread Amador Pahim
This is just an refactor to separate the exception handler from the actual launch procedure, improving the readability and making future maintenances in this piece of code easier. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 29 ++--- 1 file

[Qemu-devel] [PATCH v10 1/8] qemu.py: remove unused import

2017-11-13 Thread Amador Pahim
Removing 'import sys' as it's not used anywhere. Signed-off-by: Amador Pahim --- scripts/qemu.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 9bfdf6d37d..65d9ad688c 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -15,7 +15,6 @

[Qemu-devel] [PATCH v9 7/8] qemu.py: launch vm only if it's not running

2017-11-13 Thread Amador Pahim
If we allow launching VM again we will loose track of the first launched VM. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index ed9fed58ed..7303952328 100644 --- a/scripts/qemu.py

[Qemu-devel] [PATCH v9 8/8] qemu.py: don't launch again before shutdown()

2017-11-13 Thread Amador Pahim
shutdown() is not called after the previous launch(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 7303952328..c615f3075d 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -89,6 +89,7 @@ class

[Qemu-devel] [PATCH v9 4/8] qemu.py: always cleanup on shutdown()

2017-11-13 Thread Amador Pahim
Currently we only cleanup on shutdown() if the VM is running. To make sure we will always cleanup, this patch makes the self._load_io_log() and the self._post_shutdown() to always be called on shutdown(), regardless the VM running state. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim

[Qemu-devel] [PATCH v9 5/8] qemu.py: use poll() instead of 'returncode'

2017-11-13 Thread Amador Pahim
ll() to check whether the process is running and to get the updated process exit code, when the process is finished. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py ind

[Qemu-devel] [PATCH v9 0/8] scripts/qemu.py fixes and cleanups

2017-11-13 Thread Amador Pahim
se a temporary directory. - Better naming for variable controlling the need of a shutdown before next launch. Amador Pahim (8): qemu.py: remove unused import qemu.py: better control of created files qemu.py: refactor launch() qemu.py: always cleanup on shutdown() qemu.py: use pol

[Qemu-devel] [PATCH v9 3/8] qemu.py: refactor launch()

2017-11-13 Thread Amador Pahim
This is just an refactor to separate the exception handler from the actual launch procedure, improving the readability and making future maintenances in this piece of code easier. Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 29 ++--- 1 file

[Qemu-devel] [PATCH v9 1/8] qemu.py: remove unused import

2017-11-13 Thread Amador Pahim
Removing 'import sys' as it's not used anywhere. Signed-off-by: Amador Pahim --- scripts/qemu.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 9bfdf6d37d..65d9ad688c 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -15,7 +15,6 @

[Qemu-devel] [PATCH v9 6/8] qemu.py: cleanup redundant calls in launch()

2017-11-13 Thread Amador Pahim
Now that shutdown() is guaranteed to always execute self._load_io_log() and self._post_shutdown(), their calls in 'except' became redundant and we can safely replace it by a call to shutdown(). Reviewed-by: Fam Zheng Signed-off-by: Amador Pahim --- scripts/qemu.py | 6 +- 1 file

[Qemu-devel] [PATCH v9 2/8] qemu.py: better control of created files

2017-11-13 Thread Amador Pahim
if it already exists, we are currently removing it, even if it's not created by us. This patch moves to pre_launch() the responsibility to create a temporary directory to host the files so we can remove the whole directory on post_shutdown(). Signed-off-by: Amador Pahim --- scripts/qe

Re: [Qemu-devel] [PATCH v8 06/13] qemu.py: make sure we only remove files we create

2017-09-14 Thread Amador Pahim
On Thu, Sep 14, 2017 at 10:18 PM, Eduardo Habkost wrote: > On Thu, Sep 14, 2017 at 10:05:50PM +0200, Amador Pahim wrote: >> On Thu, Sep 14, 2017 at 9:46 PM, Eduardo Habkost wrote: >> > On Thu, Sep 14, 2017 at 09:38:13PM +0200, Amador Pahim wrote: >> >> On Tue, Sep

Re: [Qemu-devel] [PATCH v8 06/13] qemu.py: make sure we only remove files we create

2017-09-14 Thread Amador Pahim
On Thu, Sep 14, 2017 at 9:46 PM, Eduardo Habkost wrote: > On Thu, Sep 14, 2017 at 09:38:13PM +0200, Amador Pahim wrote: >> On Tue, Sep 5, 2017 at 5:18 AM, Fam Zheng wrote: >> > On Fri, 09/01 13:28, Amador Pahim wrote: >> >> To launch a VM, we need to create ba

Re: [Qemu-devel] [PATCH v8 06/13] qemu.py: make sure we only remove files we create

2017-09-14 Thread Amador Pahim
On Tue, Sep 5, 2017 at 5:18 AM, Fam Zheng wrote: > On Fri, 09/01 13:28, Amador Pahim wrote: >> To launch a VM, we need to create basically two files: the monitor >> socket (if it's a UNIX socket) and the qemu log file. >> >> For the qemu log file, we currentl

[Qemu-devel] [PATCH v8 13/13] qemu.py: don't launch again before shutdown()

2017-09-01 Thread Amador Pahim
shutdown() is not called after the previous launch(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 363f649a7e..05fca4d268 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -52,6 +52,7 @@ class

[Qemu-devel] [PATCH v8 12/13] qemu.py: launch vm only if it's not running

2017-09-01 Thread Amador Pahim
A new call to launch() with a running VM will fall in exception and consequently call shutdown(). This patch makes launch() to raise an exception when it's called with VM already running. Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --

[Qemu-devel] [PATCH v8 10/13] qemu.py: use poll() instead of 'returncode'

2017-09-01 Thread Amador Pahim
ll() to check whether the process is running and to get the updated process exit code, when the process is finished. Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index ede734328b..87a2212b77 100

[Qemu-devel] [PATCH v8 11/13] qemu.py: cleanup redundant calls in launch()

2017-09-01 Thread Amador Pahim
th. So, to avoid errors with _load_io_log(), this patch makes sure we will only read the _qemu_log_path if it was previously created by us. Signed-off-by: Amador Pahim --- scripts/qemu.py | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/qemu.py b/scripts/qem

[Qemu-devel] [PATCH v8 09/13] qemu.py: always cleanup on shutdown()

2017-09-01 Thread Amador Pahim
Currently we only cleanup on shutdown() if the VM is running. To make sure we will always cleanup, this patch makes the cleanup to always happen in shutdown, regardless the VM running state. Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[Qemu-devel] [PATCH v8 08/13] qemu.py: refactor launch()

2017-09-01 Thread Amador Pahim
This is just an refactor to separate the exception handler from the actual launch procedure, improving the readability and making future maintenances in this piece of code easier. Signed-off-by: Amador Pahim --- scripts/qemu.py | 29 ++--- 1 file changed, 18 insertions

[Qemu-devel] [PATCH v8 04/13] qemu.py: improve message on negative exit code

2017-09-01 Thread Amador Pahim
lock to make sure it will be logged if the VM finishes before the call to shutdown(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index a6e06291ea..670c048569 100644 -

[Qemu-devel] [PATCH v8 05/13] qemu.py: include debug information on launch error

2017-09-01 Thread Amador Pahim
the qemu log from a previous launch if the current one fails. Signed-off-by: Amador Pahim --- scripts/qemu.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 670c048569..3ebe5ee0a4 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -141,6

[Qemu-devel] [PATCH v8 07/13] qemu.py: close _qemu_log_path on cleanup

2017-09-01 Thread Amador Pahim
We are opening the _qemu_log_path during the launch() but we are forgetting to close it. This patch makes sure we will close the self._qemu_log_path during the cleanup (post_shutdown()). Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a

[Qemu-devel] [PATCH v8 01/13] qemu.py: fix is_running() return before first launch()

2017-09-01 Thread Amador Pahim
tence, this patch removes the parenthesis from the second clause as it's not really needed. Signed-off-by: Amador Pahim --- scripts/qemu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 880e3e8219..0ae5d39414 100644 --- a/scripts/qe

[Qemu-devel] [PATCH v8 06/13] qemu.py: make sure we only remove files we create

2017-09-01 Thread Amador Pahim
to remove during the cleanup (post_shutdown()). Signed-off-by: Amador Pahim --- scripts/qemu.py | 30 +++--- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 3ebe5ee0a4..c26e1412f9 100644 --- a/scripts/qemu.py +++ b/scrip

[Qemu-devel] [PATCH v8 00/13] scripts/qemu.py fixes and cleanups

2017-09-01 Thread Amador Pahim
commits "launch vm only if it's not running" and "don't launch again before shutdown()". - Minor style fixes. Amador Pahim (13): qemu.py: fix is_running() return before first launch() qemu.py: avoid writing to stdout/stderr qemu.py: use os.path.null instead of /d

[Qemu-devel] [PATCH v8 02/13] qemu.py: avoid writing to stdout/stderr

2017-09-01 Thread Amador Pahim
the Popen.communicate() is now used (in order to get the stdout), the further call to wait() became redundant and was replaced by Popen.returncode. The shutdown() message on negative exit code will now be logged to logging.warn instead of written to system stderr. Signed-off-by: Amador Pahim

[Qemu-devel] [PATCH v8 03/13] qemu.py: use os.path.null instead of /dev/null

2017-09-01 Thread Amador Pahim
For increased portability, let's use os.path.devnull. Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index aca6fa4d82..a6e06291ea 100644 --- a/scripts/qemu.py +++ b/scripts/qe

Re: [Qemu-devel] [PATCH v7 00/11] scripts/qemu.py fixes and cleanups

2017-09-01 Thread Amador Pahim
v8? Now I am. Sending asap. > > On Fri, Aug 18, 2017 at 07:05:15PM +0200, Amador Pahim wrote: >> Changes v1->v2: >> - Style fixes to make checkpatch.pl happy. >> - Rebased. >> Changes v2->v3: >> - Fix typo in patch 3 ("qemu.py: make 'args

Re: [Qemu-devel] [PATCH v7 02/11] qemu.py: avoid writing to stdout/stderr

2017-08-22 Thread Amador Pahim
On Tue, Aug 22, 2017 at 1:56 PM, Fam Zheng wrote: > On Tue, 08/22 13:11, Amador Pahim wrote: >> I don't think that the 'keep the behavior' principle should overcome >> what the messages actually are. The question is: are they warning >> messages? The way I

Re: [Qemu-devel] [PATCH v7 02/11] qemu.py: avoid writing to stdout/stderr

2017-08-22 Thread Amador Pahim
On Tue, Aug 22, 2017 at 12:24 PM, Fam Zheng wrote: > On Fri, 08/18 19:05, Amador Pahim wrote: >> This module should not write directly to stdout/stderr. Instead, it >> should either raise exceptions or just log the messages and let the >> callers handle them and decide wh

[Qemu-devel] [PATCH v7 03/11] qemu.py: use os.path.null instead of /dev/null

2017-08-18 Thread Amador Pahim
For increased portability, let's use os.path.devnull. Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index ef531bb23b..51545f7f97 100644 --- a/scripts/qemu.py +++ b/scripts/qe

[Qemu-devel] [PATCH v7 01/11] qemu.py: fix is_running() return before first launch()

2017-08-18 Thread Amador Pahim
tence, this patch removes the parenthesis from the second clause as it's not really needed. Signed-off-by: Amador Pahim --- scripts/qemu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 880e3e8219..0ae5d39414 100644 --- a/scripts/qe

[Qemu-devel] [PATCH v7 09/11] qemu.py: launch vm only if it's not running

2017-08-18 Thread Amador Pahim
A new call to launch() with a running VM will fall in exception and consequently call shutdown(). This patch makes launch() to raise an exception when it's called with VM already running. Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 +++ 1 file changed, 3 insertions(+) diff --

[Qemu-devel] [PATCH v7 04/11] qemu.py: use poll() instead of 'returncode'

2017-08-18 Thread Amador Pahim
is called. Signed-off-by: Amador Pahim --- scripts/qemu.py | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 51545f7f97..774f971f69 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -98,12 +98,12 @@ class QEMUMachine(ob

[Qemu-devel] [PATCH v7 02/11] qemu.py: avoid writing to stdout/stderr

2017-08-18 Thread Amador Pahim
the Popen.communicate() is now used (in order to get the stdout), the further call to wait() became redundant and was replaced by Popen.returncode. The shutdown() message on negative exit code will now be logged to logging.debug instead of written to system stderr. Signed-off-by: Amador Pahim

[Qemu-devel] [PATCH v7 08/11] qemu.py: make sure we only remove files we create

2017-08-18 Thread Amador Pahim
to remove during the cleanup (post_shutdown()). Signed-off-by: Amador Pahim --- scripts/qemu.py | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 29fd2469f9..9ae65e454e 100644 --- a/scripts/qemu.py +++

[Qemu-devel] [PATCH v7 00/11] scripts/qemu.py fixes and cleanups

2017-08-18 Thread Amador Pahim
hanges. - Addressed the comments from previous version, basically improving the logging messages and the control over created files. See individual commit messages for details. Amador Pahim (11): qemu.py: fix is_running() return before first launch() qemu.py: avoid writing to stdout/stderr

[Qemu-devel] [PATCH v7 06/11] qemu.py: improve message on negative exit code

2017-08-18 Thread Amador Pahim
lock to make sure it will be logged if the VM finishes before the call to shutdown(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 26 +++--- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 902d4c6c78..0bcec4b3b1 100644 -

[Qemu-devel] [PATCH v7 11/11] qemu.py: refactor launch()

2017-08-18 Thread Amador Pahim
This is just an refactor to separate the exception handler from the actual launch procedure, improving the readability and making future maintenances in this piece of code easier. Signed-off-by: Amador Pahim --- scripts/qemu.py | 33 - 1 file changed, 20

[Qemu-devel] [PATCH v7 10/11] qemu.py: don't launch again before shutdown()

2017-08-18 Thread Amador Pahim
shutdown() is not called after the previous launch(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 6 ++ 1 file changed, 6 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 46e8ff3232..2bd81afcf2 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -52,6 +52,7 @@ class

[Qemu-devel] [PATCH v7 07/11] qemu.py: include debug information on launch error

2017-08-18 Thread Amador Pahim
the qemu log from a previous launch if the current one fails. Signed-off-by: Amador Pahim --- scripts/qemu.py | 8 1 file changed, 8 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 0bcec4b3b1..29fd2469f9 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -147,6

[Qemu-devel] [PATCH v7 05/11] qemu.py: cleanup redundant calls in launch()

2017-08-18 Thread Amador Pahim
Now that shutdown() is guaranteed to always execute self._load_io_log() and self._post_shutdown(), their calls in 'except' became redundant and we can safely replace it by a call to shutdown(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 6 +- 1 file changed, 1 inser

Re: [Qemu-devel] [PATCH v6 7/7] qemu.py: include debug information on launch error

2017-08-18 Thread Amador Pahim
On Fri, Aug 18, 2017 at 4:01 PM, Markus Armbruster wrote: > Amador Pahim writes: > >> On Tue, Aug 15, 2017 at 10:57 AM, Markus Armbruster >> wrote: >>> Amador Pahim writes: >>> >>>> When launching a VM, if an exception happens and the VM is

Re: [Qemu-devel] [PATCH v6 4/7] qemu.py: improve message on negative exit code

2017-08-18 Thread Amador Pahim
On Fri, Aug 18, 2017 at 3:57 PM, Markus Armbruster wrote: > Amador Pahim writes: > >> On Tue, Aug 15, 2017 at 10:26 AM, Markus Armbruster >> wrote: >>> Amador Pahim writes: >>> >>>> The current message shows 'self._args', which conta

Re: [Qemu-devel] [PATCH v6 7/7] qemu.py: include debug information on launch error

2017-08-18 Thread Amador Pahim
On Tue, Aug 15, 2017 at 10:57 AM, Markus Armbruster wrote: > Amador Pahim writes: > >> When launching a VM, if an exception happens and the VM is not >> initiated, it is useful to see the qemu command line that was executed >> and the output of that command.

Re: [Qemu-devel] [PATCH v6 3/7] qemu.py: use python logging system

2017-08-18 Thread Amador Pahim
On Wed, Aug 16, 2017 at 8:17 AM, Markus Armbruster wrote: > Eduardo Habkost writes: > >> On Tue, Aug 15, 2017 at 10:10:12AM +0200, Markus Armbruster wrote: >>> Please spell "Python" with a capital "P" (it's a proper name). >>> >>>

Re: [Qemu-devel] [PATCH v6 4/7] qemu.py: improve message on negative exit code

2017-08-18 Thread Amador Pahim
On Tue, Aug 15, 2017 at 10:26 AM, Markus Armbruster wrote: > Amador Pahim writes: > >> The current message shows 'self._args', which contains only part of the >> options used in the qemu command line. >> >> This patch makes the qemu full args list an inst

Re: [Qemu-devel] [PATCH v6 2/7] qemu.py: fix is_running() return before first launch()

2017-08-01 Thread Amador Pahim
On Tue, Aug 1, 2017 at 12:50 PM, Eduardo Habkost wrote: > On Tue, Aug 01, 2017 at 11:09:25AM +0100, Stefan Hajnoczi wrote: >> On Mon, Jul 31, 2017 at 10:51:05AM +0200, Amador Pahim wrote: >> > is_running() returns None when called before the first time w

Re: [Qemu-devel] [PATCH v6 3/7] qemu.py: use python logging system

2017-07-31 Thread Amador Pahim
On Mon, Jul 31, 2017 at 4:50 PM, Eduardo Habkost wrote: > On Mon, Jul 31, 2017 at 10:51:06AM +0200, Amador Pahim wrote: >> Let's provide extra control and flexibility by using python logging >> system instead of print and/or sys.std*.write(). >> >> Signed-off-by:

[Qemu-devel] [PATCH v6 0/7] scripts/qemu.py fixes and cleanups

2017-07-31 Thread Amador Pahim
return before first call to maunch(). - Use python logging system. - Include the full command line on negative exit code error message. - Use os.path.null instead of /dev/null. - Improve the control over the created/deleted files. Amador Pahim (7): qemu.py: use poll() instead of 'return

[Qemu-devel] [PATCH v6 7/7] qemu.py: include debug information on launch error

2017-07-31 Thread Amador Pahim
n File "qemu.py", line 175, in launch self._launch() File "qemu.py", line 189, in _launch self._post_launch() File "qemu.py", line 154, in _post_launch self._qmp.accept() File "qmp/qmp.py", line 145, in accept

[Qemu-devel] [PATCH v6 4/7] qemu.py: improve message on negative exit code

2017-07-31 Thread Amador Pahim
The current message shows 'self._args', which contains only part of the options used in the qemu command line. This patch makes the qemu full args list an instance variable and then uses it in the negative exit code message. Signed-off-by: Amador Pahim --- scripts/qe

[Qemu-devel] [PATCH v6 5/7] qemu.py: use os.path.null instead of /dev/null

2017-07-31 Thread Amador Pahim
For increased portability, let's use os.path.devnull. Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 9434ccc30b..d313c6d4db 100644 --- a/scripts/qemu.py +++ b/scripts/qe

[Qemu-devel] [PATCH v6 6/7] qemu.py: cleanup and improve launch()/shutdown()

2017-07-31 Thread Amador Pahim
_launch(), making sure VM will be terminated and cleaned up. Also, the pre_launch() was changed to make sure the files that will be created are not present in the system before creating them and the post_shutdown() will now only remove files that were created by this instance. Signed-off-by: Amador

[Qemu-devel] [PATCH v6 1/7] qemu.py: use poll() instead of 'returncode'

2017-07-31 Thread Amador Pahim
ll() to check whether the process is running and also to get the updated process exit code, when the process is finished. Signed-off-by: Amador Pahim Reviewed-by: Fam Zheng Reviewed-by: Stefan Hajnoczi --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/

[Qemu-devel] [PATCH v6 3/7] qemu.py: use python logging system

2017-07-31 Thread Amador Pahim
Let's provide extra control and flexibility by using python logging system instead of print and/or sys.std*.write(). Signed-off-by: Amador Pahim --- scripts/qemu.py | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py

[Qemu-devel] [PATCH v6 2/7] qemu.py: fix is_running() return before first launch()

2017-07-31 Thread Amador Pahim
is_running() returns None when called before the first time we call launch(): >>> import qemu >>> vm = qemu.QEMUMachine('qemu-system-x86_64') >>> vm.is_running() >>> It should retunt False instead. This patch fixes that. Signed-

Re: [Qemu-devel] [PATCH v4 1/2] qemu.py: make 'args' public

2017-07-27 Thread Amador Pahim
On Thu, Jul 27, 2017 at 9:39 AM, Amador Pahim wrote: > On Wed, Jul 26, 2017 at 7:35 PM, Stefan Hajnoczi wrote: >> On Tue, Jul 25, 2017 at 11:30:16AM -0400, Cleber Rosa wrote: >>> On 07/25/2017 09:37 AM, Stefan Hajnoczi wrote: >>> > On Mon, Jul 24, 2017 at 02:44:

Re: [Qemu-devel] [PATCH v5 1/6] qemu.py: make 'args' public

2017-07-27 Thread Amador Pahim
On Thu, Jul 27, 2017 at 4:18 PM, Stefan Hajnoczi wrote: > On Tue, Jul 25, 2017 at 07:10:09PM +0200, Amador Pahim wrote: >> Let's make args public so users can extend it in instances >> without feeling like abusing the internal API. >> >> Signed-off-by: Amador P

Re: [Qemu-devel] [PATCH v5 3/6] qemu.py: cleanup message on negative exit code

2017-07-27 Thread Amador Pahim
On Tue, Jul 25, 2017 at 9:51 PM, Eduardo Habkost wrote: > On Tue, Jul 25, 2017 at 07:10:11PM +0200, Amador Pahim wrote: >> The message contains the self._args, which has only part of the >> options used in the qemu command line and is not representative >> enough to figure

Re: [Qemu-devel] [PATCH v5 6/6] qemu.py: include qemu command line and output on launch error

2017-07-27 Thread Amador Pahim
On Tue, Jul 25, 2017 at 11:17 PM, Eduardo Habkost wrote: > On Tue, Jul 25, 2017 at 07:10:14PM +0200, Amador Pahim wrote: >> When launching a VM, if an exception happens and the VM is not >> initiated, it is useful to see the qemu command line that was executed >> and the o

Re: [Qemu-devel] [PATCH v5 4/6] qemu.py: cleanup launch()

2017-07-27 Thread Amador Pahim
On Tue, Jul 25, 2017 at 10:42 PM, Eduardo Habkost wrote: > On Tue, Jul 25, 2017 at 07:10:12PM +0200, Amador Pahim wrote: >> launch() is currently taking care of a number of flows, each one if its >> own exception treatment, depending on the VM state and the files >> creat

Re: [Qemu-devel] [PATCH v4 1/2] qemu.py: make 'args' public

2017-07-27 Thread Amador Pahim
On Wed, Jul 26, 2017 at 7:35 PM, Stefan Hajnoczi wrote: > On Tue, Jul 25, 2017 at 11:30:16AM -0400, Cleber Rosa wrote: >> On 07/25/2017 09:37 AM, Stefan Hajnoczi wrote: >> > On Mon, Jul 24, 2017 at 02:44:37PM +0200, Amador Pahim wrote: >> >> Signed-off-by: Amador

[Qemu-devel] [PATCH v5 3/6] qemu.py: cleanup message on negative exit code

2017-07-25 Thread Amador Pahim
The message contains the self._args, which has only part of the options used in the qemu command line and is not representative enough to figure out what happened to the process. This patch drops the self._args part of the message. Signed-off-by: Amador Pahim --- scripts/qemu.py | 3 ++- 1

[Qemu-devel] [PATCH v5 6/6] qemu.py: include qemu command line and output on launch error

2017-07-25 Thread Amador Pahim
When launching a VM, if an exception happens and the VM is not initiated, it is useful to see the qemu command line that was executed and the output of that command. Signed-off-by: Amador Pahim --- scripts/qemu.py | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff

[Qemu-devel] [PATCH v5 4/6] qemu.py: cleanup launch()

2017-07-25 Thread Amador Pahim
_launch(), making sure VM will be terminated and cleaned up. Signed-off-by: Amador Pahim --- scripts/qemu.py | 42 +- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 56142ed59b..45a63e8e9d 100644 --- a

[Qemu-devel] [PATCH v5 5/6] qemu.py: make sure shutdown() is called before launching again

2017-07-25 Thread Amador Pahim
(), calling it when applies. Signed-off-by: Amador Pahim --- scripts/qemu.py | 8 1 file changed, 8 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index 45a63e8e9d..e18e8ec657 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -39,6 +39,7 @@ class QEMUMachine(object

[Qemu-devel] [PATCH v5 2/6] qemu.py: use poll() instead of 'returncode'

2017-07-25 Thread Amador Pahim
ll() to check whether the process is running and also to get the updated process exit code, if any. Signed-off-by: Amador Pahim --- scripts/qemu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index 59ed5270f8..f37e2fe58e 100644 --- a/scri

[Qemu-devel] [PATCH v5 0/6] scripts/qemu.py fixes and cleanups

2017-07-25 Thread Amador Pahim
o logical changes and include in the commit messages the rationale for making them. Amador Pahim (6): qemu.py: make 'args' public qemu.py: use poll() instead of 'returncode' qemu.py: cleanup message on negative exit code qemu.py: cleanup launch() qemu.py: make sure s

[Qemu-devel] [PATCH v5 1/6] qemu.py: make 'args' public

2017-07-25 Thread Amador Pahim
Let's make args public so users can extend it in instances without feeling like abusing the internal API. Signed-off-by: Amador Pahim --- scripts/qemu.py | 14 +++--- tests/qemu-iotests/iotests.py | 18 +- 2 files changed, 16 insertions(+), 16 dele

  1   2   >