Blame SOURCES/kvm-qemu-iotests-Rewrite-207-for-blockdev-create-job.patch

ae23c9
From 9aefeb3f3ea1592e95467049e16e252660c292d1 Mon Sep 17 00:00:00 2001
ae23c9
From: Kevin Wolf <kwolf@redhat.com>
ae23c9
Date: Tue, 26 Jun 2018 09:48:47 +0200
ae23c9
Subject: [PATCH 139/268] qemu-iotests: Rewrite 207 for blockdev-create job
ae23c9
ae23c9
RH-Author: Kevin Wolf <kwolf@redhat.com>
ae23c9
Message-id: <20180626094856.6924-65-kwolf@redhat.com>
ae23c9
Patchwork-id: 81083
ae23c9
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH v2 64/73] qemu-iotests: Rewrite 207 for blockdev-create job
ae23c9
Bugzilla: 1513543
ae23c9
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
ae23c9
RH-Acked-by: Max Reitz <mreitz@redhat.com>
ae23c9
RH-Acked-by: Fam Zheng <famz@redhat.com>
ae23c9
ae23c9
This rewrites the test case 207 to work with the new x-blockdev-create
ae23c9
job rather than the old synchronous version of the command.
ae23c9
ae23c9
Most of the test cases stay the same as before (the exception being some
ae23c9
improved 'size' options that allow distinguishing which command created
ae23c9
the image), but in order to be able to implement proper job handling,
ae23c9
the test case is rewritten in Python.
ae23c9
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Reviewed-by: Max Reitz <mreitz@redhat.com>
ae23c9
(cherry picked from commit 00af19359e8d77e53a09de9a5d3ed6f6e149e0d2)
ae23c9
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 tests/qemu-iotests/207     | 440 ++++++++++++++++++++-------------------------
ae23c9
 tests/qemu-iotests/207.out | 107 +++++------
ae23c9
 tests/qemu-iotests/group   |   6 +-
ae23c9
 3 files changed, 257 insertions(+), 296 deletions(-)
ae23c9
ae23c9
diff --git a/tests/qemu-iotests/207 b/tests/qemu-iotests/207
ae23c9
index f5c7785..b595c92 100755
ae23c9
--- a/tests/qemu-iotests/207
ae23c9
+++ b/tests/qemu-iotests/207
ae23c9
@@ -1,9 +1,11 @@
ae23c9
-#!/bin/bash
ae23c9
+#!/usr/bin/env python
ae23c9
 #
ae23c9
 # Test ssh image creation
ae23c9
 #
ae23c9
 # Copyright (C) 2018 Red Hat, Inc.
ae23c9
 #
ae23c9
+# Creator/Owner: Kevin Wolf <kwolf@redhat.com>
ae23c9
+#
ae23c9
 # This program is free software; you can redistribute it and/or modify
ae23c9
 # it under the terms of the GNU General Public License as published by
ae23c9
 # the Free Software Foundation; either version 2 of the License, or
ae23c9
@@ -18,244 +20,198 @@
ae23c9
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
ae23c9
 #
ae23c9
 
ae23c9
-# creator
ae23c9
-owner=kwolf@redhat.com
ae23c9
-
ae23c9
-seq=`basename $0`
ae23c9
-echo "QA output created by $seq"
ae23c9
-
ae23c9
-here=`pwd`
ae23c9
-status=1	# failure is the default!
ae23c9
-
ae23c9
-# get standard environment, filters and checks
ae23c9
-. ./common.rc
ae23c9
-. ./common.filter
ae23c9
-
ae23c9
-_supported_fmt raw
ae23c9
-_supported_proto ssh
ae23c9
-_supported_os Linux
ae23c9
-
ae23c9
-function do_run_qemu()
ae23c9
-{
ae23c9
-    echo Testing: "$@"
ae23c9
-    $QEMU -nographic -qmp stdio -serial none "$@"
ae23c9
-    echo
ae23c9
-}
ae23c9
-
ae23c9
-function run_qemu()
ae23c9
-{
ae23c9
-    do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
ae23c9
-                          | _filter_qemu | _filter_imgfmt \
ae23c9
-                          | _filter_actual_image_size
ae23c9
-}
ae23c9
-
ae23c9
-echo
ae23c9
-echo "=== Successful image creation (defaults) ==="
ae23c9
-echo
ae23c9
-
ae23c9
-run_qemu <
ae23c9
-{ "execute": "qmp_capabilities" }
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 4194304
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "quit" }
ae23c9
-EOF
ae23c9
-
ae23c9
-_img_info | _filter_img_info
ae23c9
-echo
ae23c9
-TEST_IMG=$TEST_IMG_FILE _img_info | _filter_img_info
ae23c9
-
ae23c9
-echo
ae23c9
-echo "=== Test host-key-check options ==="
ae23c9
-echo
ae23c9
-
ae23c9
-run_qemu <
ae23c9
-{ "execute": "qmp_capabilities" }
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          },
ae23c9
-          "host-key-check": {
ae23c9
-              "mode": "none"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 8388608
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "quit" }
ae23c9
-EOF
ae23c9
-
ae23c9
-_img_info | _filter_img_info
ae23c9
-
ae23c9
-run_qemu <
ae23c9
-{ "execute": "qmp_capabilities" }
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          },
ae23c9
-          "host-key-check": {
ae23c9
-              "mode": "known_hosts"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 4194304
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "quit" }
ae23c9
-EOF
ae23c9
-
ae23c9
-_img_info | _filter_img_info
ae23c9
-
ae23c9
-
ae23c9
-key=$(ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" |
ae23c9
-      cut -d" " -f3 | base64 -d | md5sum -b | cut -d" " -f1)
ae23c9
-
ae23c9
-run_qemu <
ae23c9
-{ "execute": "qmp_capabilities" }
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          },
ae23c9
-          "host-key-check": {
ae23c9
-              "mode": "hash",
ae23c9
-              "type": "md5",
ae23c9
-              "hash": "wrong"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 8388608
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          },
ae23c9
-          "host-key-check": {
ae23c9
-              "mode": "hash",
ae23c9
-              "type": "md5",
ae23c9
-              "hash": "$key"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 8388608
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "quit" }
ae23c9
-EOF
ae23c9
-
ae23c9
-_img_info | _filter_img_info
ae23c9
-
ae23c9
-
ae23c9
-key=$(ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" |
ae23c9
-      cut -d" " -f3 | base64 -d | sha1sum -b | cut -d" " -f1)
ae23c9
-
ae23c9
-run_qemu <
ae23c9
-{ "execute": "qmp_capabilities" }
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          },
ae23c9
-          "host-key-check": {
ae23c9
-              "mode": "hash",
ae23c9
-              "type": "sha1",
ae23c9
-              "hash": "wrong"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 4194304
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          },
ae23c9
-          "host-key-check": {
ae23c9
-              "mode": "hash",
ae23c9
-              "type": "sha1",
ae23c9
-              "hash": "$key"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 4194304
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "quit" }
ae23c9
-EOF
ae23c9
-
ae23c9
-_img_info | _filter_img_info
ae23c9
-
ae23c9
-echo
ae23c9
-echo "=== Invalid path and user ==="
ae23c9
-echo
ae23c9
-
ae23c9
-run_qemu <
ae23c9
-{ "execute": "qmp_capabilities" }
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "/this/is/not/an/existing/path",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 4194304
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "x-blockdev-create",
ae23c9
-  "arguments": {
ae23c9
-      "driver": "ssh",
ae23c9
-      "location": {
ae23c9
-          "path": "$TEST_IMG_FILE",
ae23c9
-          "user": "invalid user",
ae23c9
-          "server": {
ae23c9
-              "host": "127.0.0.1",
ae23c9
-              "port": "22"
ae23c9
-          }
ae23c9
-      },
ae23c9
-      "size": 4194304
ae23c9
-  }
ae23c9
-}
ae23c9
-{ "execute": "quit" }
ae23c9
-EOF
ae23c9
-
ae23c9
-# success, all done
ae23c9
-echo "*** done"
ae23c9
-rm -f $seq.full
ae23c9
-status=0
ae23c9
+import iotests
ae23c9
+import subprocess
ae23c9
+import re
ae23c9
+
ae23c9
+iotests.verify_image_format(supported_fmts=['raw'])
ae23c9
+iotests.verify_protocol(supported=['ssh'])
ae23c9
+
ae23c9
+def filter_hash(msg):
ae23c9
+    return re.sub("'hash': '[0-9a-f]+'", "'hash': HASH", msg)
ae23c9
+
ae23c9
+def blockdev_create(vm, options):
ae23c9
+    result = vm.qmp_log('x-blockdev-create', job_id='job0', options=options,
ae23c9
+                        filters=[iotests.filter_testfiles, filter_hash])
ae23c9
+
ae23c9
+    if 'return' in result:
ae23c9
+        assert result['return'] == {}
ae23c9
+        vm.run_job('job0')
ae23c9
+    iotests.log("")
ae23c9
+
ae23c9
+with iotests.FilePath('t.img') as disk_path, \
ae23c9
+     iotests.VM() as vm:
ae23c9
+
ae23c9
+    remote_path = iotests.remote_filename(disk_path)
ae23c9
+
ae23c9
+    #
ae23c9
+    # Successful image creation (defaults)
ae23c9
+    #
ae23c9
+    iotests.log("=== Successful image creation (defaults) ===")
ae23c9
+    iotests.log("")
ae23c9
+
ae23c9
+    vm.launch()
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 4194304 })
ae23c9
+    vm.shutdown()
ae23c9
+
ae23c9
+    iotests.img_info_log(remote_path, filter_path=disk_path)
ae23c9
+    iotests.log("")
ae23c9
+    iotests.img_info_log(disk_path)
ae23c9
+
ae23c9
+    #
ae23c9
+    # Test host-key-check options
ae23c9
+    #
ae23c9
+    iotests.log("=== Test host-key-check options ===")
ae23c9
+    iotests.log("")
ae23c9
+
ae23c9
+    vm.launch()
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'none'
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 8388608 })
ae23c9
+    vm.shutdown()
ae23c9
+
ae23c9
+    iotests.img_info_log(remote_path, filter_path=disk_path)
ae23c9
+
ae23c9
+    vm.launch()
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'known_hosts'
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 4194304 })
ae23c9
+    vm.shutdown()
ae23c9
+
ae23c9
+    iotests.img_info_log(remote_path, filter_path=disk_path)
ae23c9
+
ae23c9
+    md5_key = subprocess.check_output(
ae23c9
+        'ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
ae23c9
+        'cut -d" " -f3 | base64 -d | md5sum -b | cut -d" " -f1',
ae23c9
+        shell=True).rstrip()
ae23c9
+
ae23c9
+    vm.launch()
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'hash',
ae23c9
+                                  'type': 'md5',
ae23c9
+                                  'hash': 'wrong',
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 2097152 })
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'hash',
ae23c9
+                                  'type': 'md5',
ae23c9
+                                  'hash': md5_key,
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 8388608 })
ae23c9
+    vm.shutdown()
ae23c9
+
ae23c9
+    iotests.img_info_log(remote_path, filter_path=disk_path)
ae23c9
+
ae23c9
+    sha1_key = subprocess.check_output(
ae23c9
+        'ssh-keyscan -t rsa 127.0.0.1 2>/dev/null | grep -v "\\^#" | ' +
ae23c9
+        'cut -d" " -f3 | base64 -d | sha1sum -b | cut -d" " -f1',
ae23c9
+        shell=True).rstrip()
ae23c9
+
ae23c9
+    vm.launch()
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'hash',
ae23c9
+                                  'type': 'sha1',
ae23c9
+                                  'hash': 'wrong',
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 2097152 })
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'hash',
ae23c9
+                                  'type': 'sha1',
ae23c9
+                                  'hash': sha1_key,
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 4194304 })
ae23c9
+    vm.shutdown()
ae23c9
+
ae23c9
+    iotests.img_info_log(remote_path, filter_path=disk_path)
ae23c9
+
ae23c9
+    #
ae23c9
+    # Invalid path and user
ae23c9
+    #
ae23c9
+    iotests.log("=== Invalid path and user ===")
ae23c9
+    iotests.log("")
ae23c9
+
ae23c9
+    vm.launch()
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': '/this/is/not/an/existing/path',
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'none'
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 4194304 })
ae23c9
+    blockdev_create(vm, { 'driver': 'ssh',
ae23c9
+                          'location': {
ae23c9
+                              'path': disk_path,
ae23c9
+                              'user': 'invalid user',
ae23c9
+                              'server': {
ae23c9
+                                  'host': '127.0.0.1',
ae23c9
+                                  'port': '22'
ae23c9
+                              },
ae23c9
+                              'host-key-check': {
ae23c9
+                                  'mode': 'none'
ae23c9
+                              }
ae23c9
+                          },
ae23c9
+                          'size': 4194304 })
ae23c9
+    vm.shutdown()
ae23c9
diff --git a/tests/qemu-iotests/207.out b/tests/qemu-iotests/207.out
ae23c9
index 417deee..5eee17b 100644
ae23c9
--- a/tests/qemu-iotests/207.out
ae23c9
+++ b/tests/qemu-iotests/207.out
ae23c9
@@ -1,75 +1,80 @@
ae23c9
-QA output created by 207
ae23c9
-
ae23c9
 === Successful image creation (defaults) ===
ae23c9
 
ae23c9
-Testing:
ae23c9
-QMP_VERSION
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
ae23c9
+{u'return': {}}
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
 
ae23c9
-image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
ae23c9
+image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
ae23c9
 file format: IMGFMT
ae23c9
 virtual size: 4.0M (4194304 bytes)
ae23c9
 
ae23c9
-image: TEST_DIR/t.IMGFMT
ae23c9
+
ae23c9
+image: TEST_IMG
ae23c9
 file format: IMGFMT
ae23c9
 virtual size: 4.0M (4194304 bytes)
ae23c9
 
ae23c9
 === Test host-key-check options ===
ae23c9
 
ae23c9
-Testing:
ae23c9
-QMP_VERSION
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'mode': 'none'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 8388608}}}
ae23c9
+{u'return': {}}
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
 
ae23c9
-image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
ae23c9
+image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
ae23c9
 file format: IMGFMT
ae23c9
 virtual size: 8.0M (8388608 bytes)
ae23c9
-Testing:
ae23c9
-QMP_VERSION
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
ae23c9
-
ae23c9
-image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
ae23c9
+
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'mode': 'known_hosts'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
ae23c9
+{u'return': {}}
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
+
ae23c9
+image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
ae23c9
 file format: IMGFMT
ae23c9
 virtual size: 4.0M (4194304 bytes)
ae23c9
-Testing:
ae23c9
-QMP_VERSION
ae23c9
-{"return": {}}
ae23c9
-{"error": {"class": "GenericError", "desc": "remote host key does not match host_key_check 'wrong'"}}
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
ae23c9
-
ae23c9
-image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
ae23c9
+
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'hash': 'wrong', 'type': 'md5', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 2097152}}}
ae23c9
+{u'return': {}}
ae23c9
+Job failed: remote host key does not match host_key_check 'wrong'
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
+
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'hash': HASH, 'type': 'md5', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 8388608}}}
ae23c9
+{u'return': {}}
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
+
ae23c9
+image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
ae23c9
 file format: IMGFMT
ae23c9
 virtual size: 8.0M (8388608 bytes)
ae23c9
-Testing:
ae23c9
-QMP_VERSION
ae23c9
-{"return": {}}
ae23c9
-{"error": {"class": "GenericError", "desc": "remote host key does not match host_key_check 'wrong'"}}
ae23c9
-{"return": {}}
ae23c9
-{"return": {}}
ae23c9
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
ae23c9
-
ae23c9
-image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_DIR/t.IMGFMT"}}
ae23c9
+
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'hash': 'wrong', 'type': 'sha1', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 2097152}}}
ae23c9
+{u'return': {}}
ae23c9
+Job failed: remote host key does not match host_key_check 'wrong'
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
+
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'hash': HASH, 'type': 'sha1', 'mode': 'hash'}, 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
ae23c9
+{u'return': {}}
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
+
ae23c9
+image: json:{"driver": "IMGFMT", "file": {"server.host": "127.0.0.1", "server.port": "22", "driver": "ssh", "path": "TEST_IMG"}}
ae23c9
 file format: IMGFMT
ae23c9
 virtual size: 4.0M (4194304 bytes)
ae23c9
 
ae23c9
 === Invalid path and user ===
ae23c9
 
ae23c9
-Testing:
ae23c9
-QMP_VERSION
ae23c9
-{"return": {}}
ae23c9
-{"error": {"class": "GenericError", "desc": "failed to open remote file '/this/is/not/an/existing/path': Failed opening remote file (libssh2 error code: -31)"}}
ae23c9
-{"error": {"class": "GenericError", "desc": "failed to authenticate using publickey authentication and the identities held by your ssh-agent"}}
ae23c9
-{"return": {}}
ae23c9
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
ae23c9
+{'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}}}
ae23c9
+{u'return': {}}
ae23c9
+Job failed: failed to open remote file '/this/is/not/an/existing/path': Failed opening remote file (libssh2 error code: -31)
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
+
ae23c9
+{'execute': 'x-blockdev-create', 'arguments': {'job_id': 'job0', 'options': {'driver': 'ssh', 'location': {'path': 'TEST_DIR/PID-t.img', 'host-key-check': {'mode': 'none'}, 'user': 'invalid user', 'server': {'host': '127.0.0.1', 'port': '22'}}, 'size': 4194304}}}
ae23c9
+{u'return': {}}
ae23c9
+Job failed: failed to authenticate using publickey authentication and the identities held by your ssh-agent
ae23c9
+{'execute': 'job-dismiss', 'arguments': {'id': 'job0'}}
ae23c9
+{u'return': {}}
ae23c9
 
ae23c9
-*** done
ae23c9
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
ae23c9
index 3d6ae02..649291a 100644
ae23c9
--- a/tests/qemu-iotests/group
ae23c9
+++ b/tests/qemu-iotests/group
ae23c9
@@ -205,11 +205,11 @@
ae23c9
 204 rw auto quick
ae23c9
 205 rw auto quick
ae23c9
 206 rw auto
ae23c9
-# TODO The following commented out tests need to be reworked to work
ae23c9
-# with the x-blockdev-create job
ae23c9
-#207 rw auto
ae23c9
+207 rw auto
ae23c9
 208 rw auto quick
ae23c9
 209 rw auto quick
ae23c9
+# TODO The following commented out tests need to be reworked to work
ae23c9
+# with the x-blockdev-create job
ae23c9
 #210 rw auto
ae23c9
 #211 rw auto quick
ae23c9
 #212 rw auto quick
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9