From nobody Mon Feb 9 10:29:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1619194601; cv=none; d=zohomail.com; s=zohoarc; b=RPGMuc79xv9rZ4hJYOEnTKM6njkq6EDSah/MmmKUmu7s4QDuPKTPHWoxJkAE6K2o7oPkUkRj27yb6EIB1FkHPXH8Hgx/60hNfxRuYUI1GMb2bxAxThWe0XzQtZnUpdM4CUIgB9w9bErx0N9cyCohbl4s5KaKaIFde5FtAf/HGn8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619194601; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=p+SMQPUwQyUpr4VUjvhGHoQBX0DUPBVGt/Sl+5aj/sU=; b=F1JI8FBKiL/5dH9kgDEXaiR82O86t9l1gvO+tAFrLagn1vumLLaMPdBz+Eh2nqQpoWs6KTW4wH8mjbZpLd37u0XHUY8DJTRrdlbjPcA32+T7GvUUwm6U6du7lYv/20mMcWi83kGqsKQ/qmiXutinnjQe/mUiRM7uD8rsBh5o4EA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1619194601753413.6343379299192; Fri, 23 Apr 2021 09:16:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.116490.222380 (Exim 4.92) (envelope-from ) id 1lZyTb-0008Ki-M6; Fri, 23 Apr 2021 16:16:19 +0000 Received: by outflank-mailman (output) from mailman id 116490.222380; Fri, 23 Apr 2021 16:16:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZyTb-0008KR-IF; Fri, 23 Apr 2021 16:16:19 +0000 Received: by outflank-mailman (input) for mailman id 116490; Fri, 23 Apr 2021 16:16:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lZyTa-00082q-Gl for xen-devel@lists.xenproject.org; Fri, 23 Apr 2021 16:16:18 +0000 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 3e6bf307-89f6-4de9-bdfc-59e5a3de9c1a; Fri, 23 Apr 2021 16:16:05 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3e6bf307-89f6-4de9-bdfc-59e5a3de9c1a DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1619194565; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Gygj/Nak9hSpWoWROOHHTJ9LjxhWDQ/06rb6wnjdhUE=; b=Ot8oewyv79nC1P0zTJhLRtZsKlUTqhPAZTRcM4Mr+R2uVTAVvHiX0bj3 pRe53h6ChY2oTvIAxD2GIr2q/3I4zj0K9vhu89295gzwK/UfiD8Fok0gG cuRWQpLh4r/L234gOlLMK0GAE19dg/Xui9CdLE/Z3j1LF8+NO5cpSsR+i c=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: z/2hhoiwA5cKJsLlGK9/tD/q0N96IMJo3PCsZpF8PT7gKdu7nQ2uBJeTodjsW+Gh3Q+E7p9/UJ hY3OPLHfAmACvHXCgjhu+raJBAafNMn+nDPk8G/7Fn/dGaxoD4OhVhiPKnsFf5yml9xsFjIYI1 gRSHDf/3LeJNqFaDAF2p7RR+QKk6odVgZu5+Uv1Fc6hL3I7Lk8OtKVpszpLhW2E1duknXuy5/U 44LgaUDnHMmw3OpQj7UGhG44JONhE87ZBCa3UMH+1C4I/5THSZJ2FGtgNrsP0pfcP4kohqRter Orw= X-SBRS: 5.1 X-MesageID: 42290097 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:+qZ+da8YtjclBQLNrL5uk+FRcL1zdoIgy1knxilNYDRvWIixi9 2ukPMH1RX9lTYWXzUalcqdPbSbKEmwybdc2qNUGbu5RgHptC+TLI9k5Zb/2DGIIUfD38Zn/+ Nbf6B6YeeaMXFTh8z3+RT9Nt4mzsWO/qzAv5ak815GZ2hRGsJdxi1+DRuWFVAzYQFAC4YwGp b03Ls8mxOLf3MLYsOnQkQURuSrnayAqLvKQz4jQyQm5g6HkC+y5NfBfySw8x8CX1p0sNAf2E fflQiR3MSemtG9jiTRzmrCq6lR8eGRsudrIOyppowrJi73igCuDb4RFoGqmDwuuumg5BILvb D30nEdFv9+4X/QYW25yCGFs2aP7B8U53Dv0lOei3f4yPaJPQ4SMdZLho5Sb3Limigdlex8y6 5C0ia4sJdaHHr77UDAzuXITB1jmw6Ip2Mjm4co/hlieLYZAYUwkaUvuGduVLsQFiPz744qVM N0CtvH2fpQeVSGK1jEo2hG2rWXLzsONybDZnJHlt2e0jBQknw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0NlSHn7uy7MOyhDnxTyGna05wv/ w3SWUAKsJZijcji4Ur0i+9Dqzvy3hV7Wdj3Q== X-IronPort-AV: E=Sophos;i="5.82,246,1613451600"; d="scan'208";a="42290097" From: Anthony PERARD To: CC: Anthony PERARD , Ian Jackson , Wei Liu Subject: [XEN PATCH 4/8] libxl: Use -device for cd-rom drives Date: Fri, 23 Apr 2021 17:15:54 +0100 Message-ID: <20210423161558.224367-5-anthony.perard@citrix.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210423161558.224367-1-anthony.perard@citrix.com> References: <20210423161558.224367-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Content-Type: text/plain; charset="utf-8" This allows to set an `id` on the device instead of only the drive. We are going to need the `id` with the "eject" and "blockdev-change-media" QMP command as using `device` parameter on those is deprecated. (`device` is the `id` of the `-drive` on the command line). We set the same `id` on both -device and -drive as QEMU doesn't complain and we can then either do "eject id=3D$id" or "eject device=3D$id". Using "-drive + -device" instead of only "-drive" has been available since at least QEMU 0.15, and seems to be the preferred way as it separates the host part (-drive which describe the disk image location and format) from the guest part (-device which describe the emulated device). More information in qemu.git/docs/qdev-device-use.txt . Changing the command line during migration for the cdrom seems fine. Also the documentation about migration in QEMU explains that the device state ID is "been formed from a bus name and device address", so second IDE bus and first device address on bus is still thus and doesn't matter if written "-drive if=3Dide,index=3D2" or "-drive ide-cd,bus=3Dide.1,unit=3D0". See qemu.git/docs/devel/migration.rst . Signed-off-by: Anthony PERARD --- tools/libs/light/libxl_dm.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c index 0a0c1ef7c62e..5b01cf284163 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -1913,6 +1913,7 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, } =20 if (disks[i].is_cdrom) { + const char *drive_id; if (disk > 4) { LOGD(WARN, guest_domid, "Emulated CDROM can be only on= e of the first 4 disks.\n" "Disk %s will be available via PV drivers but not= as an " @@ -1920,13 +1921,22 @@ static int libxl__build_device_model_args_new(libxl= __gc *gc, disks[i].vdev); continue; } - drive =3D libxl__sprintf(gc, - "if=3Dide,index=3D%d,readonly=3Don,media=3Dcdrom,= id=3Dide-%i", - disk, dev_number); + + drive_id =3D GCSPRINTF("ide-%i", dev_number); + drive =3D GCSPRINTF("if=3Dnone,readonly=3Don,id=3D%s", dri= ve_id); =20 if (target_path) drive =3D libxl__sprintf(gc, "%s,file=3D%s,format=3D%s= ", drive, target_path, format); + + flexarray_vappend(dm_args, + "-drive", drive, + "-device", + GCSPRINTF("ide-cd,id=3D%s,drive=3D%s,bus=3Dide.%u,unit= =3D%u", + drive_id, drive_id, + disk / 2, disk % 2), + NULL); + continue; } else { /* * Explicit sd disks are passed through as is. --=20 Anthony PERARD