From nobody Mon Apr 29 03:53:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502802597625925.6908088727489; Tue, 15 Aug 2017 06:09:57 -0700 (PDT) Received: from localhost ([::1]:60362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbbY-0000Zp-8I for importer@patchew.org; Tue, 15 Aug 2017 09:09:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59123) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhba3-000843-FO for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:08:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhba2-0007cx-Kr for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:08:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57424) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhbZy-0007ZP-34; Tue, 15 Aug 2017 09:08:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34149445E9; Tue, 15 Aug 2017 13:08:17 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-61.pek2.redhat.com [10.72.12.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id C350319F01; Tue, 15 Aug 2017 13:08:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 34149445E9 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=famz@redhat.com From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 21:07:37 +0800 Message-Id: <20170815130740.31229-2-famz@redhat.com> In-Reply-To: <20170815130740.31229-1-famz@redhat.com> References: <20170815130740.31229-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Aug 2017 13:08:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 v2 1/4] stubs: Add vm state change handler stubs 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: Kevin Wolf , qemu-block@nongnu.org, Max Reitz , stefanha@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" They will be used by BlockBackend code in block-obj-y, which doesn't always get linked with common-obj-y. Add stubs to keep ld happy. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake --- stubs/Makefile.objs | 1 + stubs/change-state-handler.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 stubs/change-state-handler.c diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index f5b47bfd74..e69c217aff 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -19,6 +19,7 @@ stub-obj-y +=3D is-daemonized.o stub-obj-$(CONFIG_LINUX_AIO) +=3D linux-aio.o stub-obj-y +=3D machine-init-done.o stub-obj-y +=3D migr-blocker.o +stub-obj-y +=3D change-state-handler.o stub-obj-y +=3D monitor.o stub-obj-y +=3D notify-event.o stub-obj-y +=3D qtest.o diff --git a/stubs/change-state-handler.c b/stubs/change-state-handler.c new file mode 100644 index 0000000000..01b1c6986d --- /dev/null +++ b/stubs/change-state-handler.c @@ -0,0 +1,14 @@ +#include "qemu/osdep.h" +#include "qemu-common.h" +#include "sysemu/sysemu.h" + +VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler = *cb, + void *opaque) +{ + return NULL; +} + +void qemu_del_vm_change_state_handler(VMChangeStateEntry *e) +{ + /* Nothing to do. */ +} --=20 2.13.4 From nobody Mon Apr 29 03:53:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502802762670253.01227803893437; Tue, 15 Aug 2017 06:12:42 -0700 (PDT) Received: from localhost ([::1]:60455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbeD-0003G0-BF for importer@patchew.org; Tue, 15 Aug 2017 09:12:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbaE-0008Ba-GK for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:08:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhbaD-0007kD-Me for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:08:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43028) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhba9-0007hI-2j; Tue, 15 Aug 2017 09:08:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2493A2C9706; Tue, 15 Aug 2017 13:08:28 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-61.pek2.redhat.com [10.72.12.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id A74DB6135E; Tue, 15 Aug 2017 13:08:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2493A2C9706 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=famz@redhat.com From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 21:07:38 +0800 Message-Id: <20170815130740.31229-3-famz@redhat.com> In-Reply-To: <20170815130740.31229-1-famz@redhat.com> References: <20170815130740.31229-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 15 Aug 2017 13:08:28 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 v2 2/4] nbd: Fix order of bdrv_set_perm and bdrv_invalidate_cache 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: Kevin Wolf , qemu-block@nongnu.org, Max Reitz , stefanha@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Kevin Wolf The "inactive" state of BDS affects whether the permissions can be granted, we must call bdrv_invalidate_cache before bdrv_set_perm to support "-incoming defer" case. Reported-by: Christian Ehrhardt Signed-off-by: Fam Zheng Reviewed-by: Eric Blake --- nbd/server.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/nbd/server.c b/nbd/server.c index 82a78bf439..b68b6fb535 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -1045,11 +1045,22 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off= _t dev_offset, off_t size, bool writethrough, BlockBackend *on_eject_blk, Error **errp) { + AioContext *ctx; BlockBackend *blk; NBDExport *exp =3D g_malloc0(sizeof(NBDExport)); uint64_t perm; int ret; =20 + /* + * NBD exports are used for non-shared storage migration. Make sure + * that BDRV_O_INACTIVE is cleared and the image is ready for write + * access since the export could be available before migration handove= r. + */ + ctx =3D bdrv_get_aio_context(bs); + aio_context_acquire(ctx); + bdrv_invalidate_cache(bs, NULL); + aio_context_release(ctx); + /* Don't allow resize while the NBD server is running, otherwise we do= n't * care what happens with the node. */ perm =3D BLK_PERM_CONSISTENT_READ; @@ -1087,15 +1098,6 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_= t dev_offset, off_t size, exp->eject_notifier.notify =3D nbd_eject_notifier; blk_add_remove_bs_notifier(on_eject_blk, &exp->eject_notifier); } - - /* - * NBD exports are used for non-shared storage migration. Make sure - * that BDRV_O_INACTIVE is cleared and the image is ready for write - * access since the export could be available before migration handove= r. - */ - aio_context_acquire(exp->ctx); - blk_invalidate_cache(blk, NULL); - aio_context_release(exp->ctx); return exp; =20 fail: --=20 2.13.4 From nobody Mon Apr 29 03:53:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502802678228534.3116484542652; Tue, 15 Aug 2017 06:11:18 -0700 (PDT) Received: from localhost ([::1]:60377 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbcq-0001rA-Ln for importer@patchew.org; Tue, 15 Aug 2017 09:11:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbat-0000Mf-Cc for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:09:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhbas-000808-G5 for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:09:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46186) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhban-0007xx-N2; Tue, 15 Aug 2017 09:09:09 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4B41C047B75; Tue, 15 Aug 2017 13:09:08 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-61.pek2.redhat.com [10.72.12.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3F5C5B810; Tue, 15 Aug 2017 13:08:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C4B41C047B75 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=famz@redhat.com From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 21:07:39 +0800 Message-Id: <20170815130740.31229-4-famz@redhat.com> In-Reply-To: <20170815130740.31229-1-famz@redhat.com> References: <20170815130740.31229-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 15 Aug 2017 13:09:08 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 v2 3/4] block-backend: Defer shared_perm tightening migration completion 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: Kevin Wolf , qemu-block@nongnu.org, Max Reitz , stefanha@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As in the case of nbd_export_new(), bdrv_invalidate_cache() can be called when migration is still in progress. In this case we are not ready to tighten the shared permissions fenced by blk->disable_perm. Defer to a VM state change handler. Signed-off-by: Fam Zheng Reviewed-by: Eric Blake --- block/block-backend.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 968438c149..e9798e897d 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -20,6 +20,7 @@ #include "qapi-event.h" #include "qemu/id.h" #include "trace.h" +#include "migration/misc.h" =20 /* Number of coroutines to reserve per attached device model */ #define COROUTINE_POOL_RESERVATION 64 @@ -68,6 +69,7 @@ struct BlockBackend { NotifierList remove_bs_notifiers, insert_bs_notifiers; =20 int quiesce_counter; + VMChangeStateEntry *vmsh; }; =20 typedef struct BlockBackendAIOCB { @@ -129,6 +131,23 @@ static const char *blk_root_get_name(BdrvChild *child) return blk_name(child->opaque); } =20 +static void blk_vm_state_changed(void *opaque, int running, RunState state) +{ + Error *local_err =3D NULL; + BlockBackend *blk =3D opaque; + + if (state =3D=3D RUN_STATE_INMIGRATE) { + return; + } + + qemu_del_vm_change_state_handler(blk->vmsh); + blk->vmsh =3D NULL; + blk_set_perm(blk, blk->perm, blk->shared_perm, &local_err); + if (local_err) { + error_report_err(local_err); + } +} + /* * Notifies the user of the BlockBackend that migration has completed. qdev * devices can tighten their permissions in response (specifically revoke @@ -147,6 +166,24 @@ static void blk_root_activate(BdrvChild *child, Error = **errp) =20 blk->disable_perm =3D false; =20 + blk_set_perm(blk, blk->perm, BLK_PERM_ALL, &local_err); + if (local_err) { + error_propagate(errp, local_err); + blk->disable_perm =3D true; + return; + } + + if (runstate_check(RUN_STATE_INMIGRATE)) { + /* Activation can happen when migration process is still active, f= or + * example when nbd_server_add is called during non-shared storage + * migration. Defer the shared_perm update to migration completion= . */ + if (!blk->vmsh) { + blk->vmsh =3D qemu_add_vm_change_state_handler(blk_vm_state_ch= anged, + blk); + } + return; + } + blk_set_perm(blk, blk->perm, blk->shared_perm, &local_err); if (local_err) { error_propagate(errp, local_err); @@ -291,6 +328,10 @@ static void blk_delete(BlockBackend *blk) if (blk->root) { blk_remove_bs(blk); } + if (blk->vmsh) { + qemu_del_vm_change_state_handler(blk->vmsh); + blk->vmsh =3D NULL; + } assert(QLIST_EMPTY(&blk->remove_bs_notifiers.notifiers)); assert(QLIST_EMPTY(&blk->insert_bs_notifiers.notifiers)); QTAILQ_REMOVE(&block_backends, blk, link); --=20 2.13.4 From nobody Mon Apr 29 03:53:20 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1502802705295719.3116268172137; Tue, 15 Aug 2017 06:11:45 -0700 (PDT) Received: from localhost ([::1]:60386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbdH-0002Gw-KA for importer@patchew.org; Tue, 15 Aug 2017 09:11:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhbbC-0000dk-EF for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:09:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhbb9-00088K-1G for qemu-devel@nongnu.org; Tue, 15 Aug 2017 09:09:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37686) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhbb3-000861-S3; Tue, 15 Aug 2017 09:09:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9F0A40232; Tue, 15 Aug 2017 13:09:24 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-61.pek2.redhat.com [10.72.12.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 746B519CBF; Tue, 15 Aug 2017 13:09:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D9F0A40232 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=famz@redhat.com From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 15 Aug 2017 21:07:40 +0800 Message-Id: <20170815130740.31229-5-famz@redhat.com> In-Reply-To: <20170815130740.31229-1-famz@redhat.com> References: <20170815130740.31229-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 15 Aug 2017 13:09:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH for-2.10 v2 4/4] iotests: Add non-shared storage migration case 192 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: Kevin Wolf , qemu-block@nongnu.org, Max Reitz , stefanha@redhat.com, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng Reviewed-by: Eric Blake Tested-by: Eric Blake --- tests/qemu-iotests/192 | 63 ++++++++++++++++++++++++++++++++++++++++++= ++++ tests/qemu-iotests/192.out | 7 ++++++ tests/qemu-iotests/group | 1 + 3 files changed, 71 insertions(+) create mode 100755 tests/qemu-iotests/192 create mode 100644 tests/qemu-iotests/192.out diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192 new file mode 100755 index 0000000000..b50a2c0c8e --- /dev/null +++ b/tests/qemu-iotests/192 @@ -0,0 +1,63 @@ +#!/bin/bash +# +# Test NBD export with -incoming (non-shared storage migration use case fr= om +# libvirt) +# +# Copyright (C) 2017 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dfamz@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +here=3D`pwd` +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt generic +_supported_proto file +_supported_os Linux + +if [ "$QEMU_DEFAULT_MACHINE" !=3D "pc" ]; then + _notrun "Requires a PC machine" +fi + +size=3D64M +_make_test_img $size + +{ +echo "nbd_server_start unix:$TEST_DIR/nbd" +echo "nbd_server_add -w drive0" +echo "q" +} | $QEMU -nodefaults -display none -monitor stdio \ + -drive format=3D$IMGFMT,file=3D$TEST_IMG,if=3Dide,id=3Ddrive0 \ + -incoming defer 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 diff --git a/tests/qemu-iotests/192.out b/tests/qemu-iotests/192.out new file mode 100644 index 0000000000..1e0be4c4d7 --- /dev/null +++ b/tests/qemu-iotests/192.out @@ -0,0 +1,7 @@ +QA output created by 192 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 +QEMU X.Y.Z monitor - type 'help' for more information +(qemu) nbd_server_start unix:TEST_DIR/nbd +(qemu) nbd_server_add -w drive0 +(qemu) q +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 1848077932..afbdc427ea 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -186,3 +186,4 @@ 188 rw auto quick 189 rw auto 190 rw auto quick +192 rw auto quick --=20 2.13.4