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

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