All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Cody <jcody@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 09/14] qemu-iotests: Rewrite 207 for blockdev-create job
Date: Tue, 29 May 2018 13:52:15 -0400	[thread overview]
Message-ID: <20180529175215.GH6999@localhost.localdomain> (raw)
In-Reply-To: <20180525163327.23097-10-kwolf@redhat.com>

On Fri, May 25, 2018 at 06:33:22PM +0200, Kevin Wolf wrote:
> This rewrites the test case 207 to work with the new x-blockdev-create
> job rather than the old synchronous version of the command.
> 
> Most of the test cases stay the same as before (the exception being some
> improved 'size' options that allow distinguishing which command created
> the image), but in order to be able to implement proper job handling,
> the test case is rewritten in Python.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/207        | 435 +++++++++++++++++++-----------------------
>  tests/qemu-iotests/207.out    |  89 +++++----
>  tests/qemu-iotests/group      |   6 +-
>  tests/qemu-iotests/iotests.py |  23 ++-
>  4 files changed, 264 insertions(+), 289 deletions(-)
> 
> diff --git a/tests/qemu-iotests/207 b/tests/qemu-iotests/207
> index f5c77852d1..91c1f7e811 100755
> --- a/tests/qemu-iotests/207
> +++ b/tests/qemu-iotests/207
> @@ -1,9 +1,11 @@
> -#!/bin/bash
> +#!/usr/bin/env python
>  #
>  # Test ssh image creation
>  #
>  # Copyright (C) 2018 Red Hat, Inc.
>  #
> +# Creator/Owner: Kevin Wolf <kwolf@redhat.com>
> +#
>  # This program is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
>  # the Free Software Foundation; either version 2 of the License, or
> @@ -18,244 +20,193 @@
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  #
>  
> -# creator
> -owner=kwolf@redhat.com
> -
> -seq=`basename $0`
> -echo "QA output created by $seq"
> -
> -here=`pwd`
> -status=1	# failure is the default!
> -
> -# get standard environment, filters and checks
> -. ./common.rc
> -. ./common.filter
> -
> -_supported_fmt raw
> -_supported_proto ssh
> -_supported_os Linux
> -
> -function do_run_qemu()
> -{
> -    echo Testing: "$@"
> -    $QEMU -nographic -qmp stdio -serial none "$@"
> -    echo
> -}
> -
> -function run_qemu()
> -{
> -    do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
> -                          | _filter_qemu | _filter_imgfmt \
> -                          | _filter_actual_image_size
> -}
> -
> -echo
> -echo "=== Successful image creation (defaults) ==="
> -echo
> -
> -run_qemu <<EOF
> -{ "execute": "qmp_capabilities" }
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          }
> -      },
> -      "size": 4194304
> -  }
> -}
> -{ "execute": "quit" }
> -EOF
> -
> -_img_info | _filter_img_info
> -echo
> -TEST_IMG=$TEST_IMG_FILE _img_info | _filter_img_info
> -
> -echo
> -echo "=== Test host-key-check options ==="
> -echo
> -
> -run_qemu <<EOF
> -{ "execute": "qmp_capabilities" }
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          },
> -          "host-key-check": {
> -              "mode": "none"
> -          }
> -      },
> -      "size": 8388608
> -  }
> -}
> -{ "execute": "quit" }
> -EOF
> -
> -_img_info | _filter_img_info
> -
> -run_qemu <<EOF
> -{ "execute": "qmp_capabilities" }
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          },
> -          "host-key-check": {
> -              "mode": "known_hosts"
> -          }
> -      },
> -      "size": 4194304
> -  }
> -}
> -{ "execute": "quit" }
> -EOF
> -
> -_img_info | _filter_img_info
> -
> -
> -key=$(ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" |
> -      cut -d" " -f3 | base64 -d | md5sum -b | cut -d" " -f1)
> -
> -run_qemu <<EOF
> -{ "execute": "qmp_capabilities" }
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          },
> -          "host-key-check": {
> -              "mode": "hash",
> -              "type": "md5",
> -              "hash": "wrong"
> -          }
> -      },
> -      "size": 8388608
> -  }
> -}
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          },
> -          "host-key-check": {
> -              "mode": "hash",
> -              "type": "md5",
> -              "hash": "$key"
> -          }
> -      },
> -      "size": 8388608
> -  }
> -}
> -{ "execute": "quit" }
> -EOF
> -
> -_img_info | _filter_img_info
> -
> -
> -key=$(ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" |
> -      cut -d" " -f3 | base64 -d | sha1sum -b | cut -d" " -f1)
> -
> -run_qemu <<EOF
> -{ "execute": "qmp_capabilities" }
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          },
> -          "host-key-check": {
> -              "mode": "hash",
> -              "type": "sha1",
> -              "hash": "wrong"
> -          }
> -      },
> -      "size": 4194304
> -  }
> -}
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          },
> -          "host-key-check": {
> -              "mode": "hash",
> -              "type": "sha1",
> -              "hash": "$key"
> -          }
> -      },
> -      "size": 4194304
> -  }
> -}
> -{ "execute": "quit" }
> -EOF
> -
> -_img_info | _filter_img_info
> -
> -echo
> -echo "=== Invalid path and user ==="
> -echo
> -
> -run_qemu <<EOF
> -{ "execute": "qmp_capabilities" }
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "/this/is/not/an/existing/path",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          }
> -      },
> -      "size": 4194304
> -  }
> -}
> -{ "execute": "x-blockdev-create",
> -  "arguments": {
> -      "driver": "ssh",
> -      "location": {
> -          "path": "$TEST_IMG_FILE",
> -          "user": "invalid user",
> -          "server": {
> -              "host": "127.0.0.1",
> -              "port": "22"
> -          }
> -      },
> -      "size": 4194304
> -  }
> -}
> -{ "execute": "quit" }
> -EOF
> -
> -# success, all done
> -echo "*** done"
> -rm -f $seq.full
> -status=0
> +import iotests
> +import subprocess
> +
> +iotests.verify_image_format(supported_fmts=['raw'])
> +iotests.verify_protocol(supported=['ssh'])
> +
> +def blockdev_create(vm, options):
> +    result = vm.qmp_log('x-blockdev-create', job_id='job0', options=options)

This needs a 'hash' filter, to filter out the md5sum in the 'md5'
host-key-check tests.


> +
> +    if 'return' in result:
> +        assert result['return'] == {}
> +        vm.run_job('job0')
> +    iotests.log("")
> +
> +with iotests.FilePath('t.img') as disk_path, \
> +     iotests.VM() as vm:
> +
> +    remote_path = iotests.remote_filename(disk_path)
> +
> +    #
> +    # Successful image creation (defaults)
> +    #
> +    iotests.log("=== Successful image creation (defaults) ===")
> +    iotests.log("")
> +
> +    vm.launch()
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              }
> +                          },
> +                          'size': 4194304 })
> +    vm.shutdown()
> +
> +    iotests.img_info_log(remote_path, filter_path=disk_path)
> +    iotests.log("")
> +    iotests.img_info_log(disk_path)
> +
> +    #
> +    # Test host-key-check options
> +    #
> +    iotests.log("=== Test host-key-check options ===")
> +    iotests.log("")
> +
> +    vm.launch()
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'none'
> +                              }
> +                          },
> +                          'size': 8388608 })
> +    vm.shutdown()
> +
> +    iotests.img_info_log(remote_path, filter_path=disk_path)
> +
> +    vm.launch()
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'known_hosts'
> +                              }
> +                          },
> +                          'size': 4194304 })
> +    vm.shutdown()
> +
> +    iotests.img_info_log(remote_path, filter_path=disk_path)
> +
> +    md5_key = subprocess.check_output(
> +        'ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
> +        'cut -d" " -f3 | base64 -d | md5sum -b | cut -d" " -f1',
> +        shell=True).rstrip()
> +
> +    vm.launch()
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'hash',
> +                                  'type': 'md5',
> +                                  'hash': 'wrong',
> +                              }
> +                          },
> +                          'size': 2097152 })
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'hash',
> +                                  'type': 'md5',
> +                                  'hash': md5_key,
> +                              }
> +                          },
> +                          'size': 8388608 })
> +    vm.shutdown()
> +
> +    iotests.img_info_log(remote_path, filter_path=disk_path)
> +
> +    sha1_key = subprocess.check_output(
> +        'ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
> +        'cut -d" " -f3 | base64 -d | sha1sum -b | cut -d" " -f1',
> +        shell=True).rstrip()
> +
> +    vm.launch()
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'hash',
> +                                  'type': 'sha1',
> +                                  'hash': 'wrong',
> +                              }
> +                          },
> +                          'size': 2097152 })
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'hash',
> +                                  'type': 'sha1',
> +                                  'hash': sha1_key,
> +                              }
> +                          },
> +                          'size': 4194304 })
> +    vm.shutdown()
> +
> +    iotests.img_info_log(remote_path, filter_path=disk_path)
> +
> +    #
> +    # Invalid path and user
> +    #
> +    iotests.log("=== Invalid path and user ===")
> +    iotests.log("")
> +
> +    vm.launch()
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': '/this/is/not/an/existing/path',
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'none'
> +                              }
> +                          },
> +                          'size': 4194304 })
> +    blockdev_create(vm, { 'driver': 'ssh',
> +                          'location': {
> +                              'path': disk_path,
> +                              'user': 'invalid user',
> +                              'server': {
> +                                  'host': '127.0.0.1',
> +                                  'port': '22'
> +                              },
> +                              'host-key-check': {
> +                                  'mode': 'none'
> +                              }
> +                          },
> +                          'size': 4194304 })
> +    vm.shutdown()
> diff --git a/tests/qemu-iotests/207.out b/tests/qemu-iotests/207.out
> index 417deee970..299650872c 100644
> --- a/tests/qemu-iotests/207.out
> +++ b/tests/qemu-iotests/207.out
> @@ -1,62 +1,64 @@
> -QA output created by 207
> -
>  === Successful image creation (defaults) ===
>  
> -Testing:
> -QMP_VERSION
> -{"return": {}}
> -{"return": {}}
> -{"return": {}}
> -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
> +{u'return': {}}
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
>  
>  image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
>  file format: IMGFMT
>  virtual size: 4.0M (4194304 bytes)
>  
> +
>  image: TEST_DIR/t.IMGFMT
>  file format: IMGFMT
>  virtual size: 4.0M (4194304 bytes)
>  
>  === Test host-key-check options ===
>  
> -Testing:
> -QMP_VERSION
> -{"return": {}}
> -{"return": {}}
> -{"return": {}}
> -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'mode': 'none'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 8388608}}}
> +{u'return': {}}
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
>  
>  image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
>  file format: IMGFMT
>  virtual size: 8.0M (8388608 bytes)
> -Testing:
> -QMP_VERSION
> -{"return": {}}
> -{"return": {}}
> -{"return": {}}
> -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
> +
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'mode': 'known_hosts'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
> +{u'return': {}}
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
>  
>  image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
>  file format: IMGFMT
>  virtual size: 4.0M (4194304 bytes)
> -Testing:
> -QMP_VERSION
> -{"return": {}}
> -{"error": {"class": "GenericError", "desc": "remote host key does not match host_key_check 'wrong'"}}
> -{"return": {}}
> -{"return": {}}
> -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
> +
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'hash': 'wrong', 'type': 'md5', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 2097152}}}
> +{u'return': {}}
> +Job failed: remote host key does not match host_key_check 'wrong'
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
> +
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'hash': 'f3386a5742ddc4a04244118e59a1f92b', 'type': 'md5', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 8388608}}}
> +{u'return': {}}
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
>  
>  image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
>  file format: IMGFMT
>  virtual size: 8.0M (8388608 bytes)
> -Testing:
> -QMP_VERSION
> -{"return": {}}
> -{"error": {"class": "GenericError", "desc": "remote host key does not match host_key_check 'wrong'"}}
> -{"return": {}}
> -{"return": {}}
> -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
> +
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'hash': 'wrong', 'type': 'sha1', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 2097152}}}
> +{u'return': {}}
> +Job failed: remote host key does not match host_key_check 'wrong'
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
> +
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'hash': 'c6142e54650531177fa3d88ac52501ae00ccff69', 'type': 'sha1', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
> +{u'return': {}}
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
>  
>  image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
>  file format: IMGFMT
> @@ -64,12 +66,15 @@ virtual size: 4.0M (4194304 bytes)
>  
>  === Invalid path and user ===
>  
> -Testing:
> -QMP_VERSION
> -{"return": {}}
> -{"error": {"class": "GenericError", "desc": "failed to open remote file '/this/is/not/an/existing/path': Failed opening remote file (libssh2 error code: -31)"}}
> -{"error": {"class": "GenericError", "desc": "failed to authenticate using publickey authentication and the identities held by your ssh-agent"}}
> -{"return": {}}
> -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': '/this/is/not/an/existing/path', 'host-key-check': {'mode': 'none'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
> +{u'return': {}}
> +Job failed: failed to open remote file '/this/is/not/an/existing/path': Failed opening remote file (libssh2 error code: -31)
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
> +
> +{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/t.img', 'host-key-check': {'mode': 'none'}, 'user': 'invalid user', 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
> +{u'return': {}}
> +Job failed: failed to authenticate using publickey authentication and the identities held by your ssh-agent
> +{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
> +{u'return': {}}
>  
> -*** done
> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
> index be157e7679..8a84bf057d 100644
> --- a/tests/qemu-iotests/group
> +++ b/tests/qemu-iotests/group
> @@ -205,11 +205,11 @@
>  204 rw auto quick
>  205 rw auto quick
>  206 rw auto
> -# TODO The following commented out tests need to be reworked to work
> -# with the x-blockdev-create job
> -#207 rw auto
> +207 rw auto
>  208 rw auto quick
>  209 rw auto quick
> +# TODO The following commented out tests need to be reworked to work
> +# with the x-blockdev-create job
>  #210 rw auto
>  #211 rw auto quick
>  #212 rw auto quick
> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
> index f0f4ef32f0..e945caa6bb 100644
> --- a/tests/qemu-iotests/iotests.py
> +++ b/tests/qemu-iotests/iotests.py
> @@ -109,9 +109,11 @@ def qemu_img_pipe(*args):
>          sys.stderr.write('qemu-img received signal %i: %s\n' % (-exitcode, ' '.join(qemu_img_args + list(args))))
>      return subp.communicate()[0]
>  
> -def img_info_log(filename):
> +def img_info_log(filename, filter_path=None):
>      output = qemu_img_pipe('info', '-f', imgfmt, filename)
> -    log(filter_img_info(output, filename))
> +    if not filter_path:
> +        filter_path = filename
> +    log(filter_img_info(output, filter_path))
>  
>  def qemu_io(*args):
>      '''Run qemu-io and return the stdout data'''
> @@ -301,6 +303,13 @@ def file_path(*names):
>  
>      return paths[0] if len(paths) == 1 else paths
>  
> +def remote_filename(path):
> +    if imgproto == 'file':
> +        return imgproto
> +    elif imgproto == 'ssh':
> +        return "ssh://127.0.0.1%s" % (path)
> +    else:
> +        raise Exception("Protocol %s not supported" % (imgproto))
>  
>  class VM(qtest.QEMUQtestMachine):
>      '''A QEMU VM'''
> @@ -595,6 +604,16 @@ def verify_image_format(supported_fmts=[], unsupported_fmts=[]):
>      if not_sup or (imgfmt in unsupported_fmts):
>          notrun('not suitable for this image format: %s' % imgfmt)
>  
> +def verify_protocol(supported=[], unsupported=[]):
> +    assert not (supported and unsupported)
> +
> +    if 'generic' in supported:
> +        return
> +
> +    not_sup = supported and (imgproto not in supported)
> +    if not_sup or (imgproto in unsupported):
> +        notrun('not suitable for this protocol: %s' % imgproto)
> +
>  def verify_platform(supported_oses=['linux']):
>      if True not in [sys.platform.startswith(x) for x in supported_oses]:
>          notrun('not suitable for this OS: %s' % sys.platform)
> -- 
> 2.13.6
> 
> 

  parent reply	other threads:[~2018-05-29 17:52 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 16:33 [Qemu-devel] [PATCH 00/14] block: Make blockdev-create a job and stable API Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 01/14] vdi: Fix vdi_co_do_create() return value Kevin Wolf
2018-05-29 10:38   ` Max Reitz
2018-05-29 14:45   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 02/14] vhdx: Fix vhdx_co_create() " Kevin Wolf
2018-05-29 10:40   ` Max Reitz
2018-05-29 14:44   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 03/14] job: Add error message for failing jobs Kevin Wolf
2018-05-29 11:01   ` Max Reitz
2018-05-29 14:43   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-29 19:54     ` Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 04/14] block/create: Make x-blockdev-create a job Kevin Wolf
2018-05-29 11:38   ` Max Reitz
2018-05-29 15:27   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-29 15:40     ` Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 05/14] qemu-iotests: Add VM.get_qmp_events_filtered() Kevin Wolf
2018-05-29 11:41   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 06/14] qemu-iotests: Add VM.qmp_log() Kevin Wolf
2018-05-29 11:48   ` Max Reitz
2018-05-29 12:12     ` Kevin Wolf
2018-05-29 12:15       ` Max Reitz
2018-05-29 12:39         ` Kevin Wolf
2018-05-29 12:41           ` Max Reitz
2018-05-29 18:31   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 07/14] qemu-iotests: Add iotests.img_info_log() Kevin Wolf
2018-05-29 11:56   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 08/14] qemu-iotests: Rewrite 206 for blockdev-create job Kevin Wolf
2018-05-29 12:27   ` Max Reitz
2018-05-29 18:49     ` Kevin Wolf
2018-05-25 16:33 ` [Qemu-devel] [PATCH 09/14] qemu-iotests: Rewrite 207 " Kevin Wolf
2018-05-29 12:44   ` Max Reitz
2018-05-29 12:47   ` Max Reitz
2018-05-29 17:52   ` Jeff Cody [this message]
2018-05-25 16:33 ` [Qemu-devel] [PATCH 10/14] qemu-iotests: Rewrite 210 " Kevin Wolf
2018-05-29 13:02   ` Max Reitz
2018-05-29 18:23   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:33 ` [Qemu-devel] [PATCH 11/14] qemu-iotests: Rewrite 211 " Kevin Wolf
2018-05-29 13:12   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 12/14] qemu-iotests: Rewrite 212 " Kevin Wolf
2018-05-29 13:21   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 13/14] qemu-iotests: Rewrite 213 " Kevin Wolf
2018-05-29 13:27   ` Max Reitz
2018-05-25 16:33 ` [Qemu-devel] [PATCH 14/14] block/create: Mark blockdev-create stable Kevin Wolf
2018-05-29 13:30   ` Max Reitz
2018-05-29 18:25   ` [Qemu-devel] [Qemu-block] " Jeff Cody
2018-05-25 16:52 ` [Qemu-devel] [PATCH 00/14] block: Make blockdev-create a job and stable API no-reply
2018-05-25 18:13 ` Eric Blake
2018-05-28  8:42   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180529175215.GH6999@localhost.localdomain \
    --to=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.