From patchwork Thu Apr 30 18:07:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 466670 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 69C5514031A for ; Fri, 1 May 2015 04:11:51 +1000 (AEST) Received: from localhost ([::1]:45214 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynsw9-0005Yj-Ar for incoming@patchwork.ozlabs.org; Thu, 30 Apr 2015 14:11:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynss9-0006cs-K8 for qemu-devel@nongnu.org; Thu, 30 Apr 2015 14:07:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ynss4-00071c-JH for qemu-devel@nongnu.org; Thu, 30 Apr 2015 14:07:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ynsry-0006yH-U8; Thu, 30 Apr 2015 14:07:31 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id A01B8B6A45; Thu, 30 Apr 2015 18:07:30 +0000 (UTC) Received: from scv.usersys.redhat.com (dhcp-17-29.bos.redhat.com [10.18.17.29]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3UI7NQu015406; Thu, 30 Apr 2015 14:07:29 -0400 From: John Snow To: qemu-block@nongnu.org Date: Thu, 30 Apr 2015 14:07:20 -0400 Message-Id: <1430417242-11859-8-git-send-email-jsnow@redhat.com> In-Reply-To: <1430417242-11859-1-git-send-email-jsnow@redhat.com> References: <1430417242-11859-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: marc.mari.barcelo@gmail.com, pbonzini@redhat.com, John Snow , qemu-devel@nongnu.org, stefanha@redhat.com Subject: [Qemu-devel] [PATCH v3 7/9] qtest/ahci: add flush migrate test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Use blkdebug to inject an error on first flush, then attempt to flush on the first guest. When the error halts the VM, migrate to the second VM, and attempt to resume the command. Signed-off-by: John Snow --- tests/ahci-test.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 90f631c..f770c9d 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -1069,7 +1069,7 @@ static void test_flush_retry(void) debug_path, tmp_path); - /* Issue Flush Command */ + /* Issue Flush Command and wait for error */ port = ahci_port_select(ahci); ahci_port_clear(ahci, port); cmd = ahci_command_create(CMD_FLUSH_CACHE); @@ -1152,6 +1152,55 @@ static void test_migrate_dma(void) g_free(tx); } +/** + * Migration test: Try to flush, migrate, then resume. + */ +static void test_flush_migrate(void) +{ + AHCIQState *src, *dst; + AHCICommand *cmd; + uint8_t px; + const char *s; + const char *uri = "tcp:127.0.0.1:1234"; + + prepare_blkdebug_script(debug_path, "flush_to_disk"); + + src = ahci_boot_and_enable("-drive file=blkdebug:%s:%s,if=none,id=drive0," + "cache=writeback,rerror=stop,werror=stop " + "-M q35 " + "-device ide-hd,drive=drive0 ", + debug_path, tmp_path); + dst = ahci_boot("-drive file=%s,if=none,id=drive0," + "cache=writeback,rerror=stop,werror=stop " + "-M q35 " + "-device ide-hd,drive=drive0 " + "-incoming %s", tmp_path, uri); + + set_context(src->parent); + + /* Issue Flush Command */ + px = ahci_port_select(src); + ahci_port_clear(src, px); + cmd = ahci_command_create(CMD_FLUSH_CACHE); + ahci_command_commit(src, cmd, px); + ahci_command_issue_async(src, cmd); + qmp_eventwait("STOP"); + + /* Migrate over */ + ahci_migrate(src, dst, uri); + + /* Complete the command */ + s = "{'execute':'cont' }"; + qmp_async(s); + qmp_eventwait("RESUME"); + ahci_command_wait(dst, cmd); + ahci_command_verify(dst, cmd); + + ahci_command_free(cmd); + ahci_shutdown(src); + ahci_shutdown(dst); +} + /******************************************************************************/ /* AHCI I/O Test Matrix Definitions */ @@ -1400,6 +1449,7 @@ int main(int argc, char **argv) qtest_add_func("/ahci/flush/simple", test_flush); qtest_add_func("/ahci/flush/retry", test_flush_retry); + qtest_add_func("/ahci/flush/migrate", test_flush_migrate); qtest_add_func("/ahci/migrate/sanity", test_migrate_sanity); qtest_add_func("/ahci/migrate/dma", test_migrate_dma);