From nobody Sun Feb 8 18:43:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1553155929040692.5055569125485; Thu, 21 Mar 2019 01:12:09 -0700 (PDT) Received: from localhost ([127.0.0.1]:32955 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6so4-0003MH-2O for importer@patchew.org; Thu, 21 Mar 2019 04:12:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40862) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6sjp-0000Es-GY for qemu-devel@nongnu.org; Thu, 21 Mar 2019 04:07:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6sYl-00063R-Ua for qemu-devel@nongnu.org; Thu, 21 Mar 2019 03:56:21 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:40416) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6sYl-00060D-GW for qemu-devel@nongnu.org; Thu, 21 Mar 2019 03:56:19 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2L7reN6054896 for ; Thu, 21 Mar 2019 07:56:18 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2r8ssrpsdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 21 Mar 2019 07:56:18 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x2L7uH2D032522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 21 Mar 2019 07:56:17 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2L7uHY2005289 for ; Thu, 21 Mar 2019 07:56:17 GMT Received: from nir-ThinkPad-T470.oracle.com (/10.74.125.62) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 21 Mar 2019 00:56:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=PzhinLCSuiJbXlnJ4CO2bzO5V8Iie3fHk0v4mgM2CIM=; b=cEAio+JLI0krFF2ifDMnB15SUT/nD+Osn5Xza/Oefsq/xvfwiW1LqUi/xNkH9BREWFRX EFt0xQu8nXK2FVRdGReD2JCrHQqX1gXvT9ehN01gGA/H/8yuCXCxyCeiCFjEa0XBpZRV SYx9Z8jbwEWOl/az3QVxHjI7xlucB7qi8ePaFEM/E9RvrnpTXYkF+OA32Ga3j4m00GGA UXWMtnQDw9PdloTcSr4rkivSOvfLi1HJSSn0/6fWKZqM9ImHZPbUexKTjvgBpUcals8d lL0xMc7lrRwzjwelPgO/G80pncRbNz95/eV4Nk5+yEfcNxwWxFey0pqEFAtU5nSDUJI7 7g== From: Nir Weiner To: qemu-devel@nongnu.org Date: Thu, 21 Mar 2019 09:55:45 +0200 Message-Id: <20190321075545.14929-4-nir.weiner@oracle.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190321075545.14929-1-nir.weiner@oracle.com> References: <20190321075545.14929-1-nir.weiner@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9201 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903210058 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 156.151.31.85 Subject: [Qemu-devel] [PATCH 3/3] vhost-scsi: Allow user to enable migration 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: nir.weiner@oracle.com, liran.alon@oracle.com, bijan.mottahedeh@oracle.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Liran Alon Originally migration was not possible with vhost-scsi because as part of migration, the source host target SCSI device state needs to be saved and loaded into the destination host target SCSI device. This cannot be done by QEMU. As this can be handled either by external orchestrator or by having shared-storage (i.e. iSCSI), there is no reason to limit the orchestrator from being able to explictly specify it wish to enable migration even when VM have a vhost-scsi device. Reviewed-by: Nir Weiner Reviewed-by: Bijan Mottahedeh Signed-off-by: Liran Alon --- hw/scsi/vhost-scsi.c | 30 ++++++++++++++++++--------- include/hw/virtio/vhost-scsi-common.h | 1 + 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index eb0cf9e1312f..52d46a788e6c 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -199,13 +199,18 @@ static void vhost_scsi_realize(DeviceState *dev, Erro= r **errp) goto close_fd; } =20 - error_setg(&vsc->migration_blocker, - "vhost-scsi does not support migration"); - migrate_add_blocker(vsc->migration_blocker, &err); - if (err) { - error_propagate(errp, err); - error_free(vsc->migration_blocker); - goto close_fd; + if (!vsc->migratable) { + error_setg(&vsc->migration_blocker, + "vhost-scsi does not support migration in all cases." + "When external environment is supports it (Orchestrator mi= grates" + "target SCSI device state or use shared storage over netwo= rk)," + "set 'migratable' property to true to enable migration."); + migrate_add_blocker(vsc->migration_blocker, &err); + if (err) { + error_propagate(errp, err); + error_free(vsc->migration_blocker); + goto close_fd; + } } =20 vsc->dev.nvqs =3D VHOST_SCSI_VQ_NUM_FIXED + vs->conf.num_queues; @@ -230,7 +235,9 @@ static void vhost_scsi_realize(DeviceState *dev, Error = **errp) return; =20 free_vqs: - migrate_del_blocker(vsc->migration_blocker); + if (!vsc->migratable) { + migrate_del_blocker(vsc->migration_blocker); + } g_free(vsc->dev.vqs); close_fd: close(vhostfd); @@ -243,8 +250,10 @@ static void vhost_scsi_unrealize(DeviceState *dev, Err= or **errp) VHostSCSICommon *vsc =3D VHOST_SCSI_COMMON(dev); struct vhost_virtqueue *vqs =3D vsc->dev.vqs; =20 - migrate_del_blocker(vsc->migration_blocker); - error_free(vsc->migration_blocker); + if (!vsc->migratable) { + migrate_del_blocker(vsc->migration_blocker); + error_free(vsc->migration_blocker); + } =20 /* This will stop vhost backend. */ vhost_scsi_set_status(vdev, 0); @@ -268,6 +277,7 @@ static Property vhost_scsi_properties[] =3D { DEFINE_PROP_BIT64("t10_pi", VHostSCSICommon, host_features, VIRTIO_SCSI_F_T10_PI, false), + DEFINE_PROP_BOOL("migratable", VHostSCSICommon, migratable, false), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhos= t-scsi-common.h index 57fb1d87b51d..4eab767ee89f 100644 --- a/include/hw/virtio/vhost-scsi-common.h +++ b/include/hw/virtio/vhost-scsi-common.h @@ -36,6 +36,7 @@ typedef struct VHostSCSICommon { int target; int lun; uint64_t host_features; + bool migratable; } VHostSCSICommon; =20 int vhost_scsi_common_start(VHostSCSICommon *vsc); --=20 2.17.1