From patchwork Thu Jul 5 08:00:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balamuruhan S X-Patchwork-Id: 10508359 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 12A6360116 for ; Thu, 5 Jul 2018 08:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F28ED28E48 for ; Thu, 5 Jul 2018 08:02:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E400028E7F; Thu, 5 Jul 2018 08:02:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7550728E48 for ; Thu, 5 Jul 2018 08:02:40 +0000 (UTC) Received: from localhost ([::1]:50908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fazDr-0007sZ-Mh for patchwork-qemu-devel@patchwork.kernel.org; Thu, 05 Jul 2018 04:02:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fazC6-0006at-4N for qemu-devel@nongnu.org; Thu, 05 Jul 2018 04:00:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fazC0-0000j6-31 for qemu-devel@nongnu.org; Thu, 05 Jul 2018 04:00:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:55842) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fazBz-0000g9-Qn for qemu-devel@nongnu.org; Thu, 05 Jul 2018 04:00:44 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w657sLE7024813 for ; Thu, 5 Jul 2018 04:00:42 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k1c6tq0be-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 05 Jul 2018 04:00:42 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Jul 2018 09:00:39 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 5 Jul 2018 09:00:36 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6580ZwC18415672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 5 Jul 2018 08:00:35 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CABFA4059; Thu, 5 Jul 2018 11:01:00 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22BF7A405F; Thu, 5 Jul 2018 11:00:59 +0100 (BST) Received: from localhost.in.ibm.com (unknown [9.122.208.47]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 5 Jul 2018 11:00:58 +0100 (BST) From: Balamuruhan S To: qemu-devel@nongnu.org Date: Thu, 5 Jul 2018 13:30:17 +0530 X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180705080017.31123-1-bala24@linux.vnet.ibm.com> References: <20180705080017.31123-1-bala24@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18070508-4275-0000-0000-000002955C02 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18070508-4276-0000-0000-0000379CE36A Message-Id: <20180705080017.31123-3-bala24@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-07-05_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=931 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807050095 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 2/2] tests: add precopy multifd migration with fd protocol X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Balamuruhan S , dgilbert@redhat.com, peterx@redhat.com, quintela@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds test for multifd migration feature with fd protocol. Signed-off-by: Balamuruhan S --- tests/migration-test.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/tests/migration-test.c b/tests/migration-test.c index e2434e70ea..29ede3810d 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -10,6 +10,7 @@ * */ +#include #include "qemu/osdep.h" #include "libqtest.h" @@ -202,6 +203,17 @@ static void read_blocktime(QTestState *who) qobject_unref(rsp); } +static void getfd(QTestState *who, const char *fdname, int fd) +{ + QDict *rsp; + gchar *cmd = g_strdup_printf("{ 'execute': 'getfd'," + "'arguments': { '%s': '%d'} }", fdname, fd); + rsp = wait_command(who, cmd); + g_assert(qdict_haskey(rsp, "return")); + g_free(cmd); + qobject_unref(rsp); +} + static void wait_for_migration_complete(QTestState *who) { while (true) { @@ -619,6 +631,50 @@ static void test_precopy_unix(void) g_free(uri); } +static void test_multifd_fd(void) +{ + int fd[2]; + + /* create pipe */ + if (pipe(fd) == -1) + g_test_message("Skipping test: Unable to create pipe"); + return; + + /* set uri in target with read fd */ + char *uri = g_strdup_printf("fd:%d", fd[0]); + QTestState *from, *to; + test_migrate_start(&from, &to, uri, false); + + /* Receive a write file descriptor for source using getfd */ + getfd(from, "srcfd", fd[1]); + + /* set multifd capability on source and target */ + migrate_set_capability(from, "x-multifd", "true"); + migrate_set_capability(to, "x-multifd", "true"); + + /* Wait for the first serial output from the source */ + wait_for_serial("src_serial"); + + /* perform migration */ + migrate(from, uri); + + wait_for_migration_pass(from); + + if (!got_stop) { + qtest_qmp_eventwait(from, "STOP"); + } + qtest_qmp_eventwait(to, "RESUME"); + + wait_for_serial("dest_serial"); + wait_for_migration_complete(from); + test_migrate_end(from, to, true); + g_free(uri); + + /* close the fds */ + close(fd[0]); + close(fd[1]); +} + static void test_multifd_unix(void) { char *uri = g_strdup_printf("unix:%s/migsocket", tmpfs); @@ -673,6 +729,7 @@ int main(int argc, char **argv) qtest_add_func("/migration/bad_dest", test_baddest); qtest_add_func("/migration/precopy/unix", test_precopy_unix); qtest_add_func("/migration/multifd/unix", test_multifd_unix); + qtest_add_func("/migration/multifd/fd", test_multifd_fd); ret = g_test_run();