All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory
@ 2019-02-18 18:06 Max Reitz
  2019-02-18 21:06 ` Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Max Reitz @ 2019-02-18 18:06 UTC (permalink / raw)
  To: qemu-block; +Cc: qemu-devel, Max Reitz, Kevin Wolf

VDI keeps the whole bitmap in memory, and the maximum size (which is
tested here) is 2 GB.  This may not be available on all machines, and it
rarely is available when running a 32 bit build.

Fix this by making VM.run_job() return the error string if an error
occurred, and checking whether that contains "Could not allocate bmap"
in 211.  If so, the test is skipped.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 tests/qemu-iotests/211        | 4 +++-
 tests/qemu-iotests/iotests.py | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211
index 5d285450b5..6afc894f76 100755
--- a/tests/qemu-iotests/211
+++ b/tests/qemu-iotests/211
@@ -32,7 +32,9 @@ def blockdev_create(vm, options):
 
     if 'return' in result:
         assert result['return'] == {}
-        vm.run_job('job0')
+        error = vm.run_job('job0')
+        if error and 'Could not allocate bmap' in error:
+            iotests.notrun('Insufficient memory')
     iotests.log("")
 
 with iotests.FilePath('t.vdi') as disk_path, \
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 387e026556..4910fb2005 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -532,7 +532,9 @@ class VM(qtest.QEMUQtestMachine):
         log(result, filters, indent=indent)
         return result
 
+    # Returns None on success, and an error string on failure
     def run_job(self, job, auto_finalize=True, auto_dismiss=False):
+        error = None
         while True:
             for ev in self.get_qmp_events_filtered(wait=True):
                 if ev['event'] == 'JOB_STATUS_CHANGE':
@@ -541,13 +543,14 @@ class VM(qtest.QEMUQtestMachine):
                         result = self.qmp('query-jobs')
                         for j in result['return']:
                             if j['id'] == job:
+                                error = j['error']
                                 log('Job failed: %s' % (j['error']))
                     elif status == 'pending' and not auto_finalize:
                         self.qmp_log('job-finalize', id=job)
                     elif status == 'concluded' and not auto_dismiss:
                         self.qmp_log('job-dismiss', id=job)
                     elif status == 'null':
-                        return
+                        return error
                 else:
                     iotests.log(ev)
 
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory
  2019-02-18 18:06 [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory Max Reitz
@ 2019-02-18 21:06 ` Eric Blake
  2019-02-18 21:22 ` Philippe Mathieu-Daudé
  2019-02-25 13:36 ` Max Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2019-02-18 21:06 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On 2/18/19 12:06 PM, Max Reitz wrote:
> VDI keeps the whole bitmap in memory, and the maximum size (which is
> tested here) is 2 GB.  This may not be available on all machines, and it
> rarely is available when running a 32 bit build.
> 
> Fix this by making VM.run_job() return the error string if an error
> occurred, and checking whether that contains "Could not allocate bmap"
> in 211.  If so, the test is skipped.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/211        | 4 +++-
>  tests/qemu-iotests/iotests.py | 5 ++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory
  2019-02-18 18:06 [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory Max Reitz
  2019-02-18 21:06 ` Eric Blake
@ 2019-02-18 21:22 ` Philippe Mathieu-Daudé
  2019-02-25 13:36 ` Max Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-02-18 21:22 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: Kevin Wolf, qemu-devel

On 2/18/19 7:06 PM, Max Reitz wrote:
> VDI keeps the whole bitmap in memory, and the maximum size (which is
> tested here) is 2 GB.  This may not be available on all machines, and it
> rarely is available when running a 32 bit build.
> 
> Fix this by making VM.run_job() return the error string if an error
> occurred, and checking whether that contains "Could not allocate bmap"
> in 211.  If so, the test is skipped.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  tests/qemu-iotests/211        | 4 +++-
>  tests/qemu-iotests/iotests.py | 5 ++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211
> index 5d285450b5..6afc894f76 100755
> --- a/tests/qemu-iotests/211
> +++ b/tests/qemu-iotests/211
> @@ -32,7 +32,9 @@ def blockdev_create(vm, options):
>  
>      if 'return' in result:
>          assert result['return'] == {}
> -        vm.run_job('job0')
> +        error = vm.run_job('job0')
> +        if error and 'Could not allocate bmap' in error:
> +            iotests.notrun('Insufficient memory')
>      iotests.log("")
>  
>  with iotests.FilePath('t.vdi') as disk_path, \
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index 387e026556..4910fb2005 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -532,7 +532,9 @@ class VM(qtest.QEMUQtestMachine):
>          log(result, filters, indent=indent)
>          return result
>  
> +    # Returns None on success, and an error string on failure
>      def run_job(self, job, auto_finalize=True, auto_dismiss=False):
> +        error = None
>          while True:
>              for ev in self.get_qmp_events_filtered(wait=True):
>                  if ev['event'] == 'JOB_STATUS_CHANGE':
> @@ -541,13 +543,14 @@ class VM(qtest.QEMUQtestMachine):
>                          result = self.qmp('query-jobs')
>                          for j in result['return']:
>                              if j['id'] == job:
> +                                error = j['error']
>                                  log('Job failed: %s' % (j['error']))
>                      elif status == 'pending' and not auto_finalize:
>                          self.qmp_log('job-finalize', id=job)
>                      elif status == 'concluded' and not auto_dismiss:
>                          self.qmp_log('job-dismiss', id=job)
>                      elif status == 'null':
> -                        return
> +                        return error
>                  else:
>                      iotests.log(ev)
>  
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory
  2019-02-18 18:06 [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory Max Reitz
  2019-02-18 21:06 ` Eric Blake
  2019-02-18 21:22 ` Philippe Mathieu-Daudé
@ 2019-02-25 13:36 ` Max Reitz
  2 siblings, 0 replies; 4+ messages in thread
From: Max Reitz @ 2019-02-25 13:36 UTC (permalink / raw)
  To: qemu-block; +Cc: qemu-devel, Kevin Wolf

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

On 18.02.19 19:06, Max Reitz wrote:
> VDI keeps the whole bitmap in memory, and the maximum size (which is
> tested here) is 2 GB.  This may not be available on all machines, and it
> rarely is available when running a 32 bit build.
> 
> Fix this by making VM.run_job() return the error string if an error
> occurred, and checking whether that contains "Could not allocate bmap"
> in 211.  If so, the test is skipped.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  tests/qemu-iotests/211        | 4 +++-
>  tests/qemu-iotests/iotests.py | 5 ++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)

Thanks for the reviews, applied to my block branch.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-25 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-18 18:06 [Qemu-devel] [PATCH] iotests: Skip 211 on insufficient memory Max Reitz
2019-02-18 21:06 ` Eric Blake
2019-02-18 21:22 ` Philippe Mathieu-Daudé
2019-02-25 13:36 ` Max Reitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.