From patchwork Thu Apr 7 17:45:28 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: 8775431 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C9239F36E for ; Thu, 7 Apr 2016 17:49:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7E7582024F for ; Thu, 7 Apr 2016 17:49:34 +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 B29A720204 for ; Thu, 7 Apr 2016 17:49:33 +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 1aoE0s-0008M3-4L; Thu, 07 Apr 2016 17:46:38 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aoE0q-0008L5-T9 for xen-devel@lists.xenproject.org; Thu, 07 Apr 2016 17:46:37 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id BD/52-02994-AFC96075; Thu, 07 Apr 2016 17:46:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXitHSDve7POWz hBtPWGFp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBlHVt5hLDjFVnFo0gnmBsalrF2MnBwSAv4S 61adZQGx2QR0JC7O3cnWxcjBISKgInF7rwFImFmgWOLrqj6wcmGBKIlVX/+BlbMAlcxf9xHM5 hVwkbi+7gkLxEhdiZO7N7GDjOEUcJXY9oYHJCwEVPKx4SsjRLmgxMmZEOXMApoSrdt/s0PY8h LNW2czQ9QrSvTPewB2jYQAt8TfbvsJjPyzkHTPQtI9C0n3AkbmVYzqxalFZalFuhZ6SUWZ6Rk luYmZObqGBsZ6uanFxYnpqTmJScV6yfm5mxiBwccABDsYL7Q7H2KU5GBSEuVd3sEWLsSXlJ9S mZFYnBFfVJqTWnyIUYaDQ0mC1wsYzEKCRanpqRVpmTnAOIBJS3DwKInwxoGkeYsLEnOLM9MhU qcYdTkW/Li9lkmIJS8/L1VKnPfGbKAiAZCijNI8uBGwmLzEKCslzMsIdJQQT0FqUW5mCar8K0 ZxDkYlYV57kFU8mXklcJteAR3BBHTEBX6wI0oSEVJSDYy+oi5lk+vuP/m218O/t3bVh1tffv0 /IyC9P2f2+v85fixZ3XlTkn4sLNjz2VM9x1lgmuFhfZPdv/112MNck7r2NZg/eLkskbn23Jvu yCPrv67dv5r/jcCJ7CPPtFc+eyhhWqHLZ/JZbplL0BeP7O/mUedaTixXnmm7oefinyk1/8+Zd Px5bSOhxFKckWioxVxUnAgA8hoO7cQCAAA= X-Env-Sender: prvs=898fe3ee9=roger.pau@citrix.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1460051192!26102191!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 8.28; banners=-,-,- X-VirusChecked: Checked Received: (qmail 59052 invoked from network); 7 Apr 2016 17:46:33 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-7.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 7 Apr 2016 17:46:33 -0000 X-IronPort-AV: E=Sophos;i="5.24,449,1454976000"; d="scan'208";a="352270220" From: Roger Pau Monne To: Date: Thu, 7 Apr 2016 19:45:28 +0200 Message-ID: <1460051129-20817-4-git-send-email-roger.pau@citrix.com> X-Mailer: git-send-email 2.6.4 (Apple Git-63) In-Reply-To: <1460051129-20817-1-git-send-email-roger.pau@citrix.com> References: <1460051129-20817-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 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é Cc: Ian Jackson Cc: Wei Liu Acked-by: Wei Liu --- tools/libxl/libxl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9d785a4..232e2c1 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, "HVM 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))