From patchwork Fri Apr 8 16:13:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 8784521 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B92C8C0553 for ; Fri, 8 Apr 2016 16:15:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8F98202DD for ; Fri, 8 Apr 2016 16:15:47 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 280AB2011D for ; Fri, 8 Apr 2016 16:15:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoZ2d-0006cq-Sf; Fri, 08 Apr 2016 16:13:51 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoZ2d-0006ak-2n for xen-devel@lists.xenproject.org; Fri, 08 Apr 2016 16:13:51 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 55/28-07120-EB8D7075; Fri, 08 Apr 2016 16:13:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXitHRDpO6+G+z hBtfOK1t83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnXHp9jLljHXrGj8yBLA+NP1i5GDg4JAX+J 8+cCuxg5OdgEdCQuzt3JBhIWEVCRuL3XACTMLFAs8XVVHyuILSwQK3H+4UdmEJsFqKTh9Ck2E JtXwEXi3ftpTCC2hICuxMndm9hBbE4BV4mDrQ/AeoWAas78vsQKUS8ocXLmExaI+ZoSrdt/s0 PY8hLNW2czQ9QrSvTPe8AGcSW3xN9u+wmM/LOQdM9C0j0LSfcCRuZVjOrFqUVlqUW6xnpJRZn pGSW5iZk5uoYGZnq5qcXFiempOYlJxXrJ+bmbGIHBxwAEOxg7/jkdYpTkYFIS5dU5xR4uxJeU n1KZkVicEV9UmpNafIhRhoNDSYL36HWgnGBRanpqRVpmDjAOYNISHDxKIrx7QNK8xQWJucWZ6 RCpU4y6HAt+3F7LJMSSl5+XKiXOewqkSACkKKM0D24ELCYvMcpKCfMyAh0lxFOQWpSbWYIq/4 pRnINRSZj3LsgUnsy8ErhNr4COYAI64gI/G8gRJYkIKakGxlI5u4VZ+3aJu+jJxfAU/F+myFV lPPOmm7vGA7tzcXHTmZuyFFde52tL+txmE/pZ5PhqoTU2MnGJTSeNFzvbrP73aR93ap/2W+9D gq16DSl11i7a6SKmEntbOfn8amKmByYfmBF5vPPb+XtHA95+0UpbYHXa0aNynpJM9G2B/slrT ir/ro1RYinOSDTUYi4qTgQA0EUl8MQCAAA= X-Env-Sender: prvs=89920a859=roger.pau@citrix.com X-Msg-Ref: server-8.tower-21.messagelabs.com!1460132023!8272430!3 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45653 invoked from network); 8 Apr 2016 16:13:50 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-8.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 8 Apr 2016 16:13:50 -0000 X-IronPort-AV: E=Sophos;i="5.24,454,1454976000"; d="scan'208";a="345838128" From: Roger Pau Monne To: Date: Fri, 8 Apr 2016 18:13:38 +0200 Message-ID: <1460132019-23719-4-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1460132019-23719-1-git-send-email-roger.pau@citrix.com> References: <1460132019-23719-1-git-send-email-roger.pau@citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Wei Liu , Ian Jackson , Roger Pau Monne Subject: [Xen-devel] [PATCH v2 3/4] libxl: only allow guests with a device model to use cd-{eject/insert} X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Roger Pau Monné Acked-by: Wei Liu --- Cc: Ian Jackson Cc: Wei Liu --- Changes since v1: - Remove HVM from the error message. --- tools/libxl/libxl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9d785a4..e6c3d11 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2909,6 +2909,12 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, goto out; } + if (dm_ver == LIBXL_DEVICE_MODEL_VERSION_NONE) { + LOG(ERROR, "Guests without a device model cannot use cd-insert"); + rc = ERROR_FAIL; + goto out; + } + disks = libxl_device_disk_list(ctx, domid, &num); for (i = 0; i < num; i++) { if (disks[i].is_cdrom && !strcmp(disk->vdev, disks[i].vdev))