[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/19] qtest/ahci: add flush migrate test
From: |
John Snow |
Subject: |
[Qemu-devel] [PULL 09/19] qtest/ahci: add flush migrate test |
Date: |
Fri, 22 May 2015 15:59:42 -0400 |
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 <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Message-id: address@hidden
---
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 6513330..f6de355 100644
--- a/tests/ahci-test.c
+++ b/tests/ahci-test.c
@@ -1071,7 +1071,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);
@@ -1154,6 +1154,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
*/
@@ -1402,6 +1451,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);
--
2.1.0
- [Qemu-devel] [PULL 03/19] libqos/ahci: Add halted command helpers, (continued)
- [Qemu-devel] [PULL 03/19] libqos/ahci: Add halted command helpers, John Snow, 2015/05/22
- [Qemu-devel] [PULL 04/19] libqos/ahci: Fix sector set method, John Snow, 2015/05/22
- [Qemu-devel] [PULL 08/19] qtest/ahci: add migrate dma test, John Snow, 2015/05/22
- [Qemu-devel] [PULL 07/19] qtest/ahci: Add migration test, John Snow, 2015/05/22
- [Qemu-devel] [PULL 12/19] qtest: allow arbitrarily long sends, John Snow, 2015/05/22
- [Qemu-devel] [PULL 05/19] libqos: Add migration helpers, John Snow, 2015/05/22
- [Qemu-devel] [PULL 14/19] qtest: add memset to qtest protocol, John Snow, 2015/05/22
- [Qemu-devel] [PULL 11/19] qtest/ahci: add migrate halted dma test, John Snow, 2015/05/22
- [Qemu-devel] [PULL 13/19] qtest: Add base64 encoded read/write, John Snow, 2015/05/22
- [Qemu-devel] [PULL 10/19] qtest/ahci: add halted dma test, John Snow, 2015/05/22
- [Qemu-devel] [PULL 09/19] qtest/ahci: add flush migrate test,
John Snow <=
- [Qemu-devel] [PULL 19/19] ahci: do not remap clb/fis unconditionally, John Snow, 2015/05/22
- [Qemu-devel] [PULL 17/19] macio: move unaligned DMA read code into separate pmac_dma_read() function, John Snow, 2015/05/22
- [Qemu-devel] [PULL 18/19] macio: move unaligned DMA write code into separate pmac_dma_write() function, John Snow, 2015/05/22
- [Qemu-devel] [PULL 15/19] libqos/ahci: Swap memread/write with bufread/write, John Snow, 2015/05/22
- [Qemu-devel] [PULL 16/19] qtest: pre-buffer hex nibs, John Snow, 2015/05/22
- Re: [Qemu-devel] [PULL 00/19] Ide patches, Peter Maydell, 2015/05/26