From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353571; cv=none; d=zohomail.com; s=zohoarc; b=dEVw60HJum0Y+ZID/Zh13apymLy+rw9chMxfUiEalpzSYEatz2qep1RKqr0Ae4cQ0xByX9YTGBbDmJGQrO6+MvlaxxdwtUG9ibran3fdLMmILDSNKza1IxxwM42sZ1IgnBilijtF5FJ8VKpfz7JEJBhBVYcF80Td+1wXBmiJNbE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353571; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0108BU1I+kzPb9saqVvkbOMJcKsP/JB4eyqURMbjFC4=; b=kCqYZVJz08buJ5+2EX/h5ZRABDZiqywE8w1PKgW0X3zzC7yF0GEa1PGakCzilo2sFoT71l7jk5iSkez5P1EHDUawzig1jiOUZQLOHjZwpj/cs07umZA6LfRogX8ai7T0RGrRZ5bZ4F0gwlJAN82Ku84uhmSx0zroByil9KohBZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582353571102472.1049407732256; Fri, 21 Feb 2020 22:39:31 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-446-ceJhQzVgPFCmy_ovAmSZiQ-1; Sat, 22 Feb 2020 01:39:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D32C8017CC; Sat, 22 Feb 2020 06:39:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 249265C105; Sat, 22 Feb 2020 06:39:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B4B6918089CE; Sat, 22 Feb 2020 06:39:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dI9B021628 for ; Sat, 22 Feb 2020 01:39:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4D43C2166B2E; Sat, 22 Feb 2020 06:39:18 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 489222166B2B for ; Sat, 22 Feb 2020 06:39:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 652ED185A78E for ; Sat, 22 Feb 2020 06:39:16 +0000 (UTC) Received: from mail-yw1-f68.google.com (mail-yw1-f68.google.com [209.85.161.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-FEIuoyroPC-qeA1Ia9l14Q-1; Sat, 22 Feb 2020 01:39:14 -0500 Received: by mail-yw1-f68.google.com with SMTP id 192so2653402ywy.0 for ; Fri, 21 Feb 2020 22:39:13 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353569; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0108BU1I+kzPb9saqVvkbOMJcKsP/JB4eyqURMbjFC4=; b=TaWMn+NAmHp6+kOXJHMqYOCYHASlU5BHyhtzjQoeNzAQVXH4KVrpezF5UJ2TqS2juCNddm UYUPfnaEbUCw9LScICO131m78fMK1AVrXMM+/xQShtjCbhWzW+605c6i6ce37VR0oBEMkb GYn+1F++wZAbynyHexwvF7PdzV6utIc= X-MC-Unique: ceJhQzVgPFCmy_ovAmSZiQ-1 X-MC-Unique: FEIuoyroPC-qeA1Ia9l14Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4lt9iEoxZecZ2N8aoMjmFGt7QFigp9OGh1jQX17pNA4=; b=tyPQEkjETWQzpthf4uHLQCrnGoORpRm7KyG5AQgpHiIo0IiO/ZesDeR9AZFcsPIrLI Zsr+knxvG/cnkcFRoIGO8byNIkj1bTemqmWGkOqhLNUmzxsiqcHQB8m7A5D24uEIEXQD K51Zl4Oopu1Sa9vy8/CsrrlpyEnZI6xuxoRM7gcfX7BeWb+AJckIoxqcrZgoTEAtqeQJ pyiJg0vPRSAkIxJPJ4utOguCo3cuiKd2d5tkVs3npaTWQyJjXlrPvahG/XC2fRQSgT3c c8BKcqvmoAbKtzGeoMIQ4tUDGFZj1sRfLkdmZA+HzxIf4HBQw18RwfyGc8T8i+yyQ5uY l7YQ== X-Gm-Message-State: APjAAAW/eqt35w7ZrDoJ0fr7FSWaAwb7nh3JuzB+yboVii3rSfGk+X48 /YDlDNm31vxPyNIaZuwcHa9HzPMoGTwvStdgldHDPndPQkyHrAhB8KUFMU68KtvoBfT8+x4jGev TK/BEeNhORJffeA9LvFfI/m7kB48mozvw2a96Dw833g7MLs9YzZ8fb0thdLwbiOwtfKo= X-Google-Smtp-Source: APXvYqzmc0hzxtTauEoERBXiB1/v4IAqGDD97GRDxUvNRlKZ/Il+uiWsvArxHOkUbGvz3ZqKn3nV5g== X-Received: by 2002:a25:ca8d:: with SMTP id a135mr41096375ybg.143.1582353553390; Fri, 21 Feb 2020 22:39:13 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 01/16] Fix build errors on FreeBSD Date: Sat, 22 Feb 2020 01:38:40 -0500 Message-Id: <20200222063855.89637-2-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dI9B021628 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Don't free the file string until after it has been used to print the error message. I was seeing `undefined symbol: rpl_ioctl` so followed the example set by 05a38d4c4ac035ca5dac0f00ce641a8f9b087831 Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_process.c | 1 - src/conf/virnetworkobj.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 519604f898..14f718403d 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include =20 diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index 299cdba52d..1ec1585d1c 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -1894,13 +1894,12 @@ virNetworkObjLoadAllPorts(virNetworkObjPtr net, file =3D g_strdup_printf("%s/%s.xml", dir, de->d_name); =20 portdef =3D virNetworkPortDefParseFile(file); - VIR_FREE(file); - file =3D NULL; - if (!portdef) { VIR_WARN("Cannot parse port %s", file); + VIR_FREE(file); continue; } + VIR_FREE(file); =20 virUUIDFormat(portdef->uuid, uuidstr); if (virHashAddEntry(net->ports, uuidstr, portdef) < 0) --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353579; cv=none; d=zohomail.com; s=zohoarc; b=WLnPgqLEeuelJgw5S+QGZkCuG+nD8OwyDc8SOn6Ch0Z+PcCDxaZWu9qO/aswKKo9y9gw3zSQ4tXn6ZqFSBwRyzwZfeQIp7u+b5Gv8ep/nUod2yTW+cdY9RjBZkaHT0NL+s36HiXV8ggFEZQNUC7nPwVNYfau69eN+qgj2HQR6bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353579; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AhmVLnmRZE4FOZMaAqZDXuebmHfimQD2moBANZuynuk=; b=Ad1wEmzDnecmPoNr/CsD3vxsKsjEKXbnOT69NinDFnYT/iJKGOwmQENyLy1XLbZJiJd3KuxOFW1MvDPtlx+86c4s4NAcWWTrYW+79Mc73GW1hCWKSzW/MJXvGK/XvxHkKaYTnWvkd17kcbCXe8hsejdt3nOv5V5zeZNKZOWD0sE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353579097934.1703744389328; Fri, 21 Feb 2020 22:39:39 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-kH3DK90rMm6nZi45qekwCA-1; Sat, 22 Feb 2020 01:39:35 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D36C13E6; Sat, 22 Feb 2020 06:39:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAF1690786; Sat, 22 Feb 2020 06:39:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 968DC860D1; Sat, 22 Feb 2020 06:39:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dKVr021637 for ; Sat, 22 Feb 2020 01:39:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id C255D1032530; Sat, 22 Feb 2020 06:39:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BCF551032523 for ; Sat, 22 Feb 2020 06:39:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F0E9185A78E for ; Sat, 22 Feb 2020 06:39:20 +0000 (UTC) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-s9oCqqiqOseoVsMOWppzXw-1; Sat, 22 Feb 2020 01:39:18 -0500 Received: by mail-yw1-f65.google.com with SMTP id n184so2640885ywc.3 for ; Fri, 21 Feb 2020 22:39:17 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353578; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AhmVLnmRZE4FOZMaAqZDXuebmHfimQD2moBANZuynuk=; b=gVamYZ2ANaH9oaHu3LagpPGpQfZ67JIQ522jidtrXVabPHxKG0GJFSm0iiDp2qBoXRXWlR /msES81wpWH98cZbopiMiXFI2vlOfARrs5lXdQZ69vG+zM2TP7HRyqpyiBzeLYLFksAB25 0wriU+iYmEZdQawCv1smTYcnpwx218I= X-MC-Unique: kH3DK90rMm6nZi45qekwCA-1 X-MC-Unique: s9oCqqiqOseoVsMOWppzXw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+ddWKnqhqTqiGr0ekondg9Tj3XvE7EST/xRFrg/NMzc=; b=AlTqx1T1E8M4Qr2mSSFMlY3vbbqP2o4HTBAQiPu9cM2IfFKtEVFOEaFKe0xUWio05v 7wKjkrCsbID2WdkD3nh6Y9KMcCy+TTS2d2ui+t/DM69bY262u6fA+QLn/6YyzbaSpHMp 0EzLi07Tl6NX67mm5CR91Ty/u+6S4ROgTUGtmjqEcFpM9R2voSMJC2ib67+FlHRLo33V zbtjIMvUZnW23MNfpEtIY1EuUOsujS8DXNrgYzP2CIR5FiFJzCzsrQNlhLIgvzvbnwVw M6v/oxNe4gOKTz29cJ4pRaw7vFUs1pHGpxzVzZUl4V8qzivrdds4gtjvGWto8Z1fK2JS RdAQ== X-Gm-Message-State: APjAAAVftJ0SpdaWgBumIhPe4CiXjjiUbibejLBGOALNQgQmFr2+W+XB KOnl+b1y46K0PfmKN3suimXFPaugBXox8acEYiUWywzj2+Rv1h2gzdVxwy2HhoXVFkXaL5t1fKv UEMgSY+0kVbYnA/aZ+8crTb7w7bb0NM8vfIFcCzJxBfc1nYV6GjiuuVFHyV7/sfIxPBc= X-Google-Smtp-Source: APXvYqx2Hc6RZEHOx/niJZlpb8RYt33rPIRb2bEaHqc84vg5kXBuBtE8qq9r6ocCbulJdeic/s0PeQ== X-Received: by 2002:a25:dcc2:: with SMTP id y185mr36857849ybe.130.1582353557100; Fri, 21 Feb 2020 22:39:17 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 02/16] Simplify bhyve driver caps helpers Date: Sat, 22 Feb 2020 01:38:41 -0500 Message-Id: <20200222063855.89637-3-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dKVr021637 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_command.c | 40 +++++++++++++++++++-------------------- src/bhyve/bhyve_command.h | 4 ++-- src/bhyve/bhyve_driver.c | 21 +++++++++----------- src/bhyve/bhyve_driver.h | 4 ++-- src/bhyve/bhyve_process.c | 8 +++----- tests/bhyvexml2argvtest.c | 4 ++-- 6 files changed, 37 insertions(+), 44 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 2df7b60115..a1078d1460 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -44,7 +44,7 @@ VIR_LOG_INIT("bhyve.bhyve_command"); =20 static int -bhyveBuildNetArgStr(virConnectPtr conn, +bhyveBuildNetArgStr(bhyveConnPtr driver, const virDomainDef *def, virDomainNetDefPtr net, virCommandPtr cmd, @@ -60,7 +60,7 @@ bhyveBuildNetArgStr(virConnectPtr conn, if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_VIRTIO) { nic_model =3D g_strdup("virtio-net"); } else if (net->model =3D=3D VIR_DOMAIN_NET_MODEL_E1000) { - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_NET_E1000) !=3D 0) { + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_NET_E1000) !=3D 0= ) { nic_model =3D g_strdup("e1000"); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -167,7 +167,7 @@ bhyveBuildConsoleArgStr(const virDomainDef *def, virCom= mandPtr cmd) static int bhyveBuildAHCIControllerArgStr(const virDomainDef *def, virDomainControllerDefPtr controller, - virConnectPtr conn, + bhyveConnPtr driver, virCommandPtr cmd) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; @@ -208,13 +208,13 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *de= f, =20 switch (disk->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_AHCI32SLOT)) + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_AHCI32SLOT)) virBufferAsprintf(&device, ",hd:%s", disk_source); else virBufferAsprintf(&device, "-hd,%s", disk_source); break; case VIR_DOMAIN_DISK_DEVICE_CDROM: - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_AHCI32SLOT)) + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_AHCI32SLOT)) virBufferAsprintf(&device, ",cd:%s", disk_source); else virBufferAsprintf(&device, "-cd,%s", disk_source); @@ -323,7 +323,7 @@ static int bhyveBuildGraphicsArgStr(const virDomainDef *def, virDomainGraphicsDefPtr graphics, virDomainVideoDefPtr video, - virConnectPtr conn, + bhyveConnPtr driver, virCommandPtr cmd, bool dryRun) { @@ -332,9 +332,7 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, bool escapeAddr; unsigned short port; =20 - bhyveConnPtr driver =3D conn->privateData; - - if (!(bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) || + if (!(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_LPC_BOOTROM) || def->os.bootloader || !def->os.loader) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -343,7 +341,7 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, return -1; } =20 - if (!(bhyveDriverGetCaps(conn) & BHYVE_CAP_FBUF)) { + if (!(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_FBUF)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Bhyve version does not support framebuffer")); return -1; @@ -434,7 +432,7 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, } =20 virCommandPtr -virBhyveProcessBuildBhyveCmd(virConnectPtr conn, +virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def, bool dryRun) { /* @@ -467,7 +465,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, goto error; } =20 - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_CPUTOPOLOGY) !=3D 0) { + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_CPUTOPOLOGY) !=3D= 0) { virCommandAddArgFormat(cmd, "cpus=3D%d,sockets=3D%d,cores=3D%d= ,threads=3D%d", nvcpus, def->cpu->sockets, @@ -506,7 +504,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, /* used by default in bhyve */ break; case VIR_DOMAIN_CLOCK_OFFSET_UTC: - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_RTC_UTC) !=3D 0) { + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_RTC_UTC) !=3D 0) { virCommandAddArg(cmd, "-u"); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -540,7 +538,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, =20 if (def->os.bootloader =3D=3D NULL && def->os.loader) { - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM)) { + if ((bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_LPC_BOOTROM)) { virCommandAddArg(cmd, "-l"); virCommandAddArgFormat(cmd, "bootrom,%s", def->os.loader->path= ); } else { @@ -563,7 +561,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, } break; case VIR_DOMAIN_CONTROLLER_TYPE_SATA: - if (bhyveBuildAHCIControllerArgStr(def, controller, conn, = cmd) < 0) + if (bhyveBuildAHCIControllerArgStr(def, controller, driver= , cmd) < 0) goto error; break; case VIR_DOMAIN_CONTROLLER_TYPE_USB: @@ -580,7 +578,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, } for (i =3D 0; i < def->nnets; i++) { virDomainNetDefPtr net =3D def->nets[i]; - if (bhyveBuildNetArgStr(conn, def, net, cmd, dryRun) < 0) + if (bhyveBuildNetArgStr(driver, def, net, cmd, dryRun) < 0) goto error; } for (i =3D 0; i < def->ndisks; i++) { @@ -604,7 +602,7 @@ virBhyveProcessBuildBhyveCmd(virConnectPtr conn, if (def->ngraphics && def->nvideos) { if (def->ngraphics =3D=3D 1 && def->nvideos =3D=3D 1) { if (bhyveBuildGraphicsArgStr(def, def->graphics[0], def->video= s[0], - conn, cmd, dryRun) < 0) + driver, cmd, dryRun) < 0) goto error; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -747,7 +745,7 @@ virBhyveFormatGrubDevice(virBufferPtr devicemap, virDom= ainDiskDefPtr def) =20 static virCommandPtr virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def, - virConnectPtr conn, + bhyveConnPtr driver, const char *devmap_file, char **devicesmap_out) { @@ -830,7 +828,7 @@ virBhyveProcessBuildGrubbhyveCmd(virDomainDefPtr def, virCommandAddArgFormat(cmd, "%llu", VIR_DIV_UP(virDomainDefGetMemoryInitial(def), 1= 024)); =20 - if ((bhyveDriverGetGrubCaps(conn) & BHYVE_GRUB_CAP_CONSDEV) !=3D 0 && + if ((bhyveDriverGetGrubCaps(driver) & BHYVE_GRUB_CAP_CONSDEV) !=3D 0 && def->nserials > 0) { virDomainChrDefPtr chr; =20 @@ -939,7 +937,7 @@ virBhyveGetBootDisk(virDomainDefPtr def) } =20 virCommandPtr -virBhyveProcessBuildLoadCmd(virConnectPtr conn, virDomainDefPtr def, +virBhyveProcessBuildLoadCmd(bhyveConnPtr driver, virDomainDefPtr def, const char *devmap_file, char **devicesmap_out) { virDomainDiskDefPtr disk =3D NULL; @@ -952,7 +950,7 @@ virBhyveProcessBuildLoadCmd(virConnectPtr conn, virDoma= inDefPtr def, =20 return virBhyveProcessBuildBhyveloadCmd(def, disk); } else if (strstr(def->os.bootloader, "grub-bhyve") !=3D NULL) { - return virBhyveProcessBuildGrubbhyveCmd(def, conn, devmap_file, + return virBhyveProcessBuildGrubbhyveCmd(def, driver, devmap_file, devicesmap_out); } else { return virBhyveProcessBuildCustomLoaderCmd(def); diff --git a/src/bhyve/bhyve_command.h b/src/bhyve/bhyve_command.h index 8c39f4eb2f..5a934c4883 100644 --- a/src/bhyve/bhyve_command.h +++ b/src/bhyve/bhyve_command.h @@ -29,7 +29,7 @@ =20 #define BHYVE_CONFIG_FORMAT_ARGV "bhyve-argv" =20 -virCommandPtr virBhyveProcessBuildBhyveCmd(virConnectPtr conn, +virCommandPtr virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def, bool dryRun); =20 @@ -38,5 +38,5 @@ virBhyveProcessBuildDestroyCmd(bhyveConnPtr driver, virDomainDefPtr def); =20 virCommandPtr -virBhyveProcessBuildLoadCmd(virConnectPtr conn, virDomainDefPtr def, +virBhyveProcessBuildLoadCmd(bhyveConnPtr driver, virDomainDefPtr def, const char *devmap_file, char **devicesmap_out= ); diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 713301399e..365a3777a0 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -710,22 +710,22 @@ bhyveConnectDomainXMLToNative(virConnectPtr conn, goto cleanup; } =20 - if ((bhyveDriverGetCaps(conn) & BHYVE_CAP_LPC_BOOTROM) =3D=3D 0) { + if ((bhyveDriverGetBhyveCaps(privconn) & BHYVE_CAP_LPC_BOOTROM) = =3D=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Installed bhyve binary does not support " "bootrom")); goto cleanup; } } else { - if (!(loadcmd =3D virBhyveProcessBuildLoadCmd(conn, def, "", - NULL))) + if (!(loadcmd =3D virBhyveProcessBuildLoadCmd(privconn, def, + "", NULL))) goto cleanup; =20 virBufferAdd(&buf, virCommandToString(loadcmd, false), -1); virBufferAddChar(&buf, '\n'); } =20 - if (!(cmd =3D virBhyveProcessBuildBhyveCmd(conn, def, true))) + if (!(cmd =3D virBhyveProcessBuildBhyveCmd(privconn, def, true))) goto cleanup; =20 virBufferAdd(&buf, virCommandToString(cmd, false), -1); @@ -1282,20 +1282,16 @@ bhyveStateInitialize(bool privileged, } =20 unsigned -bhyveDriverGetCaps(virConnectPtr conn) +bhyveDriverGetBhyveCaps(bhyveConnPtr driver) { - bhyveConnPtr driver =3D conn->privateData; - if (driver !=3D NULL) return driver->bhyvecaps; return 0; } =20 unsigned -bhyveDriverGetGrubCaps(virConnectPtr conn) +bhyveDriverGetGrubCaps(bhyveConnPtr driver) { - bhyveConnPtr driver =3D conn->privateData; - if (driver !=3D NULL) return driver->grubcaps; return 0; @@ -1543,7 +1539,7 @@ bhyveConnectDomainXMLFromNative(virConnectPtr conn, char *xml =3D NULL; virDomainDefPtr def =3D NULL; bhyveConnPtr privconn =3D conn->privateData; - unsigned caps =3D bhyveDriverGetCaps(conn); + unsigned bhyveCaps =3D bhyveDriverGetBhyveCaps(privconn); =20 virCheckFlags(0, NULL); =20 @@ -1556,7 +1552,8 @@ bhyveConnectDomainXMLFromNative(virConnectPtr conn, goto cleanup; } =20 - def =3D bhyveParseCommandLineString(nativeConfig, caps, privconn->xmlo= pt); + def =3D bhyveParseCommandLineString(nativeConfig, bhyveCaps, + privconn->xmlopt); if (def =3D=3D NULL) goto cleanup; =20 diff --git a/src/bhyve/bhyve_driver.h b/src/bhyve/bhyve_driver.h index 98e75039a3..75a63e0233 100644 --- a/src/bhyve/bhyve_driver.h +++ b/src/bhyve/bhyve_driver.h @@ -25,8 +25,8 @@ =20 int bhyveRegister(void); =20 -unsigned bhyveDriverGetCaps(virConnectPtr conn); +unsigned bhyveDriverGetBhyveCaps(bhyveConnPtr driver); =20 -unsigned bhyveDriverGetGrubCaps(virConnectPtr conn); +unsigned bhyveDriverGetGrubCaps(bhyveConnPtr driver); =20 virCapsPtr bhyveDriverGetCapabilities(bhyveConnPtr driver); diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 14f718403d..2ea8db3b55 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -140,9 +140,7 @@ virBhyveProcessStart(virConnectPtr conn, goto cleanup; =20 /* Call bhyve to start the VM */ - if (!(cmd =3D virBhyveProcessBuildBhyveCmd(conn, - vm->def, - false))) + if (!(cmd =3D virBhyveProcessBuildBhyveCmd(driver, vm->def, false))) goto cleanup; =20 virCommandSetOutputFD(cmd, &logfd); @@ -158,8 +156,8 @@ virBhyveProcessStart(virConnectPtr conn, =20 virBhyveFormatDevMapFile(vm->def->name, &devmap_file); =20 - if (!(load_cmd =3D virBhyveProcessBuildLoadCmd(conn, vm->def, devm= ap_file, - &devicemap))) + if (!(load_cmd =3D virBhyveProcessBuildLoadCmd(driver, vm->def, + devmap_file, &devicem= ap))) goto cleanup; virCommandSetOutputFD(load_cmd, &logfd); virCommandSetErrorFD(load_cmd, &logfd); diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 3c9c61f024..9e7eb218b8 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -51,11 +51,11 @@ static int testCompareXMLToArgvFiles(const char *xml, =20 conn->privateData =3D &driver; =20 - cmd =3D virBhyveProcessBuildBhyveCmd(conn, vmdef, false); + cmd =3D virBhyveProcessBuildBhyveCmd(&driver, vmdef, false); if (vmdef->os.loader) ldcmd =3D virCommandNew("dummy"); else - ldcmd =3D virBhyveProcessBuildLoadCmd(conn, vmdef, "", + ldcmd =3D virBhyveProcessBuildLoadCmd(&driver, vmdef, "", &actualdm); =20 if ((cmd =3D=3D NULL) || (ldcmd =3D=3D NULL)) { --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353607; cv=none; d=zohomail.com; s=zohoarc; b=EC01UOP7jJSf1i7ma6f6OpoA55TWlHCqDTScQyXffhHvpQ4Mp9fcmOgz1P1ECo/TOKmPp8Ud9GrBGapU2dmRPQHvOQFhPZ6J5UnZJQftctuqto5DlM1C8pq+Z3CPwoCgJyFXetoEErt7OwY7w3mbY2euW7c+JKpm8/QoKL6aA7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353607; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ek2V5qcXlJm05q8aldPerksxoUlivHpFQSQ6ZDlUbK0=; b=UcrIy+hdZDQKsLTr2KnjJPp85LTD61R2cs9SXqIlb29U7KdquS+tAIBkjLjz4JxB1gk+qyf1Zu+inQRHi61MrbgMqpBA3vM3yBAcOl3T1p/Z4ZDrsYdprzReyhO0NZxnhnIg8gHN1/sGh1ETSBjX+lTAD5kdiqK1gu4ICYD+5Ok= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582353607572866.8115827076384; Fri, 21 Feb 2020 22:40:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-8iBJC3kmMC22lJQrqqIEJg-1; Sat, 22 Feb 2020 01:40:03 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2108800D5E; Sat, 22 Feb 2020 06:39:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9552991828; Sat, 22 Feb 2020 06:39:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5179A18089D0; Sat, 22 Feb 2020 06:39:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dQPF021663 for ; Sat, 22 Feb 2020 01:39:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 853042063211; Sat, 22 Feb 2020 06:39:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FC9D2063209 for ; Sat, 22 Feb 2020 06:39:24 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 471D4185A78F for ; Sat, 22 Feb 2020 06:39:24 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-c-cvRj13NI-ewLeO9zRSKg-1; Sat, 22 Feb 2020 01:39:21 -0500 Received: by mail-yw1-f67.google.com with SMTP id b186so2648351ywc.1 for ; Fri, 21 Feb 2020 22:39:21 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353606; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ek2V5qcXlJm05q8aldPerksxoUlivHpFQSQ6ZDlUbK0=; b=MQQ9suN4pm3PVgwvSjO13jZdDEUpFaS+ADZG5JZor5RDIUNIYqFroGheT3fm+4srw4f6Ic EQorrnnn07npr+9jf3/VBYeKVYJbdfXjBpwb1lg6dqANZ90vQxv/JsQyIqFxKPKOAJpcM8 RVqql3EaRR940fTxVfxvYZmANI7h9zM= X-MC-Unique: 8iBJC3kmMC22lJQrqqIEJg-1 X-MC-Unique: c-cvRj13NI-ewLeO9zRSKg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XRPKtbmkuUsPAjNTLfZpjP7Rdt8BQPbh4M75Dn27BNA=; b=iPha/SiK6SjpZ6J8bwdBjcmkEDmadDw0X+mijT5uE5qmHRXF+VXk2UtvY/k4Ihrpn6 iDTkZT5OzQASpl6IX1CjowFHNF8jaa0kDBpTomYAp7i+AosQsmnFsn27AlA0iVjsfDST sPZ1ZyCGTdcSkyJ9sQC9LVKE1jl+LMPjDep1fOK+j/zR2PmvV1KjWkuL6tUnIpUrpa4J E/JBCpFMwp9FHNw61r0diJ7uQ6RbEtBGzZHQn70PmGC+XgbHhNcuekm4yJI3R9pgHMHc TkTH9bLqILc8Dp3BPSHfOBWcOcVI5qp9QVqPHHzEV3Np7KhdtBEZ1NYa1P0luW8T4cpp XcXg== X-Gm-Message-State: APjAAAX2j7SF4MMlCGwrTOo5MrYHd7soy/bvS9rtxb9nlGXllQ569NN6 Cp1o0gnFRKO+TPzTRlSPqyKWrikkkNeeYSIYzL0rPpHo3aCqdID94sBY4mKAyngqDCKe0iSZWZP 8puiR18bINA9mBKTMN7tUchM0P5XZiEhVt++RZ9sYSqavrVudetzJ7MjN13VeOnF2pbA= X-Google-Smtp-Source: APXvYqwQ72Ir/y3OBRPs+Qno3WEJAYMNa5/iLsuZurqjLeQSNxwLJAXcS2yvqj3qdCUHzeZwa/02fg== X-Received: by 2002:a81:3845:: with SMTP id f66mr36736991ywa.220.1582353560300; Fri, 21 Feb 2020 22:39:20 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 03/16] Remove redundant parameter to virBhyveProcessStart() Date: Sat, 22 Feb 2020 01:38:42 -0500 Message-Id: <20200222063855.89637-4-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dQPF021663 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_driver.c | 6 +++--- src/bhyve/bhyve_process.c | 18 ++++++++---------- src/bhyve/bhyve_process.h | 1 - 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 365a3777a0..7b8e4808f9 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -89,7 +89,7 @@ bhyveAutostartDomain(virDomainObjPtr vm, void *opaque) virObjectLock(vm); if (vm->autostart && !virDomainObjIsActive(vm)) { virResetLastError(); - ret =3D virBhyveProcessStart(data->conn, data->driver, vm, + ret =3D virBhyveProcessStart(data->conn, vm, VIR_DOMAIN_RUNNING_BOOTED, 0); if (ret < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -861,7 +861,7 @@ bhyveDomainCreateWithFlags(virDomainPtr dom, goto cleanup; } =20 - ret =3D virBhyveProcessStart(dom->conn, privconn, vm, + ret =3D virBhyveProcessStart(dom->conn, vm, VIR_DOMAIN_RUNNING_BOOTED, start_flags); =20 @@ -920,7 +920,7 @@ bhyveDomainCreateXML(virConnectPtr conn, goto cleanup; def =3D NULL; =20 - if (virBhyveProcessStart(conn, privconn, vm, + if (virBhyveProcessStart(conn, vm, VIR_DOMAIN_RUNNING_BOOTED, start_flags) < 0) { /* If domain is not persistent, remove its data */ diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 2ea8db3b55..b0b428eeb4 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -93,7 +93,6 @@ virBhyveFormatDevMapFile(const char *vm_name, char **fn_o= ut) =20 int virBhyveProcessStart(virConnectPtr conn, - bhyveConnPtr driver, virDomainObjPtr vm, virDomainRunningReason reason, unsigned int flags) @@ -106,12 +105,11 @@ virBhyveProcessStart(virConnectPtr conn, char ebuf[1024]; virCommandPtr cmd =3D NULL; virCommandPtr load_cmd =3D NULL; - bhyveConnPtr privconn =3D conn->privateData; + bhyveConnPtr driver =3D conn->privateData; bhyveDomainObjPrivatePtr priv =3D vm->privateData; int ret =3D -1, rc; =20 logfile =3D g_strdup_printf("%s/%s.log", BHYVE_LOG_DIR, vm->def->name); - if ((logfd =3D open(logfile, O_WRONLY | O_APPEND | O_CREAT, S_IRUSR | S_IWUSR)) < 0) { virReportSystemError(errno, @@ -120,19 +118,19 @@ virBhyveProcessStart(virConnectPtr conn, goto cleanup; } =20 - VIR_FREE(privconn->pidfile); - if (!(privconn->pidfile =3D virPidFileBuildPath(BHYVE_STATE_DIR, - vm->def->name))) { + VIR_FREE(driver->pidfile); + if (!(driver->pidfile =3D virPidFileBuildPath(BHYVE_STATE_DIR, + vm->def->name))) { virReportSystemError(errno, "%s", _("Failed to build pidfile path")); goto cleanup; } =20 - if (unlink(privconn->pidfile) < 0 && + if (unlink(driver->pidfile) < 0 && errno !=3D ENOENT) { virReportSystemError(errno, _("Cannot remove state PID file %s"), - privconn->pidfile); + driver->pidfile); goto cleanup; } =20 @@ -146,7 +144,7 @@ virBhyveProcessStart(virConnectPtr conn, virCommandSetOutputFD(cmd, &logfd); virCommandSetErrorFD(cmd, &logfd); virCommandWriteArgLog(cmd, logfd); - virCommandSetPidFile(cmd, privconn->pidfile); + virCommandSetPidFile(cmd, driver->pidfile); virCommandDaemonize(cmd); =20 if (vm->def->os.loader =3D=3D NULL) { @@ -188,7 +186,7 @@ virBhyveProcessStart(virConnectPtr conn, if (virCommandRun(cmd, NULL) < 0) goto cleanup; =20 - if (virPidFileReadPath(privconn->pidfile, &vm->pid) < 0) { + if (virPidFileReadPath(driver->pidfile, &vm->pid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Domain %s didn't show up"), vm->def->name); goto cleanup; diff --git a/src/bhyve/bhyve_process.h b/src/bhyve/bhyve_process.h index 4f62f6be4b..8419e44faa 100644 --- a/src/bhyve/bhyve_process.h +++ b/src/bhyve/bhyve_process.h @@ -24,7 +24,6 @@ #include "bhyve_utils.h" =20 int virBhyveProcessStart(virConnectPtr conn, - bhyveConnPtr driver, virDomainObjPtr vm, virDomainRunningReason reason, unsigned int flags); --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353667; cv=none; d=zohomail.com; s=zohoarc; b=ihMM3bMGFtY3OTBxskBtb1FI5qgZtXaK6NhfHd2cQ9g8coqeCgK+GZ9TQlJ1cygTIMC/s/GmOKpJ1e6slv/liI8KaPZ3TPWGaxRphnOPGY+7enby8/3LBc9hebI2F9WVXNhGWcx84icbbb/iOV/so1blnFLpkHw6W9B3PgXV37U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353667; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vMw6SX8AP7T82pG2utYikiGo57PkdjRHSNqoeuI3kdE=; b=Xm1uSAhKWmgtDx6tfC2GnG7P+dB1Fbm7MwaYM9vFMsSTfmh7Ds7p+CGtlPgsCugoCXruKRdI3x98nNg5r6sDZfjRPFpfJwKQcKdTf7LJ6DvdXxIXsPLWfZY1w2S4aAa3owVDhvoeTLdpq/KL2NPIpO/78cLAL1eQXSFPQZDeT84= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353667440525.102216792197; Fri, 21 Feb 2020 22:41:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-4WVCbKSBNli796hnSPqx9g-1; Sat, 22 Feb 2020 01:40:02 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF68A18A5502; Sat, 22 Feb 2020 06:39:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82D981001F43; Sat, 22 Feb 2020 06:39:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 375CC18089D0; Sat, 22 Feb 2020 06:39:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dQGC021656 for ; Sat, 22 Feb 2020 01:39:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3357D1032530; Sat, 22 Feb 2020 06:39:26 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2EEEA1032523 for ; Sat, 22 Feb 2020 06:39:26 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16090800313 for ; Sat, 22 Feb 2020 06:39:26 +0000 (UTC) Received: from mail-yw1-f68.google.com (mail-yw1-f68.google.com [209.85.161.68]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-ZNe0h5vCOsuTHgyh2qf82A-1; Sat, 22 Feb 2020 01:39:23 -0500 Received: by mail-yw1-f68.google.com with SMTP id 192so2653611ywy.0 for ; Fri, 21 Feb 2020 22:39:23 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353665; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vMw6SX8AP7T82pG2utYikiGo57PkdjRHSNqoeuI3kdE=; b=Xccd8YM6/NE8L/wD8cwXlwJ8NepcTjAit61mBeb8yZPt6lxk3DIwFLcxqKnicKTwK8Zh8O eIY7OUlvUGOtt6NJBrZrUQSTCIMHoh2VwOC4FXrgyODoOI0/NeT74WdWse3InfgXHjAYjF Lw5F3nVWVuWOxJZIwC/g81TWS4QmE8U= X-MC-Unique: 4WVCbKSBNli796hnSPqx9g-1 X-MC-Unique: ZNe0h5vCOsuTHgyh2qf82A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Xi/X1IXUninrAy58XFZDVENGQMkU3n5CKi1vRkYywAk=; b=AYAhzWNyo38fLrGV21DxrrtqRYfrdUHfzpgDFQmg2PcX28g8Vk0JLyzEXWtXDIW/yA mx3hYwkBDBk13/4no2GLnuHaLUqP6K8NhTu48B+2F9IGJZKozedtxZ+G5AvS1Jkvj0uL kWiCulRif1NzizrlUSv0CipfAU+fdqvB7hhs8ur+KkSj1YrbYNW49Xxwj27+k6rfUS/4 InynBeWWlKFv0JiI3OVajJOLyf4lWOsEad990FGWgMUBMlhHWCnzERO9puu950ADpMSJ kuCfjUcHaopcXbdQKhM2739blxtfqCp1wTjPcMwAZRIXNmp8oKTupkhTmdXekF49VGu0 T9JQ== X-Gm-Message-State: APjAAAVakoXLDwlSG4nCNjZVWujNUSNIoCUEUJoO3l02JLgDAZtFvcTI wX7X0Jw7cx6ULx9lUsCa/huL8fdctaRDhH6R7TAIXEOf1yJnHioF3K+sYlg+7MfIgPSKNqJAmGg Vooc+chZ7khzeurPn6/LYG1FOWRaAYYsS+qXggoZ+I5KJCB/SvAxwCb9sgFNuDQKuLRs= X-Google-Smtp-Source: APXvYqwM0JLSCQBCUZRsb5m0OOgbciPTDVHighLwHgdRQRhzGLTml4A1pr9HkvdzPvXS7d7wtbgsLQ== X-Received: by 2002:a81:7cd7:: with SMTP id x206mr33930799ywc.466.1582353562964; Fri, 21 Feb 2020 22:39:22 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 04/16] Fix indentation Date: Sat, 22 Feb 2020 01:38:43 -0500 Message-Id: <20200222063855.89637-5-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dQGC021656 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_command.c | 46 +++++++++++++++++++-------------------- src/bhyve/bhyve_monitor.c | 4 ++-- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index a1078d1460..7e420165aa 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -200,10 +200,10 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *de= f, =20 if ((disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM) && (disk_source =3D=3D NULL)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("cdrom device without source path " - "not supported")); - goto error; + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("cdrom device without source path " + "not supported")); + goto error; } =20 switch (disk->device) { @@ -280,8 +280,8 @@ bhyveBuildUSBControllerArgStr(const virDomainDef *def, =20 static int bhyveBuildVirtIODiskArgStr(const virDomainDef *def G_GNUC_UNUSED, - virDomainDiskDefPtr disk, - virCommandPtr cmd) + virDomainDiskDefPtr disk, + virCommandPtr cmd) { const char *disk_source; =20 @@ -554,26 +554,26 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainControllerDefPtr controller =3D def->controllers[i]; switch (controller->type) { case VIR_DOMAIN_CONTROLLER_TYPE_PCI: - if (controller->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI= _ROOT) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("unsupported PCI controller= model: only PCI root supported")); - goto error; - } - break; + if (controller->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROO= T) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("unsupported PCI controller model: = only PCI root supported")); + goto error; + } + break; case VIR_DOMAIN_CONTROLLER_TYPE_SATA: - if (bhyveBuildAHCIControllerArgStr(def, controller, driver= , cmd) < 0) - goto error; - break; + if (bhyveBuildAHCIControllerArgStr(def, controller, driver, cm= d) < 0) + goto error; + break; case VIR_DOMAIN_CONTROLLER_TYPE_USB: - if (++nusbcontrollers > 1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("only single USB controller= is supported")); - goto error; - } + if (++nusbcontrollers > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("only single USB controller is supp= orted")); + goto error; + } =20 - if (bhyveBuildUSBControllerArgStr(def, controller, cmd) < = 0) - goto error; - break; + if (bhyveBuildUSBControllerArgStr(def, controller, cmd) < 0) + goto error; + break; } } for (i =3D 0; i < def->nnets; i++) { diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index ad6977e562..b9ad4520d9 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -77,8 +77,8 @@ bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSE= D, void *opaque) if (kev.filter =3D=3D EVFILT_PROC && (kev.fflags & NOTE_EXIT) !=3D 0) { if ((pid_t)kev.ident !=3D vm->pid) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("event from unexpected proc %ju!=3D%ju"), - (uintmax_t)vm->pid, (uintmax_t)kev.ident); + _("event from unexpected proc %ju!=3D%ju"), + (uintmax_t)vm->pid, (uintmax_t)kev.ident); return; } =20 --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353606; cv=none; d=zohomail.com; s=zohoarc; b=QJp0oFKN4LBl6yxgr61J+K+fKllIYHmiFuwseiXyH3zIfFpjmSmx/l9HBbDNGTXIpPmGbBAOwKneDM3qSZznauacIU4C49SVZrfwhJTFabpTVo3tcd5rzcXYyJMtR4zyzohmXCxpxgls5oSwEWfWDIRwobGm2RvA9gu03dHou00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353606; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BvjK3lVN6YYG4jkKhWkC2HoA91yxqzVbnaWPTNKwugI=; b=kRO2zQ/Dp4UbT0sE5ggy4HEu95d1fgcPUoKXkGYvu++4MHRlrhvm2rTVMFblildLqybP5YQNjgVDWzIy9lC3NIkbCNTXNO31fJmUrvXzmFLowyMepX0H/zrpEecdBbuVG0c6OAcdhVzbXIra3S7qv7TxS+MzBTeFDzRQdRQPqHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582353606029912.0049381896597; Fri, 21 Feb 2020 22:40:06 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-L2-TxL5QPa6DPbcuwQLgDQ-1; Sat, 22 Feb 2020 01:40:02 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B279D1005510; Sat, 22 Feb 2020 06:39:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 87F4D60C87; Sat, 22 Feb 2020 06:39:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3F363860D5; Sat, 22 Feb 2020 06:39:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dVqH021686 for ; Sat, 22 Feb 2020 01:39:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5DED41032530; Sat, 22 Feb 2020 06:39:31 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 594791032523 for ; Sat, 22 Feb 2020 06:39:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 351D2185A78F for ; Sat, 22 Feb 2020 06:39:29 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-HG9K5zoSPcq1TR8cidDdMQ-1; Sat, 22 Feb 2020 01:39:27 -0500 Received: by mail-yw1-f67.google.com with SMTP id i126so2628527ywe.7 for ; Fri, 21 Feb 2020 22:39:27 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353604; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BvjK3lVN6YYG4jkKhWkC2HoA91yxqzVbnaWPTNKwugI=; b=bJtyeSHwwYNu3vt3PDQm1kpdBbQaMnnShLHsgAmtOYyDm0ot5+fUvjVgsYdInYPntzx6aJ Y+OYF2GX2ITUq6DuBIkfWwTNY7k60cQsa+UdjrG0oqtRCKAuehhedxYqw4lZ9kCXXd2lh3 ZWrkZNFuHhprTcTLfcX+BT2uNwX2Ih0= X-MC-Unique: L2-TxL5QPa6DPbcuwQLgDQ-1 X-MC-Unique: HG9K5zoSPcq1TR8cidDdMQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xbGOSJx65rrTxio/MbUsElJcbqwpboECb3kLNRuRv5E=; b=jTyW35J9qifmuupX5npsjUt1uZGIMQVObEwKonDsEzlR6YFPi0Kk/vh3VqCc4/4MS/ 1k17sWz5I9KRAQitwZ7/Qxem/Rddgr9P1tn0skY6+qUXAr+JeAzVcIzuB1CrzREZS73d JcPaPMLq+W7FVSp3K27RjWWy8jA1w6f6lNN4VZyd29jPQnpKpmN5hMIitYqJRnWpjYmF rLbq2EgQTxDLUxd7CegmGoLtC3Rez2yk491M7B5r2ZyAWkaKUi+SwOACNlZGokOg41oo nyBXCzf5LE+QNHZmVRg9QWAVNECcarhrjET3ugdhbLsrzWw33R62P4wRlSQK2BBC5wj7 W8cQ== X-Gm-Message-State: APjAAAV1u2fzxJcRxmrAmLN3RKLf0QO46J+1s8b+42MFIDlO+olZlTyd g5yT3SnZZxSpokZcEHHr6mUAL8AMIpNcwhx8KIa3oPprT/Zf8XBZOKy+HfPQERBIiwD6Rq2vXS2 iPv+PDizsxm89HmO2fnVrgsDE5PV6armIsOxXdVoQtJUL4zUOpfS8hEmgY6/71t+K2Qk= X-Google-Smtp-Source: APXvYqxZxgyDYJtckLo46eSxxlvhO5MjdARV+UfVHvyVtksLE/BlNJo22p4IRnYUO1yNxHrasS2Gcw== X-Received: by 2002:a25:8081:: with SMTP id n1mr40450976ybk.398.1582353566454; Fri, 21 Feb 2020 22:39:26 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 05/16] Eliminate rc variable Date: Sat, 22 Feb 2020 01:38:44 -0500 Message-Id: <20200222063855.89637-6-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dVqH021686 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_monitor.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index b9ad4520d9..0e55e19772 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -130,7 +130,6 @@ bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr drive= r) { bhyveMonitorPtr mon =3D NULL; struct kevent kev; - int rc; =20 if (VIR_ALLOC(mon) < 0) return NULL; @@ -145,8 +144,7 @@ bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr drive= r) } =20 EV_SET(&kev, vm->pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, mon); - rc =3D kevent(mon->kq, &kev, 1, NULL, 0, NULL); - if (rc < 0) { + if (kevent(mon->kq, &kev, 1, NULL, 0, NULL) < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, "%s", _("Unable to register process kevent")); goto cleanup; --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353626; cv=none; d=zohomail.com; s=zohoarc; b=MHN7NTTfgVAmV2kl3rciyRzZs0avjEDh52PmWrHwCs8+2bEnHjcxWMatmPhM4WJbGdG01AB0BV80tpa8lN8EW8JvZF47t64/3atiM2+27uiT+IGYPxee3s4bLh0rBwKE3o5QK+jpBqa/gyVu/pjnPz6Zuy92at9QHCuIhOWv1QM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353626; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2yks+ebGqF1ujrAbGvzEeByKkGybUXhHgSmOcTUbgxk=; b=Yg4GTwALAuzUdI4paV0KmpsPx8UXOAlLlw9ZdhRz4VPChQ3NWQ+2QfhlNnbh4MF/jdPamKgER2NSFztH74fCxRdPbjXGka86fkOvLbZYSG06yzA62OSioxhGyjSDOR5hbswbinlp6bPROcRpWvW8ATLrZXfT6Ne2maHXgEcSHPA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 15823536262461002.5817282981556; Fri, 21 Feb 2020 22:40:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-DD3F0pJaMPy8a7t7ArsXgA-1; Sat, 22 Feb 2020 01:40:22 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D14F3801E6C; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DFCE8B754; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 449DD860D3; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dWmp021691 for ; Sat, 22 Feb 2020 01:39:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5EB6D2063211; Sat, 22 Feb 2020 06:39:32 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59A292063209 for ; Sat, 22 Feb 2020 06:39:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F5E5101A55A for ; Sat, 22 Feb 2020 06:39:32 +0000 (UTC) Received: from mail-yw1-f66.google.com (mail-yw1-f66.google.com [209.85.161.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-_ZBub0fOOviy-P4SaAJDNw-1; Sat, 22 Feb 2020 01:39:30 -0500 Received: by mail-yw1-f66.google.com with SMTP id a125so2609710ywe.12 for ; Fri, 21 Feb 2020 22:39:29 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2yks+ebGqF1ujrAbGvzEeByKkGybUXhHgSmOcTUbgxk=; b=bU4L3seR8ket13rBYCA70IBNG5v0gnFJ7OS66XcmVwONUSXELvxNKeoof/0TJ/3cn8sSZW EHr0xhBoqgQ8I9w9kDMHrDGrBZfaWs0KQWevmvQ0/ulVMITigjWQz7xVhpxART0oyf3KEv 7G3DTCxMdHp2tSVm5r3Cr4SphHDlo4Q= X-MC-Unique: DD3F0pJaMPy8a7t7ArsXgA-1 X-MC-Unique: _ZBub0fOOviy-P4SaAJDNw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=41sKpQBHV229YGc2PoPPq4+LwkVLPEWxwJHkGW5Xi+s=; b=E5e2DHoycqwYQH3fgm7Nn/RZ7Kt8Zg6RHOe6p0qhh6ya9/u65qMGS2p3wOk5IgJbJo GbnC7+Dxdme+7PU5TnY6fF2qeXTIuW03f5QSYzBFVCBg9+MZp2qkKOW8yTGCsStasDL7 GaTeJP2UXUR6QEuao8nldTHOtJ4KKVBPJEbdkpAfzBeeOtnST1d74bYsT5yAbyFIEbNA 8iFpFRnG4SHiCKZjJdGJRjENTJ+xL7BdgxKLwLcpR4V3Bjstt+WYoL/X0j65ERRCEisG ub/uo+VB+thvZHoQac6cXlClXTzRTG31gPi81Xu9UAqY0gf+it7g2O+PUFdazQk/w27r cJQA== X-Gm-Message-State: APjAAAX+NtaN/QRZSn32lALWnEI8H/kUDVGoN6vRU7FW2oEdMKNjAQ0s JcavwMJyretwb32H1bBXAAkRF7R3Z9J8Cts0wiCJBbE2p88xbOOz62uE5QmGKOvFO56YcsrnUAT mAb/JPnthr3XGl/yKN8M3z9xL1m38w1ikmk32AU/QM4mhXIOs2ssOmpqD0fR+MOAip84= X-Google-Smtp-Source: APXvYqxmfL6tjtMvWqnKRZstVd9j5ykQ2eQEHBTTRelw8s/VRJWnyllhEvT8ea+iaL6kf9HTi21Vpw== X-Received: by 2002:a25:3753:: with SMTP id e80mr1194781yba.213.1582353569383; Fri, 21 Feb 2020 22:39:29 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 06/16] Factor out conn Date: Sat, 22 Feb 2020 01:38:45 -0500 Message-Id: <20200222063855.89637-7-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dWmp021691 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller Reviewed-by: J=C3=A1n Tomko --- src/bhyve/bhyve_driver.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 7b8e4808f9..625dc0ec22 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -946,7 +946,8 @@ bhyveDomainCreateXML(virConnectPtr conn, static int bhyveDomainDestroyFlags(virDomainPtr dom, unsigned int flags) { - bhyveConnPtr privconn =3D dom->conn->privateData; + virConnectPtr conn =3D dom->conn; + bhyveConnPtr privconn =3D conn->privateData; virDomainObjPtr vm; virObjectEventPtr event =3D NULL; int ret =3D -1; @@ -956,7 +957,7 @@ bhyveDomainDestroyFlags(virDomainPtr dom, unsigned int = flags) if (!(vm =3D bhyveDomObjFromDomain(dom))) goto cleanup; =20 - if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0) + if (virDomainDestroyFlagsEnsureACL(conn, vm->def) < 0) goto cleanup; =20 if (virDomainObjCheckActive(vm) < 0) @@ -1060,7 +1061,8 @@ bhyveDomainSetMetadata(virDomainPtr dom, const char *uri, unsigned int flags) { - bhyveConnPtr privconn =3D dom->conn->privateData; + virConnectPtr conn =3D dom->conn; + bhyveConnPtr privconn =3D conn->privateData; virDomainObjPtr vm; int ret =3D -1; =20 @@ -1070,7 +1072,7 @@ bhyveDomainSetMetadata(virDomainPtr dom, if (!(vm =3D bhyveDomObjFromDomain(dom))) return -1; =20 - if (virDomainSetMetadataEnsureACL(dom->conn, vm->def, flags) < 0) + if (virDomainSetMetadataEnsureACL(conn, vm->def, flags) < 0) goto cleanup; =20 ret =3D virDomainObjSetMetadata(vm, type, metadata, key, uri, --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353663; cv=none; d=zohomail.com; s=zohoarc; b=FzPwxP77in3pLQ8L2qQ/xIjmCmarn0uVkr0VbxksFUq6ItE+6+ezhreA65dSprxy5wjrHpVjS7fCfst7wBIm2vxoz1mZvzqYS/fWS/toUQ1GZCQUG9xJsDKAw4nAfCA20q55AfrbBt1MnpfDsCtc9GfbAhQuYq79Bi3Tu1xBLaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353663; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FW5PnbNI9U4zt/t42+rqItHPwiQjzg92FQbrCLLOWjo=; b=Haecg+1RYSv4VJjQgc0SdyCH5z4Yz9u1vrQI7gNsUbSXKErEjW1ZaFxYLKOrKPN7IkP5TNXpOWZnMYjm283ItV0MtnfsIAgfii2k5Ap9tTmVePJ7nhb4p457dqRU8a15oxbPDydQffOWXFvvzLi3GBi43I5pXa2rk2CiWqoFLyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582353663027940.059048948609; Fri, 21 Feb 2020 22:41:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-471-7iFlEHarMS-WC_pTfjsW4A-1; Sat, 22 Feb 2020 01:40:22 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DBCFC800D6C; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB7CF19C7F; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 478AD860CD; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6daU9021710 for ; Sat, 22 Feb 2020 01:39:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8917C1032530; Sat, 22 Feb 2020 06:39:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 848DD1032523 for ; Sat, 22 Feb 2020 06:39:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6333C80030A for ; Sat, 22 Feb 2020 06:39:36 +0000 (UTC) Received: from mail-yw1-f66.google.com (mail-yw1-f66.google.com [209.85.161.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-213-hMHaoIlaNvm_z6Rz4D7pCA-1; Sat, 22 Feb 2020 01:39:33 -0500 Received: by mail-yw1-f66.google.com with SMTP id i126so2628696ywe.7 for ; Fri, 21 Feb 2020 22:39:33 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353662; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FW5PnbNI9U4zt/t42+rqItHPwiQjzg92FQbrCLLOWjo=; b=VEDozdmw3TJX3zj6yz59oV8H6IfoQGJkxaRvVbStnNsV+lwxZoeoiys7wKimAd6o+Q6nH2 yC1/UACZN8J7KEQlfmZUpSTNv9xvgem9daPXu8yGDNsHEzpWgIniCw0Dckxd3djsgNI0Ki 1yHA+BWXMzJlZLSzErCbN6H4ULSknaw= X-MC-Unique: 7iFlEHarMS-WC_pTfjsW4A-1 X-MC-Unique: hMHaoIlaNvm_z6Rz4D7pCA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vnhC+e68ugRBuWT9M7zT45/m2gKV34PLHVZfCZBHHyM=; b=F6DLO8XDRsEsZA1t0Jil+HvPF23HE/uDLtn8A2I61IanE5nAQWAFAV2N4y6K+sNPl5 bJvh4vNs7bFsa/EKdGbcOSeH+2ZRjEdlPqEMJlW5oEweSbp+GqeD0BGcuHrm3mj/oGpC 73ApP/u/Ni+sYixf0NOUJI8mF/+TuWUHzY5+NKsfnpIpHM1pZQfkeYt+anBxkELHRIff cUv+JEEO7WSpxpxcvNarqIaTOysnNAbsFbcfVBy/zQ6H04fp93xCiISYkLTLBlhwcWLu J+8EhRUvoTEZRMJJi7vEaO/it0wjIeMVGpGqWMQSM144QehKNGIO0MFyw6Zr8+P8+uP3 YHPw== X-Gm-Message-State: APjAAAV5quvHgxRNKnta3WmGTAKLq350jMPx4tu0YZtGUqT/0AcbrvVw WgIiWAOOEHWv7zAjtUKuMXDOS9l+v99wviJ8+r9pPo3XEBB6yP02DPrryr/gn4ityqyU1ZMWjnt XptDYG2/1cZjVBWZD6qBtrAJRHLHJm8sp/wgoTkVK5G6Q732WvAHYoMbqGCDuP6fFdR0= X-Google-Smtp-Source: APXvYqxIj+JvmOQnGgpqAVnvt6tEgpWlEgGsEs7Q9ER4/g1DjuhLEogMxtjkv2QOru6yB//5nUngmQ== X-Received: by 2002:a25:b948:: with SMTP id s8mr1596025ybm.54.1582353572936; Fri, 21 Feb 2020 22:39:32 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 07/16] Don't bother seeking to the end of a file opened O_APPEND Date: Sat, 22 Feb 2020 01:38:46 -0500 Message-Id: <20200222063855.89637-8-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6daU9021710 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_process.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index b0b428eeb4..a11f75a894 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -101,8 +101,6 @@ virBhyveProcessStart(virConnectPtr conn, char *devicemap =3D NULL; char *logfile =3D NULL; int logfd =3D -1; - off_t pos =3D -1; - char ebuf[1024]; virCommandPtr cmd =3D NULL; virCommandPtr load_cmd =3D NULL; bhyveConnPtr driver =3D conn->privateData; @@ -172,9 +170,6 @@ virBhyveProcessStart(virConnectPtr conn, =20 /* Log generated command line */ virCommandWriteArgLog(load_cmd, logfd); - if ((pos =3D lseek(logfd, 0, SEEK_END)) < 0) - VIR_WARN("Unable to seek to end of logfile: %s", - virStrerror(errno, ebuf, sizeof(ebuf))); =20 VIR_DEBUG("Loading domain '%s'", vm->def->name); if (virCommandRun(load_cmd, NULL) < 0) --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353626; cv=none; d=zohomail.com; s=zohoarc; b=LmjXS4MdzhrCgduoxYjPoy54FjRafYgB8+pTsY7IY6fUKJK4pwFXTiMml5T/rfFD6kKTmRY+2oro5csKg6I1eEKWxJd7X6Y3Ry/W+IvIOi5ouPJlJJg+45B+ajb6hzRmc4Da394+EDSnKkutHdEGj15Dy57FtcdT5E1H3HOcI9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353626; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KO0z3TtkI0TSoZ7kcI5Ldl96ZSdAXrlSMjWjVQ10CQo=; b=ZNCk0QR5BOTKYRGnWnhbBFhAxDICRR3Iswt96/Y31McgUFIdQoMyWanB4t+tjZWpujIryhL7G/GDTR1BldnjPiJn4yBDJCHvOoeuFbWCCfxBmCYfh3xgPjTP7KCr4o5jV+WE17i2oeWxiEwbeENo9Ntjj6XSuMHCVQwtGHINjRU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582353626661251.67102515597207; Fri, 21 Feb 2020 22:40:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-264-o-splqD7NBSG4LzsJNcb6g-1; Sat, 22 Feb 2020 01:40:22 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6632918A5500; Sat, 22 Feb 2020 06:40:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D1AE8B74C; Sat, 22 Feb 2020 06:40:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EC00818089CF; Sat, 22 Feb 2020 06:40:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dcan021721 for ; Sat, 22 Feb 2020 01:39:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id C73401032530; Sat, 22 Feb 2020 06:39:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C239D1032523 for ; Sat, 22 Feb 2020 06:39:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A159785A30E for ; Sat, 22 Feb 2020 06:39:38 +0000 (UTC) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-369-LO1dicm4PiqmR3G-Rsh8ow-1; Sat, 22 Feb 2020 01:39:36 -0500 Received: by mail-yw1-f65.google.com with SMTP id i126so2628761ywe.7 for ; Fri, 21 Feb 2020 22:39:36 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KO0z3TtkI0TSoZ7kcI5Ldl96ZSdAXrlSMjWjVQ10CQo=; b=KT+9ShYwnhLHZ7UFh46LrHzEcdIdL2xeicklUfNX2UbfcQZhhlrONHmkW0vqHG/mCce4h2 ATaTVcHDZqPvwIbqYPgj98aYcWUpMsTXiZIY+RoEHSdwZt7WxzXWkajhU+iterlbA6Q5KP 92/z0btsJDH+cg75uEpzNnmqW7ZuF6I= X-MC-Unique: o-splqD7NBSG4LzsJNcb6g-1 X-MC-Unique: LO1dicm4PiqmR3G-Rsh8ow-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OWtAEN/Drt65M1QWKqT1Lj2htdW4ejKwe3CzHohNCXA=; b=HxlJ/APVR4Gx4MB5ObTUVj8gy+2bspKHDVRwnRIDbHFawd+7HFaTTOKdvuvPjFUwVU aQ340IuzCa6ZGv0ghsgHlNuLslzlBSecXqst+Xt+H+2vIZ+gcrvEaZSRgLA0Ndn6szEC uhIsLPONkoDbXmf1xPwwLznKOepUpgpxFfMDTKCR5AX73PPvQO9BIjhFvXC3aKkIKI1U BU7g7mml6xcz/s6s2Cck7dfTMRsQYb7LhiUpqROTqOz0zLIli/41jnkEKzhrXdpJBdMk tuImMX4MNqdfZc1WRiapU1Hk91AoCDCh4UmJ7GKbjnANXkVw4SgNsB98NTWefd8onFTl cJwA== X-Gm-Message-State: APjAAAWl+D0tzDx+JoiqCOG+SypJ428EM072bPBbVeSlJ1o915tQl5le 8PDu/x1VI/7bsNQZKGaiSk0spbPA44q9nqG+YdzAhqrBTjt9O+i478AZvG39DfOrQcDW1yh6CZj a4/89y4u2/dyu496o3Pj05M2K9W0SnfFGrxWfTVSxjbgr6+G3vc9PVSvp6N64Yxmo/9E= X-Google-Smtp-Source: APXvYqy6DxpXWy1qK+Vd/tkBHJ6/L+wInh62hVS7agBG1mrop2/2lEY2075n8mbyAKta+gWxQtYLdA== X-Received: by 2002:a5b:9ca:: with SMTP id y10mr37471744ybq.195.1582353575561; Fri, 21 Feb 2020 22:39:35 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 08/16] Make bhyveMonitor a virClass Date: Sat, 22 Feb 2020 01:38:47 -0500 Message-Id: <20200222063855.89637-9-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dcan021721 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_monitor.c | 116 +++++++++++++++++++++++++------------- 1 file changed, 76 insertions(+), 40 deletions(-) diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index 0e55e19772..58d40e1f70 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -32,24 +32,51 @@ #include "virerror.h" #include "virfile.h" #include "virlog.h" +#include "virobject.h" =20 #define VIR_FROM_THIS VIR_FROM_BHYVE =20 VIR_LOG_INIT("bhyve.bhyve_monitor"); =20 struct _bhyveMonitor { + virObject parent; + int kq; int watch; bhyveConnPtr driver; + virDomainObjPtr vm; }; =20 +static virClassPtr bhyveMonitorClass; + +static void +bhyveMonitorDispose(void *obj) +{ + bhyveMonitorPtr mon =3D obj; + + VIR_FORCE_CLOSE(mon->kq); + virObjectUnref(mon->vm); +} + +static int +bhyveMonitorOnceInit(void) +{ + if (!VIR_CLASS_NEW(bhyveMonitor, virClassForObject())) + return -1; + + return 0; +} + +VIR_ONCE_GLOBAL_INIT(bhyveMonitor); + static void bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, void *opaque) { const struct timespec zerowait =3D { 0, 0 }; - virDomainObjPtr vm =3D opaque; - bhyveDomainObjPrivatePtr priv =3D vm->privateData; - bhyveMonitorPtr mon =3D priv->mon; + bhyveMonitorPtr mon =3D opaque; + virDomainObjPtr vm =3D mon->vm; + bhyveConnPtr driver =3D mon->driver; + const char *name; struct kevent kev; int rc, status; =20 @@ -82,60 +109,49 @@ bhyveMonitorIO(int watch, int kq, int events G_GNUC_UN= USED, void *opaque) return; } =20 + name =3D vm->def->name; status =3D kev.data; if (WIFSIGNALED(status) && WCOREDUMP(status)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Guest %s got signal %d and crashed"), - vm->def->name, - WTERMSIG(status)); - virBhyveProcessStop(mon->driver, vm, - VIR_DOMAIN_SHUTOFF_CRASHED); + name, WTERMSIG(status)); + virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED); } else if (WIFEXITED(status)) { if (WEXITSTATUS(status) =3D=3D 0) { /* 0 - reboot */ /* TODO: Implementing reboot is a little more complicated.= */ - VIR_INFO("Guest %s rebooted; destroying domain.", - vm->def->name); - virBhyveProcessStop(mon->driver, vm, - VIR_DOMAIN_SHUTOFF_SHUTDOWN); + VIR_INFO("Guest %s rebooted; destroying domain.", name); + virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOW= N); } else if (WEXITSTATUS(status) < 3) { /* 1 - shutdown, 2 - halt, 3 - triple fault. others - erro= r */ - VIR_INFO("Guest %s shut itself down; destroying domain.", - vm->def->name); - virBhyveProcessStop(mon->driver, vm, - VIR_DOMAIN_SHUTOFF_SHUTDOWN); + VIR_INFO("Guest %s shut itself down; destroying domain.", = name); + virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOW= N); } else { VIR_INFO("Guest %s had an error and exited with status %d;= destroying domain.", - vm->def->name, WEXITSTATUS(status)); - virBhyveProcessStop(mon->driver, vm, - VIR_DOMAIN_SHUTOFF_UNKNOWN); + name, WEXITSTATUS(status)); + virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_UNKNOWN= ); } } } } =20 -static void -bhyveMonitorRelease(void *opaque) -{ - virDomainObjPtr vm =3D opaque; - bhyveDomainObjPrivatePtr priv =3D vm->privateData; - bhyveMonitorPtr mon =3D priv->mon; - - VIR_FORCE_CLOSE(mon->kq); - VIR_FREE(mon); -} - -bhyveMonitorPtr -bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver) +static bhyveMonitorPtr +bhyveMonitorOpenImpl(virDomainObjPtr vm, bhyveConnPtr driver) { - bhyveMonitorPtr mon =3D NULL; + bhyveMonitorPtr mon; struct kevent kev; =20 - if (VIR_ALLOC(mon) < 0) + if (bhyveMonitorInitialize() < 0) + return NULL; + + if (!(mon =3D virObjectNew(bhyveMonitorClass))) return NULL; =20 mon->driver =3D driver; =20 + virObjectRef(vm); + mon->vm =3D vm; + mon->kq =3D kqueue(); if (mon->kq < 0) { virReportError(VIR_ERR_SYSTEM_ERROR, "%s", @@ -150,14 +166,17 @@ bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr dri= ver) goto cleanup; } =20 + virObjectRef(mon); mon->watch =3D virEventAddHandle(mon->kq, VIR_EVENT_HANDLE_READABLE | VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP, bhyveMonitorIO, - vm, - bhyveMonitorRelease); + mon, + virObjectFreeCallback); if (mon->watch < 0) { + VIR_DEBUG("failed to add event handle for mon %p", mon); + virObjectUnref(mon); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unable to register monitor events")); goto cleanup; @@ -166,18 +185,35 @@ bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr dri= ver) return mon; =20 cleanup: - bhyveMonitorRelease(mon); + bhyveMonitorClose(mon); return NULL; } =20 +bhyveMonitorPtr +bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver) +{ + bhyveMonitorPtr mon; + + virObjectRef(vm); + mon =3D bhyveMonitorOpenImpl(vm, driver); + virObjectUnref(vm); + + return mon; +} + void bhyveMonitorClose(bhyveMonitorPtr mon) { if (mon =3D=3D NULL) return; =20 - if (mon->watch > 0) - virEventRemoveHandle(mon->watch); - else - bhyveMonitorRelease(mon); + VIR_DEBUG("cleaning up bhyveMonitor %p", mon); + + if (mon->watch < 0) + return; + + virEventRemoveHandle(mon->watch); + mon->watch =3D -1; + + virObjectUnref(mon); } --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353649; cv=none; d=zohomail.com; s=zohoarc; b=gZ/PUEoxalcuTveQm5NiG5g3KtrkNzYXteyqRuVzpKE7BKFDNt8qWmTYFFE3PiPacsDgqDye/JC16R5jVurGcU+waTLdSUfqCMcDQQIP9tZbxiItuy1QO7HPEPfUksQyyTAWA8xESeUmiMnC5Af0NnTMgGPa/d10cN7q/s9EOuw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353649; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=F73Rh1mKbzBa3EAjcp3zxFccRZBC31e0WP+dVw+SVxE=; b=GOo/jKjJGN0Kmn9sM+CgAknkZzr+jYrhGQACYxRobXAwwrnPu4e3uUKCxaygKLIEZ/fqCrrqW6ejqM27VwtgGaeyoFC0wdzBeOunMVb89wFmJfYr1uSn9ifjWc8AvIo6EHV3EV16PdnTfwwR47UwNgd5AZ+bE9te6wIwpgsP7sk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353649700274.8498540568662; Fri, 21 Feb 2020 22:40:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-53-qBJ-I_blMdSZLClVvf63Dg-1; Sat, 22 Feb 2020 01:40:45 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6570418A5505; Sat, 22 Feb 2020 06:40:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3D50690538; Sat, 22 Feb 2020 06:40:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9E487860D5; Sat, 22 Feb 2020 06:40:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6di8K021751 for ; Sat, 22 Feb 2020 01:39:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id B348213BB9B; Sat, 22 Feb 2020 06:39:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEE7113AF75 for ; Sat, 22 Feb 2020 06:39:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1FF5A185A78E for ; Sat, 22 Feb 2020 06:39:42 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-472--n0A9WJCM2-nbyBla_Jy-Q-1; Sat, 22 Feb 2020 01:39:39 -0500 Received: by mail-yw1-f67.google.com with SMTP id z141so2610609ywd.13 for ; Fri, 21 Feb 2020 22:39:39 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353648; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=F73Rh1mKbzBa3EAjcp3zxFccRZBC31e0WP+dVw+SVxE=; b=hHrQ5EGm1nsBU1/MGjsE5ig0yZ+fne2mW/y+ZEqN9mgALQ0pOMiKUUIi+InM65P4dt/dAp KMoUAxeEGfA0cSZgOy9OyfguLdv97qQJuTX9Kqh3Zpz4lb99WSwkERk6WW/UwtVfPNzU/C F+yM545GlrzdxCBfHOGeOAhAlBNvopU= X-MC-Unique: qBJ-I_blMdSZLClVvf63Dg-1 X-MC-Unique: -n0A9WJCM2-nbyBla_Jy-Q-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EaSKwksq/N+6pynW94MO1B2aEF7cl/RR9XrUnxQ9Jrw=; b=VdwL0zbX1BH7ZOjFaYOHtXLu+i6G0Wr5fVXVKDtH+wJr+QMuaSyC62pYO2QTJtXEy9 VbxNyfAVGSYaXsHbtw1E0uJlrHjI28l4kPfokZCylGlcj0X6/E4Ozvv0PFM92FuERbMc sX8L3dXdBVaBn12nzPsATVMQbrVpv3WURPxXct76XV5dLa4HM7x+5Vl9AWinhWZqv9p3 aG7aZU5pmw8VzEqSF+QT6Vqa3G3vr/2ir/h1Gadjv8WxD/A9VeC5TeUNJyShKajnnsI9 GTa4qT5dhACM+/9+rJUhRRBXWtrd8BjEtYj9Hh5LU5O48AMeanmMAyBzrj45QshfakUV QNDg== X-Gm-Message-State: APjAAAWNsM42GtE0BXxQHQwPSbH/yRvybMPH+zgRdGhKwL3PCvsuUCJs 6zn43VYp4MwvpVq3e/sxUkX9EjB3dJxu+/ECe99DQs5zJ56mVU9Bj4grEkxkTIrzTPb5bCqtb5S s+F3QiXDpL4JdxTGVlSkBSv1G7JZX/+KggxKw7Fp1AMPPCgd7WV4BM5K9xpVq8smCzb8= X-Google-Smtp-Source: APXvYqwLvjUjEYmglM2hEk8YYP+ljxJN6TDGUjHU+DPKh4mwRc1GTZrIv1MMTcMxii1DbZLZfQFdCw== X-Received: by 2002:a5b:80b:: with SMTP id x11mr38700768ybp.348.1582353578894; Fri, 21 Feb 2020 22:39:38 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 09/16] Refactor bhyve monitor register/unregister Date: Sat, 22 Feb 2020 01:38:48 -0500 Message-Id: <20200222063855.89637-10-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6di8K021751 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Pull the code for registering and unregistering a bhyve monitor object into separate functions to improve code clarity. Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_monitor.c | 50 ++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index 58d40e1f70..a1b1a21a6f 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -69,6 +69,37 @@ bhyveMonitorOnceInit(void) =20 VIR_ONCE_GLOBAL_INIT(bhyveMonitor); =20 +static void bhyveMonitorIO(int, int, int, void *); + +static bool +bhyveMonitorRegister(bhyveMonitorPtr mon) +{ + virObjectRef(mon); + mon->watch =3D virEventAddHandle(mon->kq, + VIR_EVENT_HANDLE_READABLE | + VIR_EVENT_HANDLE_ERROR | + VIR_EVENT_HANDLE_HANGUP, + bhyveMonitorIO, + mon, + virObjectFreeCallback); + if (mon->watch < 0) { + VIR_DEBUG("failed to add event handle for mon %p", mon); + virObjectUnref(mon); + return false; + } + return true; +} + +static void +bhyveMonitorUnregister(bhyveMonitorPtr mon) +{ + if (mon->watch < 0) + return; + + virEventRemoveHandle(mon->watch); + mon->watch =3D -1; +} + static void bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, void *opaque) { @@ -166,17 +197,7 @@ bhyveMonitorOpenImpl(virDomainObjPtr vm, bhyveConnPtr = driver) goto cleanup; } =20 - virObjectRef(mon); - mon->watch =3D virEventAddHandle(mon->kq, - VIR_EVENT_HANDLE_READABLE | - VIR_EVENT_HANDLE_ERROR | - VIR_EVENT_HANDLE_HANGUP, - bhyveMonitorIO, - mon, - virObjectFreeCallback); - if (mon->watch < 0) { - VIR_DEBUG("failed to add event handle for mon %p", mon); - virObjectUnref(mon); + if (!bhyveMonitorRegister(mon)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unable to register monitor events")); goto cleanup; @@ -209,11 +230,6 @@ bhyveMonitorClose(bhyveMonitorPtr mon) =20 VIR_DEBUG("cleaning up bhyveMonitor %p", mon); =20 - if (mon->watch < 0) - return; - - virEventRemoveHandle(mon->watch); - mon->watch =3D -1; - + bhyveMonitorUnregister(mon); virObjectUnref(mon); } --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353723; cv=none; d=zohomail.com; s=zohoarc; b=aGQ32wZj8IEy2ZUPnpL1OuQS2fo9A8/JT9kT28MTTvXQWV4ExaJBvI9uUtkWkOoeB9T69Ms3Hc++vwXhUZGKV7nz+OGydsm0zTfMZvazA+5bmNQHkJ+BetKK/SuBr6MxThACHzSymgOWtlBQ8XoYyKmJZBZm90RSkY/accPgZbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353723; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+KEnc/M2u1vtOq7byLY/tjxqteMUZASB3RpwswtsBa4=; b=XuD2Xf55sEv3t4Qdr5LvKV2kZt6xCPW9ZVl2d6Y7PSMi+/hqD+gAOIvxNXjf2Do7ekXhMJ5vyu5IczzBoTKKJDK9QZeUPP5klOuestk5yBDBI8NMsx8+5kDZoFWJICcj3AGDkePqAHwxP9uSIowu6zaqlihp8R2VE8BmCI9/Dh4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582353723339302.5027120753874; Fri, 21 Feb 2020 22:42:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-IeCrsdyPPESFqF6J3g0rpQ-1; Sat, 22 Feb 2020 01:41:09 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 534D118A5505; Sat, 22 Feb 2020 06:41:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2754890788; Sat, 22 Feb 2020 06:41:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CAD9D860D4; Sat, 22 Feb 2020 06:41:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6diZU021752 for ; Sat, 22 Feb 2020 01:39:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id C13DD1032530; Sat, 22 Feb 2020 06:39:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC5351032523 for ; Sat, 22 Feb 2020 06:39:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1E4185A30E for ; Sat, 22 Feb 2020 06:39:44 +0000 (UTC) Received: from mail-yw1-f66.google.com (mail-yw1-f66.google.com [209.85.161.66]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-VPK9zgZVNYC56E_t-ZMucw-1; Sat, 22 Feb 2020 01:39:42 -0500 Received: by mail-yw1-f66.google.com with SMTP id h126so2638225ywc.6 for ; Fri, 21 Feb 2020 22:39:42 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353722; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+KEnc/M2u1vtOq7byLY/tjxqteMUZASB3RpwswtsBa4=; b=Y6EqZJcwHGSqjKs85CycDSmBzwmd8mI6i/Sh76gD6S6PCDjhLkLS+aK0o9O3yBcfRM9Jz3 JVJObKWOgOnM4hHLSZSE+8GxDfYcuidwlC+IbjtdKwRMIqLTOIi8t5IReba+hFpfhfHYBL wCWHIPs1R61WQ5q8zUM81+ne+pjv/Ro= X-MC-Unique: IeCrsdyPPESFqF6J3g0rpQ-1 X-MC-Unique: VPK9zgZVNYC56E_t-ZMucw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XGvJLsTREio1QIpp5c7NrMw6Sg6CQdK0mb5OfvwWbqM=; b=lger+NVj9WhWQZsY++yK9eChx6W5uGdUa1jJmS22u4c+sGJSjIxU5afLRbg72Xf3cK YlxlPBFyCqAAgqCHWxSvTix2+x+cn+pAWvP6QBwm17N9pUjnWOfU4YQRGE5T8IsPO0yn f3ERNN0rnTuWhGRoTdaKuDmYGORmbg3tvLfhdddxXclm480BgREZ87hHV2YU5TGAUowm 4n4nMqbAWvoC69IIS/5KN/Zu/74m+1CaYzoo+ytx5jqDt4IgNonbTYaapa1iNi2bqdEt Y80CFlQh0/viSNZqNuAuKM5lk8emqCYxgiYbwXGWIq2wPvOyieSK074ryFek7ws4a6/y 6LgA== X-Gm-Message-State: APjAAAUspV1z1vcxe25cmrSCDUta+oc++VhqOme32jQToOJhoDntF4rO WcBZN4XqdaZm8m8d8ot1AVh27mM/tFujto3GWROAdjMqbaDw+DxU6V2bGZ03KLwX450W3rT5Xrk AqOD9ZByWu/isrYKVbI8eMeelvij5DTW/gpfISvQOVFKhWUUoabYUqusXMXH+ASU+9Cw= X-Google-Smtp-Source: APXvYqwwinwk5454XHP5Ip5ipdpqmJNHmzA0zQKVkiM7u6HKVpQT1sPnFMVNDy1vPwk6eZtvnwyKLw== X-Received: by 2002:a25:b947:: with SMTP id s7mr35573565ybm.50.1582353581462; Fri, 21 Feb 2020 22:39:41 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 10/16] Add hooks for bhyve backend Date: Sat, 22 Feb 2020 01:38:49 -0500 Message-Id: <20200222063855.89637-11-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6diZU021752 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_process.c | 33 +++++++++++++++++++++++++++++++++ src/util/virhook.c | 15 +++++++++++++++ src/util/virhook.h | 11 +++++++++++ 3 files changed, 59 insertions(+) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index a11f75a894..45162503d4 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -37,6 +37,7 @@ #include "bhyve_process.h" #include "datatypes.h" #include "virerror.h" +#include "virhook.h" #include "virlog.h" #include "virfile.h" #include "viralloc.h" @@ -91,6 +92,24 @@ virBhyveFormatDevMapFile(const char *vm_name, char **fn_= out) *fn_out =3D g_strdup_printf("%s/grub_bhyve-%s-device.map", BHYVE_STATE= _DIR, vm_name); } =20 +static int +bhyveProcessStartHook(virDomainObjPtr vm, virHookBhyveOpType op) +{ + if (!virHookPresent(VIR_HOOK_DRIVER_BHYVE)) + return 0; + + return virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op, + VIR_HOOK_SUBOP_BEGIN, NULL, NULL, NULL); +} + +static void +bhyveProcessStopHook(virDomainObjPtr vm, virHookBhyveOpType op) +{ + if (virHookPresent(VIR_HOOK_DRIVER_BHYVE)) + virHookCall(VIR_HOOK_DRIVER_BHYVE, vm->def->name, op, + VIR_HOOK_SUBOP_END, NULL, NULL, NULL); +} + int virBhyveProcessStart(virConnectPtr conn, virDomainObjPtr vm, @@ -135,6 +154,10 @@ virBhyveProcessStart(virConnectPtr conn, if (bhyveDomainAssignAddresses(vm->def, NULL) < 0) goto cleanup; =20 + /* Run an early hook to setup missing devices. */ + if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) + goto cleanup; + /* Call bhyve to start the VM */ if (!(cmd =3D virBhyveProcessBuildBhyveCmd(driver, vm->def, false))) goto cleanup; @@ -176,6 +199,9 @@ virBhyveProcessStart(virConnectPtr conn, goto cleanup; } =20 + if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_START) < 0) + goto cleanup; + /* Now we can start the domain */ VIR_DEBUG("Starting domain '%s'", vm->def->name); if (virCommandRun(cmd, NULL) < 0) @@ -200,6 +226,9 @@ virBhyveProcessStart(virConnectPtr conn, BHYVE_STATE_DIR) < 0) goto cleanup; =20 + if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_STARTED) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: @@ -263,6 +292,8 @@ virBhyveProcessStop(bhyveConnPtr driver, if ((priv !=3D NULL) && (priv->mon !=3D NULL)) bhyveMonitorClose(priv->mon); =20 + bhyveProcessStopHook(vm, VIR_HOOK_BHYVE_OP_STOPPED); + /* Cleanup network interfaces */ bhyveNetCleanup(vm); =20 @@ -284,6 +315,8 @@ virBhyveProcessStop(bhyveConnPtr driver, vm->pid =3D -1; vm->def->id =3D -1; =20 + bhyveProcessStopHook(vm, VIR_HOOK_BHYVE_OP_RELEASE); + cleanup: virCommandFree(cmd); =20 diff --git a/src/util/virhook.c b/src/util/virhook.c index 5bdacdd79f..e499841f66 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -47,6 +47,7 @@ VIR_ENUM_DECL(virHookQemuOp); VIR_ENUM_DECL(virHookLxcOp); VIR_ENUM_DECL(virHookNetworkOp); VIR_ENUM_DECL(virHookLibxlOp); +VIR_ENUM_DECL(virHookBhyveOp); =20 VIR_ENUM_IMPL(virHookDriver, VIR_HOOK_DRIVER_LAST, @@ -55,6 +56,7 @@ VIR_ENUM_IMPL(virHookDriver, "lxc", "network", "libxl", + "bhyve", ); =20 VIR_ENUM_IMPL(virHookDaemonOp, @@ -115,6 +117,15 @@ VIR_ENUM_IMPL(virHookLibxlOp, "reconnect", ); =20 +VIR_ENUM_IMPL(virHookBhyveOp, + VIR_HOOK_BHYVE_OP_LAST, + "start", + "stopped", + "prepare", + "release", + "started", +); + static int virHooksFound =3D -1; =20 /** @@ -283,6 +294,10 @@ virHookCall(int driver, break; case VIR_HOOK_DRIVER_NETWORK: opstr =3D virHookNetworkOpTypeToString(op); + break; + case VIR_HOOK_DRIVER_BHYVE: + opstr =3D virHookBhyveOpTypeToString(op); + break; } if (opstr =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/util/virhook.h b/src/util/virhook.h index f91cb87b10..d8237c837e 100644 --- a/src/util/virhook.h +++ b/src/util/virhook.h @@ -29,6 +29,7 @@ typedef enum { VIR_HOOK_DRIVER_LXC, /* LXC domains related events */ VIR_HOOK_DRIVER_NETWORK, /* network related events */ VIR_HOOK_DRIVER_LIBXL, /* Xen libxl domains related events= */ + VIR_HOOK_DRIVER_BHYVE, /* Bhyve domains related events */ =20 VIR_HOOK_DRIVER_LAST, } virHookDriverType; @@ -97,6 +98,16 @@ typedef enum { VIR_HOOK_LIBXL_OP_LAST, } virHookLibxlOpType; =20 +typedef enum { + VIR_HOOK_BHYVE_OP_START, /* domain is about to start */ + VIR_HOOK_BHYVE_OP_STOPPED, /* domain has stopped */ + VIR_HOOK_BHYVE_OP_PREPARE, /* domain startup initiated */ + VIR_HOOK_BHYVE_OP_RELEASE, /* domain destruction is over */ + VIR_HOOK_BHYVE_OP_STARTED, /* domain has started */ + + VIR_HOOK_BHYVE_OP_LAST, +} virHookBhyveOpType; + int virHookInitialize(void); =20 int virHookPresent(int driver); --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353648; cv=none; d=zohomail.com; s=zohoarc; b=chxtWFYrMOuo30MBAY61W/Xr0wvVw6pfuPzHRLbTxd3rA1OhPkRboSdmFoMHcREan8fndr5QIc7bjyRhoVNShrwPY7Z2Ug9lzFqNkPRckzGRUp4Im8eCi28iSL/L+KC02zK7yIK+Ie+yebQsfc3tc9ibPJ+z2DJLj4jJsetP4yg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353648; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ITlRbxUaLtP6HeziRCZZEZKL8ecpRPv07lIYBDd51g8=; b=KetSvl4FXGxkbK9RBfMDt9WwXmvwdZUhW+mAS1nERjoEHmb8ypfxhQnI8p6jTQmt7wA1jj2c82wFhDW4aJamjjVezhuXiN7tDcyPFWVLoKtSfoNdh1FLVzZyS/+4FuAjxlF956RjVtWpoQ8D0PdSgScy029HEo3jzy2Km4VKeKk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582353648126715.3901479435158; Fri, 21 Feb 2020 22:40:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-53-Xf7l82fKMm6DpyZlBulUUA-1; Sat, 22 Feb 2020 01:40:44 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BB6A800EB4; Sat, 22 Feb 2020 06:40:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E63E810027BF; Sat, 22 Feb 2020 06:40:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 96939860D3; Sat, 22 Feb 2020 06:40:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dpD6021784 for ; Sat, 22 Feb 2020 01:39:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA3FC1032547; Sat, 22 Feb 2020 06:39:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C49C71032531 for ; Sat, 22 Feb 2020 06:39:47 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A1D4800313 for ; Sat, 22 Feb 2020 06:39:47 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-6nLbKp31MYWMguhtRVYUPQ-1; Sat, 22 Feb 2020 01:39:45 -0500 Received: by mail-yw1-f67.google.com with SMTP id t141so2614269ywc.11 for ; Fri, 21 Feb 2020 22:39:45 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353647; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ITlRbxUaLtP6HeziRCZZEZKL8ecpRPv07lIYBDd51g8=; b=JEcb0ek+1ITmILDkRmFCad+J+u7KsZy7QH4sIFJBwm559bm93cJVO8/JM5Rk9GpR/3XNCX rIg5kU6Wq+tT8QDHYH+iDY/0lsBVweTvr6TSZLgbCojD4vo/AseFtvjG8AnEqdDRlGOQPh m26CNF94gFfWWi6zGE8wFvB5pVA+Hrw= X-MC-Unique: Xf7l82fKMm6DpyZlBulUUA-1 X-MC-Unique: 6nLbKp31MYWMguhtRVYUPQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5wVTud9ilV8De9l3NZaP/kXUQVtho4TEL2gccD9UyTA=; b=Uko2KlBVueBrqmFlMP8Ne4MDFSwZXtGRgTCnFkhjthBT++fLZpX6aVEKF7ShfiKstI +vMwgri1AYsgAdGaZ/dN+ZuNSmKzmSvusWYziSJqdklwo2opO1LfeAh88DKGqQN+kfNf kItfxIDcZGHS/QiIJYFGJggPwvS/hibIuOC7W5Oj+pnBXQWJJSjIyJKn7ZPeglXQyyj8 VYWcDHYucJLDAj5oLGsVUiVaV58QUhg3bt3Y+9fDfePiusQPlqqb0/D0BjGW1dK0uKed rMy7BJP+eBVg8rriyHK9RdywJI2ApjIFdIkc7xWkjPoqfKhR1z4ERoPLzBWNUW4LwEhb OxSw== X-Gm-Message-State: APjAAAUjty9eH/vTUSygsd2tox2bhbjCrWj75aEtDDTDRyUVKskKzpFH hQJcW2LpeDmk8SKWwQRWVBIMURAnOvCp9klk2hhOhMGbdKWM75HlRgvYu35qZDE7uQus2ea+JV2 JbdMQqoo2Bip1rl/2hsp8/g3VFn7gP7hYgrrDeb6Uxu3Cs8DuTmiSWS5RqYx4l6l6ZX8= X-Google-Smtp-Source: APXvYqzi0zvSRJm3NS2JWEa0si0QkRussuizPfo91TX6fFo40vvVHpuTxieXg4QL9NXWYyQLFUoXEg== X-Received: by 2002:a0d:d7c3:: with SMTP id z186mr33394178ywd.454.1582353584437; Fri, 21 Feb 2020 22:39:44 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 11/16] Add reboot support for bhyve backend Date: Sat, 22 Feb 2020 01:38:50 -0500 Message-Id: <20200222063855.89637-12-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dpD6021784 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_driver.c | 30 ++++++++++++++++++++++ src/bhyve/bhyve_monitor.c | 19 +++++++++----- src/bhyve/bhyve_monitor.h | 2 ++ src/bhyve/bhyve_process.c | 52 ++++++++++++++++++++++++++++----------- src/bhyve/bhyve_process.h | 3 +++ 5 files changed, 85 insertions(+), 21 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 625dc0ec22..05ffc2f050 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1013,6 +1013,35 @@ bhyveDomainShutdown(virDomainPtr dom) return bhyveDomainShutdownFlags(dom, 0); } =20 +static int +bhyveDomainReboot(virDomainPtr dom, unsigned int flags) +{ + virConnectPtr conn =3D dom->conn; + virDomainObjPtr vm; + bhyveDomainObjPrivatePtr priv; + int ret =3D -1; + + virCheckFlags(VIR_DOMAIN_REBOOT_ACPI_POWER_BTN, -1); + + if (!(vm =3D bhyveDomObjFromDomain(dom))) + goto cleanup; + + if (virDomainRebootEnsureACL(conn, vm->def, flags) < 0) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + priv =3D vm->privateData; + bhyveMonitorSetReboot(priv->mon); + + ret =3D virBhyveProcessShutdown(vm); + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int bhyveDomainOpenConsole(virDomainPtr dom, const char *dev_name G_GNUC_UNUSED, @@ -1657,6 +1686,7 @@ static virHypervisorDriver bhyveHypervisorDriver =3D { .domainDestroyFlags =3D bhyveDomainDestroyFlags, /* 5.6.0 */ .domainShutdown =3D bhyveDomainShutdown, /* 1.3.3 */ .domainShutdownFlags =3D bhyveDomainShutdownFlags, /* 5.6.0 */ + .domainReboot =3D bhyveDomainReboot, /* TBD */ .domainLookupByUUID =3D bhyveDomainLookupByUUID, /* 1.2.2 */ .domainLookupByName =3D bhyveDomainLookupByName, /* 1.2.2 */ .domainLookupByID =3D bhyveDomainLookupByID, /* 1.2.3 */ diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index a1b1a21a6f..e5cd39a086 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -41,10 +41,11 @@ VIR_LOG_INIT("bhyve.bhyve_monitor"); struct _bhyveMonitor { virObject parent; =20 - int kq; - int watch; bhyveConnPtr driver; virDomainObjPtr vm; + int kq; + int watch; + bool reboot; }; =20 static virClassPtr bhyveMonitorClass; @@ -100,6 +101,12 @@ bhyveMonitorUnregister(bhyveMonitorPtr mon) mon->watch =3D -1; } =20 +void +bhyveMonitorSetReboot(bhyveMonitorPtr mon) +{ + mon->reboot =3D true; +} + static void bhyveMonitorIO(int watch, int kq, int events G_GNUC_UNUSED, void *opaque) { @@ -148,11 +155,10 @@ bhyveMonitorIO(int watch, int kq, int events G_GNUC_U= NUSED, void *opaque) name, WTERMSIG(status)); virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED); } else if (WIFEXITED(status)) { - if (WEXITSTATUS(status) =3D=3D 0) { + if (WEXITSTATUS(status) =3D=3D 0 || mon->reboot) { /* 0 - reboot */ - /* TODO: Implementing reboot is a little more complicated.= */ - VIR_INFO("Guest %s rebooted; destroying domain.", name); - virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOW= N); + VIR_INFO("Guest %s rebooted; restarting domain.", name); + virBhyveProcessRestart(driver, vm); } else if (WEXITSTATUS(status) < 3) { /* 1 - shutdown, 2 - halt, 3 - triple fault. others - erro= r */ VIR_INFO("Guest %s shut itself down; destroying domain.", = name); @@ -179,6 +185,7 @@ bhyveMonitorOpenImpl(virDomainObjPtr vm, bhyveConnPtr d= river) return NULL; =20 mon->driver =3D driver; + mon->reboot =3D false; =20 virObjectRef(vm); mon->vm =3D vm; diff --git a/src/bhyve/bhyve_monitor.h b/src/bhyve/bhyve_monitor.h index 226866e6d9..175cc87192 100644 --- a/src/bhyve/bhyve_monitor.h +++ b/src/bhyve/bhyve_monitor.h @@ -29,3 +29,5 @@ typedef bhyveMonitor *bhyveMonitorPtr; =20 bhyveMonitorPtr bhyveMonitorOpen(virDomainObjPtr vm, bhyveConnPtr driver); void bhyveMonitorClose(bhyveMonitorPtr mon); + +void bhyveMonitorSetReboot(bhyveMonitorPtr mon); diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index 45162503d4..060018bc70 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -110,11 +110,10 @@ bhyveProcessStopHook(virDomainObjPtr vm, virHookBhyve= OpType op) VIR_HOOK_SUBOP_END, NULL, NULL, NULL); } =20 -int -virBhyveProcessStart(virConnectPtr conn, - virDomainObjPtr vm, - virDomainRunningReason reason, - unsigned int flags) +static int +virBhyveProcessStartImpl(bhyveConnPtr driver, + virDomainObjPtr vm, + virDomainRunningReason reason) { char *devmap_file =3D NULL; char *devicemap =3D NULL; @@ -122,7 +121,6 @@ virBhyveProcessStart(virConnectPtr conn, int logfd =3D -1; virCommandPtr cmd =3D NULL; virCommandPtr load_cmd =3D NULL; - bhyveConnPtr driver =3D conn->privateData; bhyveDomainObjPrivatePtr priv =3D vm->privateData; int ret =3D -1, rc; =20 @@ -154,10 +152,6 @@ virBhyveProcessStart(virConnectPtr conn, if (bhyveDomainAssignAddresses(vm->def, NULL) < 0) goto cleanup; =20 - /* Run an early hook to setup missing devices. */ - if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) - goto cleanup; - /* Call bhyve to start the VM */ if (!(cmd =3D virBhyveProcessBuildBhyveCmd(driver, vm->def, false))) goto cleanup; @@ -213,11 +207,6 @@ virBhyveProcessStart(virConnectPtr conn, goto cleanup; } =20 - if (flags & VIR_BHYVE_PROCESS_START_AUTODESTROY && - virCloseCallbacksSet(driver->closeCallbacks, vm, - conn, bhyveProcessAutoDestroy) < 0) - goto cleanup; - vm->def->id =3D vm->pid; virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason); priv->mon =3D bhyveMonitorOpen(vm, driver); @@ -262,6 +251,26 @@ virBhyveProcessStart(virConnectPtr conn, return ret; } =20 +int +virBhyveProcessStart(virConnectPtr conn, + virDomainObjPtr vm, + virDomainRunningReason reason, + unsigned int flags) +{ + bhyveConnPtr driver =3D conn->privateData; + + /* Run an early hook to setup missing devices. */ + if (bhyveProcessStartHook(vm, VIR_HOOK_BHYVE_OP_PREPARE) < 0) + return -1; + + if (flags & VIR_BHYVE_PROCESS_START_AUTODESTROY && + virCloseCallbacksSet(driver->closeCallbacks, vm, + conn, bhyveProcessAutoDestroy) < 0) + return -1; + + return virBhyveProcessStartImpl(driver, vm, reason); +} + int virBhyveProcessStop(bhyveConnPtr driver, virDomainObjPtr vm, @@ -349,6 +358,19 @@ virBhyveProcessShutdown(virDomainObjPtr vm) return 0; } =20 +int +virBhyveProcessRestart(bhyveConnPtr driver, + virDomainObjPtr vm) +{ + if (virBhyveProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_SHUTDOWN) < 0) + return -1; + + if (virBhyveProcessStartImpl(driver, vm, VIR_DOMAIN_RUNNING_BOOTED) < = 0) + return -1; + + return 0; +} + int virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm, unsigned long long *cpustats) diff --git a/src/bhyve/bhyve_process.h b/src/bhyve/bhyve_process.h index 8419e44faa..d7b4e0bd4e 100644 --- a/src/bhyve/bhyve_process.h +++ b/src/bhyve/bhyve_process.h @@ -32,6 +32,9 @@ int virBhyveProcessStop(bhyveConnPtr driver, virDomainObjPtr vm, virDomainShutoffReason reason); =20 +int virBhyveProcessRestart(bhyveConnPtr driver, + virDomainObjPtr vm); + int virBhyveProcessShutdown(virDomainObjPtr vm); =20 int virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm, --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353647; cv=none; d=zohomail.com; s=zohoarc; b=ANT17pZLbBrcQCZ9iFzBxK76Q59ZfAhZ6A9hF7BjOyFJFh0FBP62j2aaSjyP4p9twuWo/w88d+XoBFCpjimX5Tsyl9sj4L/Lhz5hYfVypQqY72LPmq/zRFZSZR0Myo/pTvHLYybmzheTWoCL80gIajhVqnqNj40qctpgRJmUczQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353647; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JGt5jyCDU5Vy/QsIGHO7FJ7Sdgy7s+MlIhWEOjhAz4U=; b=KxJBHCI0gwUj89dD30+unkQqjoKrjlAsdqmO7Qx/+326bJrp/xDIsbuCQA6PsUgSyu6MzV9/590G4R6YaPhYHQTorWMjEtRkLjIfmOEqTzzi3OwMu0LynT0wSLiSOVG3qDgXMaBHv7G5sDJJrVjKBnzIQQC45ouANqOoLV741FA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582353647591875.1948549762478; Fri, 21 Feb 2020 22:40:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-454-cbHCMmxNOH2bpouZsWqLVA-1; Sat, 22 Feb 2020 01:40:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5812B801E5C; Sat, 22 Feb 2020 06:40:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F74060BE0; Sat, 22 Feb 2020 06:40:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E11F7860D6; Sat, 22 Feb 2020 06:40:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6dsst021793 for ; Sat, 22 Feb 2020 01:39:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0D2C913BB85; Sat, 22 Feb 2020 06:39:54 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0907713AF75 for ; Sat, 22 Feb 2020 06:39:54 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E4697101A55A for ; Sat, 22 Feb 2020 06:39:53 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-172-2uPdBgI4OICG9zRsCvThVg-1; Sat, 22 Feb 2020 01:39:51 -0500 Received: by mail-yw1-f67.google.com with SMTP id b186so2649071ywc.1 for ; Fri, 21 Feb 2020 22:39:51 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353646; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JGt5jyCDU5Vy/QsIGHO7FJ7Sdgy7s+MlIhWEOjhAz4U=; b=JCFEcqH5+OKF+2aw4xhb0mYddxgaXmGpJIcqJB4DsqWF9HnXyreNXw3KsrIt2oiNmCxn3z aYDXpTm9J75x73F7Tr+f7mtuvadYgIKqv8CG6h7pokvkMgIp4VFxNrwfBbaf0lseWKAnc5 R4NGPMiZDvOIghI3S1VT6tI5Lk+rrfg= X-MC-Unique: cbHCMmxNOH2bpouZsWqLVA-1 X-MC-Unique: 2uPdBgI4OICG9zRsCvThVg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x+gFL3xwJNy1ZwzVJUmNJUNXuD8EUPkdnIKqRgeEvAE=; b=l2v0vxaYZ5pIuKOCAaHQtTRIQdaAnGl4BtVZ++fMqnCIXXhQc9Oi9Bm/XOiaEzHegZ TTjKol0Fm/Czi39ivk9HDNJInwZPKLzAXOZQ+0llvUFbe3JdZCU4rMib+am8ggnRhy/U /9T1YhV6Lk0mpB6vkCkDN/kNyvKDY3kXDmQ2QTHSL4IUAnryQKF5u0pZ5+UwK+Y9eJ+0 wcVwlbFyZXPeclyOCmiMaSmjVkzRZssjBvRNT3/OBUgoSOgWtB9g5L/IUeSgq18xazkL XxxNL0zMVa4tPCkrUFgB6doaAWrNunpmNElXPTXi60XOkXrANTQ8juyLWuTbrIOMbG4t z7xg== X-Gm-Message-State: APjAAAVKBq1eVVR5vLM4RLTROeo8uZk8sVtlDYpAqIKzicd6vNn5p/OA ynTGQ4cdN77ngnv08VU+ulNddWcpm//a2RPSDAexBLbY/FbGV+hjU6uoBb6oH92u2FMnpS01pee QRolK+3kh8S34Eg3KiiO+U+jgJ3kHSny9NJc54LsgUVvQa2Wmnw5fCvVUBkCk5dk1pYw= X-Google-Smtp-Source: APXvYqxnF2oOX4g/dpUNpVITHs/yRNJ7F7Wyd7Ccjyf2wEiuHD/T9ZZKpBueW+GGYF7//bKWkgGJdw== X-Received: by 2002:a81:1289:: with SMTP id 131mr34294553yws.74.1582353590985; Fri, 21 Feb 2020 22:39:50 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 12/16] Refactor virBhyveProcessBuildBhyveCmd a bit Date: Sat, 22 Feb 2020 01:38:51 -0500 Message-Id: <20200222063855.89637-13-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6dsst021793 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Reduces the complexity by isolating loop bodies in separate functions. Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_command.c | 115 ++++++++++++++++++++++---------------- 1 file changed, 67 insertions(+), 48 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 7e420165aa..bf1cfef3ab 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -44,9 +44,9 @@ VIR_LOG_INIT("bhyve.bhyve_command"); =20 static int -bhyveBuildNetArgStr(bhyveConnPtr driver, - const virDomainDef *def, +bhyveBuildNetArgStr(const virDomainDef *def, virDomainNetDefPtr net, + bhyveConnPtr driver, virCommandPtr cmd, bool dryRun) { @@ -311,6 +311,61 @@ bhyveBuildVirtIODiskArgStr(const virDomainDef *def G_G= NUC_UNUSED, return 0; } =20 +static int +bhyveBuildDiskArgStr(const virDomainDef *def, + virDomainDiskDefPtr disk, + virCommandPtr cmd) +{ + switch (disk->bus) { + case VIR_DOMAIN_DISK_BUS_SATA: + /* Handled by bhyveBuildAHCIControllerArgStr() */ + break; + case VIR_DOMAIN_DISK_BUS_VIRTIO: + if (bhyveBuildVirtIODiskArgStr(def, disk, cmd) < 0) + return -1; + break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported disk device")); + return -1; + } + return 0; +} + +static int +bhyveBuildControllerArgStr(const virDomainDef *def, + virDomainControllerDefPtr controller, + bhyveConnPtr driver, + virCommandPtr cmd, + unsigned *nusbcontrollers) +{ + switch (controller->type) { + case VIR_DOMAIN_CONTROLLER_TYPE_PCI: + if (controller->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported PCI controller model: " + "only PCI root supported")); + return -1; + } + break; + case VIR_DOMAIN_CONTROLLER_TYPE_SATA: + if (bhyveBuildAHCIControllerArgStr(def, controller, driver, cmd) <= 0) + return -1; + break; + case VIR_DOMAIN_CONTROLLER_TYPE_USB: + if (++*nusbcontrollers > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("only single USB controller is supported")); + return -1; + } + + if (bhyveBuildUSBControllerArgStr(def, controller, cmd) < 0) + return -1; + break; + } + return 0; +} + static int bhyveBuildLPCArgStr(const virDomainDef *def G_GNUC_UNUSED, virCommandPtr cmd) @@ -432,8 +487,8 @@ bhyveBuildGraphicsArgStr(const virDomainDef *def, } =20 virCommandPtr -virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, - virDomainDefPtr def, bool dryRun) +virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virDomainDefPtr def, + bool dryRun) { /* * /usr/sbin/bhyve -c 2 -m 256 -AI -H -P \ @@ -443,11 +498,10 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, * -S 31,uart,stdio \ * vm0 */ - size_t i; - int nusbcontrollers =3D 0; - unsigned int nvcpus =3D virDomainDefGetVcpus(def); - virCommandPtr cmd =3D virCommandNew(BHYVE); + size_t i; + unsigned nusbcontrollers =3D 0; + unsigned nvcpus =3D virDomainDefGetVcpus(def); =20 /* CPUs */ virCommandAddArg(cmd, "-c"); @@ -551,52 +605,17 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, =20 /* Devices */ for (i =3D 0; i < def->ncontrollers; i++) { - virDomainControllerDefPtr controller =3D def->controllers[i]; - switch (controller->type) { - case VIR_DOMAIN_CONTROLLER_TYPE_PCI: - if (controller->model !=3D VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROO= T) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("unsupported PCI controller model: = only PCI root supported")); - goto error; - } - break; - case VIR_DOMAIN_CONTROLLER_TYPE_SATA: - if (bhyveBuildAHCIControllerArgStr(def, controller, driver, cm= d) < 0) - goto error; - break; - case VIR_DOMAIN_CONTROLLER_TYPE_USB: - if (++nusbcontrollers > 1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("only single USB controller is supp= orted")); - goto error; - } - - if (bhyveBuildUSBControllerArgStr(def, controller, cmd) < 0) - goto error; - break; - } + if (bhyveBuildControllerArgStr(def, def->controllers[i], driver, c= md, + &nusbcontrollers) < 0) + goto error; } for (i =3D 0; i < def->nnets; i++) { - virDomainNetDefPtr net =3D def->nets[i]; - if (bhyveBuildNetArgStr(driver, def, net, cmd, dryRun) < 0) + if (bhyveBuildNetArgStr(def, def->nets[i], driver, cmd, dryRun) < = 0) goto error; } for (i =3D 0; i < def->ndisks; i++) { - virDomainDiskDefPtr disk =3D def->disks[i]; - - switch (disk->bus) { - case VIR_DOMAIN_DISK_BUS_SATA: - /* Handled by bhyveBuildAHCIControllerArgStr() */ - break; - case VIR_DOMAIN_DISK_BUS_VIRTIO: - if (bhyveBuildVirtIODiskArgStr(def, disk, cmd) < 0) - goto error; - break; - default: - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("unsupported disk device")); + if (bhyveBuildDiskArgStr(def, def->disks[i], cmd) < 0) goto error; - } } =20 if (def->ngraphics && def->nvideos) { --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353672; cv=none; d=zohomail.com; s=zohoarc; b=Wr14HtoYmaIhnLCCFwkNTYphj0n/HJf56uEp1NzAvIs+17RJHo7OU8XtPSRkTCtSnneLygWiVsvbGZSwIslWiSm+qAhoHXJvTrRfKZmBxWyHLfC4N6cjxL7NrH77ba8dbRjX6WxgrsdvBFwrfrkSolfKkyIhyCd2DBuPmp1LTUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353672; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aWE8/ZnHZR8MlzA0CC9WI4D0HudxGJ/bNvOMtXO3qkI=; b=BZNlKHelBN49ZcZ36FaLaTwydHYnGvKQS0t5Aq6NDd8vkdqq5S9tVgjM4PL7vRnhwuxEA9K0ACgQAX8hG9pumJMp0PEXbRYGZFH2ra6yNzRxpBGkLFtcPV+heoN331m9guYzqh3CzGITqxtGmILWNgVDDpLK6nENneg//eOy/9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353672381903.6093332642479; Fri, 21 Feb 2020 22:41:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-xmCLqeWQMsGmIngqRRfs7g-1; Sat, 22 Feb 2020 01:41:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4BF93107ACCD; Sat, 22 Feb 2020 06:41:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1FA3760C99; Sat, 22 Feb 2020 06:41:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C90B018089CE; Sat, 22 Feb 2020 06:41:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6e0Qr021810 for ; Sat, 22 Feb 2020 01:40:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3DCE01032530; Sat, 22 Feb 2020 06:40:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 390911032523 for ; Sat, 22 Feb 2020 06:39:59 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F110800313 for ; Sat, 22 Feb 2020 06:39:59 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-36--cmZ5_-EPMaHtRDefB22Xw-1; Sat, 22 Feb 2020 01:39:57 -0500 Received: by mail-yw1-f67.google.com with SMTP id h126so2638608ywc.6 for ; Fri, 21 Feb 2020 22:39:57 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.39.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aWE8/ZnHZR8MlzA0CC9WI4D0HudxGJ/bNvOMtXO3qkI=; b=RO0MxccCEyjjcxzQBd6pc8LomdH4f/8zX2OJ2MfYgma2Rud/maWPAPO0ZCIZu862Z3n7gA x/Z5YjUVYK9IBCdRxL1eofcCKuSncnNE/rBBj9vke1M5Aw+XywLpKOaA9P7DVFI19p7BHa MR3sdpEWSz9+fM9r5PZMLelVpTR6pKE= X-MC-Unique: xmCLqeWQMsGmIngqRRfs7g-1 X-MC-Unique: -cmZ5_-EPMaHtRDefB22Xw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vFN3zFwCvozzmghGxS+Og86Nz8uVQoujAylproiYdns=; b=bECu+khLv6szzaybfQiKNduhSr/uPRJMTmP4nDAAwO9IGvuk3FDxS/MMhFxThQvrVo ms5Usovlezbv0fGbyb7Juk/r+QrLR/U1MvCrO2wAIucLDppA3Q/IFnsD3WnhLPyf/p/W 9zbkKroSGvCXt234TY3kkQ4OIqYuiaZxdzf7tLnzxgl55KxiMye6+ti9gjS+x9tHpVOH qQGoMvESiLFIgrNTJV/MVJKtf2cPsKtkgqKQU7i7r+k/fuSqCdVSLF3zqcBdrzuKrf4P ClYGYEIjIlST6s/PphK633bkbqUJY3PQjGIM0QVAf5pP+bJSZaHxzx2wmB9G9CenDMPs 2nHw== X-Gm-Message-State: APjAAAXhpts5qdBQYgUsOCEueAsfZVtyyZDLe9ftXO9XTbfyXFW43CCw oWHTk1MJoB1HXURZZYpGz5Tx1Ljfe9EJgsNBjEtW14RcMOgnMLKqRuteMzmNHz2u+gPZ3LsajEY ml/IAeM/pS2LMx1dGNY0e/5q8sriJssnkRcjmpTmwi6dReHoV3eeylbz2AIgGCDb7Pc0= X-Google-Smtp-Source: APXvYqxi8xhexYv2yz4VLiWQXpmPlZWoKl/ALUHCatfZkuSakyuDy/VvVXzOWTf1jr+P51MGieCcbQ== X-Received: by 2002:a25:e755:: with SMTP id e82mr40163127ybh.365.1582353596348; Fri, 21 Feb 2020 22:39:56 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 13/16] Reorder slot,bus,func -> bus,slot,func in parsers Date: Sat, 22 Feb 2020 01:38:52 -0500 Message-Id: <20200222063855.89637-14-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6e0Qr021810 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This *is* a no-op, but there was a period of sickening dread while auditing to be sure that no actual confusion between bus and slot had occurred. I hope to avoid that by following the conventional order. Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_parse_command.c | 34 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_comman= d.c index dd6a626ff4..76423730d9 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -352,8 +352,8 @@ bhyveParseBhyveLPCArg(virDomainDefPtr def, =20 static int bhyveParsePCISlot(const char *slotdef, - unsigned *pcislot, unsigned *bus, + unsigned *slot, unsigned *function) { /* slot[:function] | bus:slot:function */ @@ -385,7 +385,7 @@ bhyveParsePCISlot(const char *slotdef, } =20 *bus =3D 0; - *pcislot =3D 0; + *slot =3D 0; *function =3D 0; =20 switch (i + 1) { @@ -393,12 +393,12 @@ bhyveParsePCISlot(const char *slotdef, /* pcislot[:function] */ *function =3D values[1]; case 1: - *pcislot =3D values[0]; + *slot =3D values[0]; break; case 3: /* bus:pcislot:function */ *bus =3D values[0]; - *pcislot =3D values[1]; + *slot =3D values[1]; *function =3D values[2]; break; } @@ -409,8 +409,8 @@ bhyveParsePCISlot(const char *slotdef, static int bhyveParsePCIDisk(virDomainDefPtr def, unsigned caps G_GNUC_UNUSED, - unsigned pcislot, unsigned pcibus, + unsigned pcislot, unsigned function, int bus, int device, @@ -430,8 +430,8 @@ bhyveParsePCIDisk(virDomainDefPtr def, disk->device =3D device; =20 disk->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; - disk->info.addr.pci.slot =3D pcislot; disk->info.addr.pci.bus =3D pcibus; + disk->info.addr.pci.slot =3D pcislot; disk->info.addr.pci.function =3D function; =20 if (STRPREFIX(config, "/dev/")) @@ -480,8 +480,8 @@ static int bhyveParsePCINet(virDomainDefPtr def, virDomainXMLOptionPtr xmlopt, unsigned caps G_GNUC_UNUSED, - unsigned pcislot, - unsigned pcibus, + unsigned bus, + unsigned slot, unsigned function, int model, const char *config) @@ -503,8 +503,8 @@ bhyveParsePCINet(virDomainDefPtr def, =20 net->model =3D model; net->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; - net->info.addr.pci.slot =3D pcislot; - net->info.addr.pci.bus =3D pcibus; + net->info.addr.pci.bus =3D bus; + net->info.addr.pci.slot =3D slot; net->info.addr.pci.function =3D function; =20 if (!config) @@ -565,7 +565,7 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def, char *slotdef =3D NULL; char *emulation =3D NULL; char *conf =3D NULL; - unsigned pcislot, bus, function; + unsigned bus, slot, function; =20 separator =3D strchr(arg, ','); =20 @@ -584,35 +584,35 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def, emulation =3D g_strdup(separator); } =20 - if (bhyveParsePCISlot(slotdef, &pcislot, &bus, &function) < 0) + if (bhyveParsePCISlot(slotdef, &bus, &slot, &function) < 0) goto error; =20 if (STREQ(emulation, "ahci-cd")) - bhyveParsePCIDisk(def, caps, pcislot, bus, function, + bhyveParsePCIDisk(def, caps, bus, slot, function, VIR_DOMAIN_DISK_BUS_SATA, VIR_DOMAIN_DISK_DEVICE_CDROM, nvirtiodisk, nahcidisk, conf); else if (STREQ(emulation, "ahci-hd")) - bhyveParsePCIDisk(def, caps, pcislot, bus, function, + bhyveParsePCIDisk(def, caps, bus, slot, function, VIR_DOMAIN_DISK_BUS_SATA, VIR_DOMAIN_DISK_DEVICE_DISK, nvirtiodisk, nahcidisk, conf); else if (STREQ(emulation, "virtio-blk")) - bhyveParsePCIDisk(def, caps, pcislot, bus, function, + bhyveParsePCIDisk(def, caps, bus, slot, function, VIR_DOMAIN_DISK_BUS_VIRTIO, VIR_DOMAIN_DISK_DEVICE_DISK, nvirtiodisk, nahcidisk, conf); else if (STREQ(emulation, "virtio-net")) - bhyveParsePCINet(def, xmlopt, caps, pcislot, bus, function, + bhyveParsePCINet(def, xmlopt, caps, bus, slot, function, VIR_DOMAIN_NET_MODEL_VIRTIO, conf); else if (STREQ(emulation, "e1000")) - bhyveParsePCINet(def, xmlopt, caps, pcislot, bus, function, + bhyveParsePCINet(def, xmlopt, caps, bus, slot, function, VIR_DOMAIN_NET_MODEL_E1000, conf); =20 VIR_FREE(emulation); --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353672; cv=none; d=zohomail.com; s=zohoarc; b=bJmgVby0N/5mVg1W5drHcxRvVoqGRHf3PMu3lECMtD/Lm27OtdkOBTPtDrhFvghxAZ13GcV3BkI4hGQYXV02BGkZ87ih5QTFecRfgONShoW/znmOX1sXar4eccDpNwLOZVrtGvziWvT9y4HN509OJtnYsPe9mEvYSqHyiH4UoOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353672; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4dVA5KAUtiNM6fHDzofIs9+0mzRfRuxXaKYXlzvfjsM=; b=aIB3bmBqR+GMYewnwCMl0MfAPGCyKcpoel8t+mX26Sunb2ESR2LH41ikGTGPxITnHcmChKPfprnMB30fH8rCoa9hgoDY9AJysDZNr+AXqv54ka+06HmUtjecfWHf6z9NqxoX0ltfKRAfWK54N3kTIkXfHJ/UjK5ZXGBknFAxik0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353672672399.83197442138066; Fri, 21 Feb 2020 22:41:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-ihdp7O-OPUyt6e94nmJCoA-1; Sat, 22 Feb 2020 01:41:09 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3C6A18010F5; Sat, 22 Feb 2020 06:41:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 068B591838; Sat, 22 Feb 2020 06:41:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A6858860D5; Sat, 22 Feb 2020 06:41:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6e8pY021838 for ; Sat, 22 Feb 2020 01:40:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3F95313BB8E; Sat, 22 Feb 2020 06:40:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A12E13BBA7 for ; Sat, 22 Feb 2020 06:40:05 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5BBA4101A55A for ; Sat, 22 Feb 2020 06:40:05 +0000 (UTC) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-aBfh3swDORywWWl0YRvBfQ-1; Sat, 22 Feb 2020 01:40:02 -0500 Received: by mail-yw1-f67.google.com with SMTP id b186so2649299ywc.1 for ; Fri, 21 Feb 2020 22:40:02 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.40.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:40:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353671; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4dVA5KAUtiNM6fHDzofIs9+0mzRfRuxXaKYXlzvfjsM=; b=FfRaRQ1WU0vjLreIyE0NaPvcufuEZmdNZGe0qpIIpKat4kU1tGo3/VP4N9YOlppvHNv8NN BptcGHgOFlrMBzgHbNqQvomOhVo5ZDwcegA6uwl/ekf5GR4pFgVmCsTwvGWMfpMU8lQsaY Np7M5mjhWEnI/NuwbnV/EHpTAhVWMw0= X-MC-Unique: ihdp7O-OPUyt6e94nmJCoA-1 X-MC-Unique: aBfh3swDORywWWl0YRvBfQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JnkevWrjmKyy8d9AF9lv5RRRxuqeduExNx+3OAA3CKg=; b=teYzYQ4VtWBL8Rlu+4JJj75/CMCWCaeufHLGqhp0uBjpEO1cYTFBJ9uU3HSE6tPHgm pUWinFLwSokxOyAgKfiXahsXRPg8MlI1gPC/XhF1RQ/7O+sAssYgWG6fnF39/p+DUKfG J5dwEu+JuzL9U3hoLtQx2enqsfIFJJIjLClUtlLirbzuR6GLTtnXIpN4Ud/zywJaC+gj SASngi6/OlqJ3KXVhc+X6vq7rZl3ZKFXChUuNHEMUDuBpJlT3tiV0D26jnKucOxuVooE chikXrWwANikDIL3+s6pa1vAMFc41uUPPJaRZK1gVhoHLhzFAwNiXnKRDRA3lFLQKx0w L3gg== X-Gm-Message-State: APjAAAWV3BOfwq0XzrBl1zS3O4l/4xhw6GwYDNVlx9wL4+X0YhQ+Tdy7 aAnkeS0Mj73YCrtNnzCvHYLLByR/o7dM+TfTwLDGOI8hzfFWPHSodxvytyzW4pRTPYug5g9S5fw gZlskJvzUCt9kEWs8Dh/odjXEmTSSXBBUKMHSDM8fW9ixnl3BonbADvlRzW8YXZwFaTU= X-Google-Smtp-Source: APXvYqxCkILjoziu2zSrTaRL9alqha/nsAanWRy06NbVw9C1eTab3AZRKC2L4xy1RQAJbfFJ859eeA== X-Received: by 2002:a05:6902:6c1:: with SMTP id m1mr38402580ybt.491.1582353600603; Fri, 21 Feb 2020 22:40:00 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 14/16] Add hostdev handling for bhyve Date: Sat, 22 Feb 2020 01:38:53 -0500 Message-Id: <20200222063855.89637-15-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6e8pY021838 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Handle PCI passthrough and virtio-scsi using hostdev devices. Example PCI passthrough: domain xml snippet ```
``` loader.conf snippet ``` vmm_load=3D"YES" pptdevs=3D"6/2/0" ``` Example SCSI passthrough: domain xml snippet ```
``` ctl.conf snippet ``` portal-group "pg0" { discovery-auth-group "no-authentication" listen "127.0.0.1" } target iqn.2020-01.com.example:target0 { auth-group "no-authentication" portal-group "pg0" port ioctl/5/0 lun 0 { path "/dev/zvol/storage/lun0" } lun 1 { path "/dev/zvol/storage/lun1" } lun 2 { path "/dev/zvol/storage/lun2" } lun 3 { path "/dev/zvol/storage/lun3" } } ``` Signed-off-by: Ryan Moeller --- docs/schemas/domaincommon.rng | 30 ++++ src/bhyve/bhyve_capabilities.c | 14 ++ src/bhyve/bhyve_capabilities.h | 1 + src/bhyve/bhyve_command.c | 121 ++++++++++++++++ src/bhyve/bhyve_parse_command.c | 90 ++++++++++++ src/conf/domain_audit.c | 5 + src/conf/domain_conf.c | 131 ++++++++++++++++++ src/conf/domain_conf.h | 29 +++- src/conf/virconftypes.h | 3 + src/qemu/qemu_command.c | 2 + src/qemu/qemu_domain.c | 5 + src/qemu/qemu_hostdev.c | 1 + src/qemu/qemu_hotplug.c | 2 + src/qemu/qemu_migration.c | 1 + src/security/security_apparmor.c | 1 + src/security/security_dac.c | 28 ++++ src/security/security_selinux.c | 8 ++ .../bhyveargv2xml-passthru.args | 8 ++ .../bhyveargv2xml-passthru.xml | 26 ++++ .../bhyveargv2xml-virtio-scsi.args | 9 ++ .../bhyveargv2xml-virtio-scsi.xml | 20 +++ tests/bhyveargv2xmltest.c | 2 + .../bhyvexml2argv-passthru.args | 11 ++ .../bhyvexml2argv-passthru.ldargs | 1 + .../bhyvexml2argv-passthru.xml | 22 +++ .../bhyvexml2argv-virtio-scsi.args | 9 ++ .../bhyvexml2argv-virtio-scsi.ldargs | 1 + .../bhyvexml2argv-virtio-scsi.xml | 21 +++ tests/bhyvexml2argvtest.c | 4 +- .../bhyvexml2xmlout-passthru.xml | 29 ++++ .../bhyvexml2xmlout-virtio-scsi.xml | 23 +++ tests/bhyvexml2xmltest.c | 2 + 32 files changed, 658 insertions(+), 2 deletions(-) create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.args create mode 100644 tests/bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml create mode 100644 tests/bhyvexml2xmloutdata/bhyvexml2xmlout-virtio-scsi.x= ml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index c00ace7d9c..e5250e1f32 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4697,6 +4697,7 @@ + @@ -4723,6 +4724,34 @@ =20 =20 + + + scsi_ctl + + + + + virtio + + + + + + + + ioctl + + + + + + + + + + + + pci @@ -4734,6 +4763,7 @@ kvm vfio + vmm xen diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c index fb8829d571..fb6be0aaba 100644 --- a/src/bhyve/bhyve_capabilities.c +++ b/src/bhyve/bhyve_capabilities.c @@ -323,6 +323,17 @@ bhyveProbeCapsXHCIController(unsigned int *caps, char = *binary) } =20 =20 +static int +bhyveProbeCapsVirtioSCSI(unsigned int *caps, char *binary) +{ + return bhyveProbeCapsDeviceHelper(caps, binary, + "-s", + "0,virtio-scsi", + "pci slot 0:0: unknown device \"virt= io-scsi\"", + BHYVE_CAP_VIRTIOSCSI); +} + + int virBhyveProbeCaps(unsigned int *caps) { @@ -351,6 +362,9 @@ virBhyveProbeCaps(unsigned int *caps) if ((ret =3D bhyveProbeCapsXHCIController(caps, binary))) goto out; =20 + if ((ret =3D bhyveProbeCapsVirtioSCSI(caps, binary))) + goto out; + out: VIR_FREE(binary); return ret; diff --git a/src/bhyve/bhyve_capabilities.h b/src/bhyve/bhyve_capabilities.h index 12926cf423..bb62bdfb15 100644 --- a/src/bhyve/bhyve_capabilities.h +++ b/src/bhyve/bhyve_capabilities.h @@ -49,6 +49,7 @@ typedef enum { BHYVE_CAP_FBUF =3D 1 << 4, BHYVE_CAP_XHCI =3D 1 << 5, BHYVE_CAP_CPUTOPOLOGY =3D 1 << 6, + BHYVE_CAP_VIRTIOSCSI =3D 1 << 7, } virBhyveCapsFlags; =20 int virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps); diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index bf1cfef3ab..dbf6fbf168 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -366,6 +366,123 @@ bhyveBuildControllerArgStr(const virDomainDef *def, return 0; } =20 +static int +bhyveBuildHostdevSubsysPCIArgStr(const virDomainDef *def, + virDomainHostdevDefPtr dev, + bhyveConnPtr driver G_GNUC_UNUSED, + virCommandPtr cmd) +{ + virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; + + switch (pcisrc->backend) { + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: + pcisrc->backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM; + G_GNUC_FALLTHROUGH; + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM: + if (!def->mem.locked) { + /* TODO: maybe just configure it automatically? */ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("guest memory must be locked (wired) for " + "PCI passthrough")); + return -1; + } + virCommandAddArg(cmd, "-s"); + virCommandAddArgFormat(cmd, "%u:%u:%u,passthru,%u/%u/%u", + dev->info->addr.pci.bus, + dev->info->addr.pci.slot, + dev->info->addr.pci.function, + pcisrc->addr.bus, + pcisrc->addr.slot, + pcisrc->addr.function); + break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported hostdev pci backend")); + return -1; + } + return 0; +} + +static int +bhyveBuildHostdevSubsysSCSICTLArgStr(const virDomainDef *def G_GNUC_UNUSED, + virDomainHostdevDefPtr dev, + bhyveConnPtr driver, + virCommandPtr cmd) +{ + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D &dev->source.subsys.u.scsi= _ctl; + + /* Actually CAM Target Layer (CTL), not VHost on FreeBSD. */ + if (!(bhyveDriverGetBhyveCaps(driver) & BHYVE_CAP_VIRTIOSCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Installed bhyve binary does not support " + "defining virtio-scsi devices")); + return -1; + } + if (ctlsrc->protocol !=3D + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_IOCTL) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported hostdev scsi_ctl protocol")); + return -1; + } + switch (ctlsrc->model) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_DEFAULT: + ctlsrc->model =3D + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_VIRTIO; + G_GNUC_FALLTHROUGH; + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_VIRTIO: + virCommandAddArg(cmd, "-s"); + virCommandAddArgFormat(cmd, "%u:%u,virtio-scsi,/dev/cam/ctl%u.%u", + dev->info->addr.pci.slot, + dev->info->addr.pci.function, + ctlsrc->pp, ctlsrc->vp); + break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported hostdev scsi_ctl model")); + return -1; + } + return 0; +} + +static int +bhyveBuildHostdevSubsysArgStr(const virDomainDef *def, + virDomainHostdevDefPtr dev, + bhyveConnPtr driver, + virCommandPtr cmd) +{ + switch (dev->source.subsys.type) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + if (bhyveBuildHostdevSubsysPCIArgStr(def, dev, driver, cmd) < 0) + return -1; + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + if (bhyveBuildHostdevSubsysSCSICTLArgStr(def, dev, driver, cmd) < = 0) + return -1; + break; + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported hostdev subsystem type")); + return -1; + } + return 0; +} + +static int +bhyveBuildHostdevArgStr(const virDomainDef *def, + virDomainHostdevDefPtr dev, + bhyveConnPtr driver, + virCommandPtr cmd) +{ + switch (dev->mode) { + case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: + return bhyveBuildHostdevSubsysArgStr(def, dev, driver, cmd); + default: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("unsupported hostdev device mode")); + return -1; + } +} + static int bhyveBuildLPCArgStr(const virDomainDef *def G_GNUC_UNUSED, virCommandPtr cmd) @@ -617,6 +734,10 @@ virBhyveProcessBuildBhyveCmd(bhyveConnPtr driver, virD= omainDefPtr def, if (bhyveBuildDiskArgStr(def, def->disks[i], cmd) < 0) goto error; } + for (i =3D 0; i < def->nhostdevs; i++) { + if (bhyveBuildHostdevArgStr(def, def->hostdevs[i], driver, cmd) < = 0) + goto error; + } =20 if (def->ngraphics && def->nvideos) { if (def->ngraphics =3D=3D 1 && def->nvideos =3D=3D 1) { diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_comman= d.c index 76423730d9..d69d23ace8 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -476,6 +476,92 @@ bhyveParsePCIDisk(virDomainDefPtr def, return -1; } =20 +static int +bhyveParsePCIPassthru(virDomainDefPtr def, + unsigned vmbus, + unsigned vmslot, + unsigned vmfunction, + char *config) +{ + /* -s bus:slot:function,passthru,BUS/SLOT/FUNCTION */ + virDomainHostdevDefPtr dev =3D NULL; + virDomainHostdevSubsysPCIPtr pcisrc =3D NULL; + unsigned hostbus, hostslot, hostfunction; + + hostslot =3D hostbus =3D hostfunction =3D 0; + if (sscanf(config, "%u/%u/%u", &hostbus, &hostslot, &hostfunction) != =3D 3) + return -1; + + if ((dev =3D virDomainHostdevDefNew()) =3D=3D NULL) + return -1; + dev->info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + dev->info->addr.pci.bus =3D vmbus; + dev->info->addr.pci.slot =3D vmslot; + dev->info->addr.pci.function =3D vmfunction; + dev->mode =3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; + dev->source.subsys.type =3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI; + pcisrc =3D &dev->source.subsys.u.pci; + pcisrc->backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM; + pcisrc->addr.bus =3D hostbus; + pcisrc->addr.slot =3D hostslot; + pcisrc->addr.function =3D hostfunction; + + if (VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, dev) < 0) + goto error; + + return 0; + + error: + virDomainHostdevDefFree(dev); + return -1; +} + +static int +bhyveParseSCSICTL(virDomainDefPtr def, + unsigned bus, + unsigned slot, + unsigned function, + char *config) +{ + /* -s slot,virtio-scsi,[dev=3D]/dev/cam/ctlPP.VP[,scsi-device-options]= */ + virDomainHostdevDefPtr dev =3D NULL; + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D NULL; + unsigned pp, vp; + + /* Skip [dev=3D] if present. */ + if (STRPREFIX(config, "dev=3D")) + config =3D strchr(config, '=3D') + 1; + + pp =3D vp =3D 0; + if (sscanf(config, "/dev/cam/ctl%u.%u", &pp, &vp) !=3D 2) + return -1; + + if ((dev =3D virDomainHostdevDefNew()) =3D=3D NULL) + return -1; + dev->info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + dev->info->addr.pci.bus =3D bus; + dev->info->addr.pci.slot =3D slot; + dev->info->addr.pci.function =3D function; + dev->mode =3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS; + dev->source.subsys.type =3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL; + ctlsrc =3D &dev->source.subsys.u.scsi_ctl; + ctlsrc->model =3D + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_VIRTIO; + ctlsrc->protocol =3D + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_IOCTL; + ctlsrc->pp =3D pp; + ctlsrc->vp =3D vp; + + if (VIR_APPEND_ELEMENT(def->hostdevs, def->nhostdevs, dev) < 0) + goto error; + + return 0; + + error: + virDomainHostdevDefFree(dev); + return -1; +} + static int bhyveParsePCINet(virDomainDefPtr def, virDomainXMLOptionPtr xmlopt, @@ -601,6 +687,8 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def, nvirtiodisk, nahcidisk, conf); + else if (STREQ(emulation, "passthru")) + bhyveParsePCIPassthru(def, bus, slot, function, conf); else if (STREQ(emulation, "virtio-blk")) bhyveParsePCIDisk(def, caps, bus, slot, function, VIR_DOMAIN_DISK_BUS_VIRTIO, @@ -611,6 +699,8 @@ bhyveParseBhyvePCIArg(virDomainDefPtr def, else if (STREQ(emulation, "virtio-net")) bhyveParsePCINet(def, xmlopt, caps, bus, slot, function, VIR_DOMAIN_NET_MODEL_VIRTIO, conf); + else if (STREQ(emulation, "virtio-scsi")) + bhyveParseSCSICTL(def, bus, slot, function, conf); else if (STREQ(emulation, "e1000")) bhyveParsePCINet(def, xmlopt, caps, bus, slot, function, VIR_DOMAIN_NET_MODEL_E1000, conf); diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 1b0abb21a0..7322eca80c 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -348,6 +348,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHost= devDefPtr hostdev, virDomainHostdevSubsysUSBPtr usbsrc =3D &hostdev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &hostdev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.u.sc= si; + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D &hostdev->source.subsys.u.= scsi_ctl; virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &hostdev->source.subsys= .u.scsi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &hostdev->source.subs= ys.u.mdev; =20 @@ -387,6 +388,10 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHos= tdevDefPtr hostdev, } break; } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + address =3D g_strdup_printf("/dev/cam/ctl%u.%u", + ctlsrc->pp, ctlsrc->vp); + break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: address =3D g_strdup(hostsrc->wwpn); break; diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cef49df3f8..12f8bb43c0 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -898,6 +898,7 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, "usb", "pci", "scsi", + "scsi_ctl", "scsi_host", "mdev", ); @@ -908,6 +909,7 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend, "kvm", "vfio", "xen", + "vmm", ); =20 VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIProtocol, @@ -916,6 +918,18 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIProtocol, "iscsi", ); =20 +VIR_ENUM_IMPL(virDomainHostdevSubsysSCSICTLProtocol, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_LAST, + "none", + "ioctl", +); + +VIR_ENUM_IMPL(virDomainHostdevSubsysSCSICTLModel, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_LAST, + "default", + "virtio", +); + VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIHostProtocol, VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST, "none", @@ -2958,6 +2972,7 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr = def) break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; @@ -5046,6 +5061,7 @@ virDomainHostdevDefPostParse(virDomainHostdevDefPtr d= ev, =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; @@ -6484,6 +6500,16 @@ virDomainHostdevDefValidate(const virDomainHostdevDe= f *hostdev) return -1; } break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + if (hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NO= NE && + hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_UN= ASSIGNED && + hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PC= I) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("SCSI CTL host devices must use 'pci' or " + "'unassigned' address type")); + return -1; + } + break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: if (hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NO= NE && hostdev->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PC= I && @@ -8320,6 +8346,64 @@ virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePt= r sourcenode, return 0; } =20 +static int +virDomainHostdevSubsysSCSICTLDefParseXML(xmlNodePtr sourcenode, + virDomainHostdevDefPtr def) +{ + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D &def->source.subsys.u.scsi= _ctl; + g_autofree char *protocol =3D NULL; + g_autofree char *pp =3D NULL; + g_autofree char *vp =3D NULL; + + if (!(protocol =3D virXMLPropString(sourcenode, "protocol"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing scsi_ctl subsystem protocol")); + return -1; + } + + if ((ctlsrc->protocol =3D + virDomainHostdevSubsysSCSICTLProtocolTypeFromString(protocol)) <= =3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown scsi_ctl subsystem protocol '%s'"), + protocol); + return -1; + } + + switch ((virDomainHostdevSubsysSCSICTLProtocolType) ctlsrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_IOCTL: + if (!(pp =3D virXMLPropString(sourcenode, "pp"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing scsi_ctl hostdev source pp")); + return -1; + } + if (virStrToLong_ui(pp, NULL, 10, &ctlsrc->pp) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse scsi_ctl hostdev source 'pp' at= tribute")); + return -1; + } + if (!(vp =3D virXMLPropString(sourcenode, "vp"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing scsi_ctl hostdev source vp")); + return -1; + } + if (virStrToLong_ui(vp, NULL, 10, &ctlsrc->vp) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Cannot parse scsi_ctl hostdev source 'vp' at= tribute")); + return -1; + } + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_NONE: + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_LAST: + virReportError(VIR_ERR_XML_ERROR, + _("Invalid hostdev protocol '%s'"), + virDomainHostdevSubsysSCSICTLProtocolTypeToString(c= tlsrc->protocol)); + return -1; + break; + } + + return 0; +} + static int virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDefPtr def, xmlXPathContextPtr ctxt) @@ -8363,6 +8447,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, int backend; virDomainHostdevSubsysPCIPtr pcisrc =3D &def->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; + virDomainHostdevSubsysSCSICTLPtr scsictlsrc =3D &def->source.subsys.u.= scsi_ctl; virDomainHostdevSubsysSCSIVHostPtr scsihostsrc =3D &def->source.subsys= .u.scsi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; g_autofree char *managed =3D NULL; @@ -8453,6 +8538,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, } =20 if (def->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV && + def->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_C= TL && def->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_H= OST) { if (model) { virReportError(VIR_ERR_XML_ERROR, @@ -8471,6 +8557,14 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, model); return -1; } + } else if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TY= PE_SCSI_CTL) { + if (model && + ((scsictlsrc->model =3D virDomainHostdevSubsysSCSICTLModelType= FromString(model)) < 0)) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown hostdev model '%s'"), + model); + return -1; + } } else if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TY= PE_MDEV) { if (!model) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -8533,10 +8627,16 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, return -1; break; =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + if (virDomainHostdevSubsysSCSICTLDefParseXML(sourcenode, def) < 0) + return -1; + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: if (virDomainHostdevSubsysSCSIVHostDefParseXML(sourcenode, def) < = 0) return -1; break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: if (virDomainHostdevSubsysMediatedDevDefParseXML(def, ctxt) < 0) return -1; @@ -15914,6 +16014,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr x= mlopt, =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: @@ -16963,6 +17064,13 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr= a, return virDomainHostdevMatchSubsysSCSIiSCSI(a, b); else return virDomainHostdevMatchSubsysSCSIHost(a, b); + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + return ((a->source.subsys.u.scsi_ctl.protocol =3D=3D + b->source.subsys.u.scsi_ctl.protocol) && + (a->source.subsys.u.scsi_ctl.pp =3D=3D + b->source.subsys.u.scsi_ctl.pp) && + (a->source.subsys.u.scsi_ctl.vp =3D=3D + b->source.subsys.u.scsi_ctl.vp)) ? 1 : 0; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: if (a->source.subsys.u.scsi_host.protocol !=3D b->source.subsys.u.scsi_host.protocol) @@ -25354,6 +25462,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevSubsysUSBPtr usbsrc =3D &def->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &def->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D &def->source.subsys.u.scsi= _ctl; virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.subsys.u.s= csi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; @@ -25396,6 +25505,15 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, protocol, iscsisrc->src->path); } =20 + if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= _CTL) { + const char *protocol =3D + virDomainHostdevSubsysSCSICTLProtocolTypeToString(ctlsrc->prot= ocol); + closedSource =3D true; + + virBufferAsprintf(buf, " protocol=3D'%s' pp=3D'%u' vp=3D'%u'/", + protocol, ctlsrc->pp, ctlsrc->vp); + } + if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= _HOST) { const char *protocol =3D virDomainHostdevSubsysSCSIHostProtocolTypeToString(hostsrc->pr= otocol); @@ -25457,6 +25575,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, scsihostsrc->unit); } break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: @@ -27560,6 +27679,7 @@ virDomainHostdevDefFormat(virBufferPtr buf, virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; virDomainHostdevSubsysSCSIVHostPtr scsihostsrc =3D &def->source.subsys= .u.scsi_host; + virDomainHostdevSubsysSCSICTLPtr scsictlsrc =3D &def->source.subsys.u.= scsi_ctl; const char *type; =20 if (!mode) { @@ -27610,6 +27730,12 @@ virDomainHostdevDefFormat(virBufferPtr buf, virTristateBoolTypeToString(scsisrc->rawio)); } =20 + if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_= SCSI_CTL && + scsictlsrc->model) { + virBufferAsprintf(buf, " model=3D'%s'", + virDomainHostdevSubsysSCSICTLModelTypeToStri= ng(scsictlsrc->model)); + } + if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_= SCSI_HOST && scsihostsrc->model) { virBufferAsprintf(buf, " model=3D'%s'", @@ -31142,6 +31268,11 @@ virDomainNetDefActualToNetworkPort(virDomainDefPtr= dom, port->plug.hostdevpci.driver =3D VIR_NETWORK_FORWARD_DRIVER_NA= ME_VFIO; break; =20 + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Unexpected PCI backend 'vmm'")); + break; + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Unexpected PCI backend 'xen'")); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cdc4d25700..4e0fc01c2b 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -195,6 +195,7 @@ typedef enum { VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI, + VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV, =20 @@ -203,10 +204,11 @@ typedef enum { =20 /* the backend driver used for PCI hostdev devices */ typedef enum { - VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automatically, prefe= r VFIO */ + VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, /* detect automatically, prefe= r VFIO or VMM */ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM, /* force legacy kvm style */ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO, /* force vfio */ VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN, /* force legacy xen style, use = pciback */ + VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM, /* force vmm (FreeBSD bhyve) */ =20 VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST } virDomainHostdevSubsysPCIBackendType; @@ -258,6 +260,30 @@ struct _virDomainHostdevSubsysSCSI { } u; }; =20 +typedef enum { + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_NONE, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_IOCTL, + + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_PROTOCOL_TYPE_LAST, +} virDomainHostdevSubsysSCSICTLProtocolType; + +VIR_ENUM_DECL(virDomainHostdevSubsysSCSICTLProtocol); + +typedef enum { + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_DEFAULT, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_VIRTIO, + + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_CTL_MODEL_TYPE_LAST, +} virDomainHostdevSubsysSCSICTLModelType; + +VIR_ENUM_DECL(virDomainHostdevSubsysSCSICTLModel); + +struct _virDomainHostdevSubsysSCSICTL { + int protocol; /* enum virDomainHostdevSubsysSCSICTLProtocolType */ + unsigned pp, vp; + int model; /* enum virDomainHostdevSubsysSCSICTLModelType */ +}; + struct _virDomainHostdevSubsysMediatedDev { int model; /* enum virMediatedDeviceModelType= */ int display; /* virTristateSwitch */ @@ -298,6 +324,7 @@ struct _virDomainHostdevSubsys { virDomainHostdevSubsysPCI pci; virDomainHostdevSubsysSCSI scsi; virDomainHostdevSubsysSCSIVHost scsi_host; + virDomainHostdevSubsysSCSICTL scsi_ctl; virDomainHostdevSubsysMediatedDev mdev; } u; }; diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index 1c62cde251..66cf40f8f0 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -180,6 +180,9 @@ typedef virDomainHostdevSubsysPCI *virDomainHostdevSubs= ysPCIPtr; typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI; typedef virDomainHostdevSubsysSCSI *virDomainHostdevSubsysSCSIPtr; =20 +typedef struct _virDomainHostdevSubsysSCSICTL virDomainHostdevSubsysSCSICT= L; +typedef virDomainHostdevSubsysSCSICTL *virDomainHostdevSubsysSCSICTLPtr; + typedef struct _virDomainHostdevSubsysSCSIHost virDomainHostdevSubsysSCSIH= ost; typedef virDomainHostdevSubsysSCSIHost *virDomainHostdevSubsysSCSIHostPtr; =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f69a9e651c..fdd59a35a4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4677,6 +4677,7 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def, =20 case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -5439,6 +5440,7 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, =20 break; =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index af6817cc05..3ebb864b4c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6674,8 +6674,11 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHo= stdevDef *hostdev, return -1; } break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: return qemuDomainMdevDefValidate(hostdev, def, qemuCaps); + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: default: virReportEnumRangeError(virDomainHostdevSubsysType, @@ -14031,6 +14034,8 @@ qemuDomainGetHostdevPath(virDomainHostdevDefPtr dev, =20 perm =3D VIR_CGROUP_DEVICE_RW; break; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 1774850640..0e1432f23d 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -203,6 +203,7 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostd= evDefPtr *hostdevs, return false; break; =20 + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: break; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9800491755..94fa64f216 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1576,6 +1576,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: break; =20 + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VMM: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -4535,6 +4536,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: qemuDomainRemoveMediatedDevice(driver, vm, hostdev); break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index a307c5ebe2..93144b741f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1105,6 +1105,7 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *= def) continue; =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index ca02631f7f..eadf2580b6 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -959,6 +959,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr m= gr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret =3D 0; break; diff --git a/src/security/security_dac.c b/src/security/security_dac.c index d75b18170b..de85e53a9a 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1212,6 +1212,7 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr m= gr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D &dev->source.subsys.u.scsi= _ctl; virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &dev->source.subsys.u= .mdev; int ret =3D -1; @@ -1300,6 +1301,19 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr = mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: { + char *ctldev =3D g_strdup_printf("/dev/cam/ctl%u.%u", + ctlsrc->pp, ctlsrc->vp); + + if (!ctldev) + return -1; + + ret =3D virSecurityDACSetHostdevLabelHelper(ctldev, true, &cbdata); + + VIR_FREE(ctldev); + break; + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); =20 @@ -1386,6 +1400,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerP= tr mgr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSICTLPtr ctlsrc =3D &dev->source.subsys.u.scsi= _ctl; virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &dev->source.subsys.u= .mdev; int ret =3D -1; @@ -1463,6 +1478,19 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager= Ptr mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: { + char *ctldev =3D g_strdup_printf("/dev/cam/ctl%u.%u", + ctlsrc->pp, ctlsrc->vp); + + if (!ctldev) + return -1; + + ret =3D virSecurityDACRestoreFileLabel(mgr, ctldev); + + VIR_FREE(ctldev); + break; + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); =20 diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 3f6968a57a..96f483ee14 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -2149,6 +2149,10 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityM= anagerPtr mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + /* FreeBSD only */ + return -1; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); =20 @@ -2384,6 +2388,10 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecur= ityManagerPtr mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_CTL: + /* FreeBSD only */ + return -1; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); =20 diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args b/tests/bh= yveargv2xmldata/bhyveargv2xml-passthru.args new file mode 100644 index 0000000000..697bafd642 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args @@ -0,0 +1,8 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-S \ +-s 0:0,hostbridge \ +-s 0:1:0,passthru,5/0/7 bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml b/tests/bhy= veargv2xmldata/bhyveargv2xml-passthru.xml new file mode 100644 index 0000000000..af99279448 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml @@ -0,0 +1,26 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + + + + 1 + + hvm + + + destroy + destroy + destroy + + + + +
+ +
+ + + diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.args b/tests= /bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.args new file mode 100644 index 0000000000..ae38208853 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.args @@ -0,0 +1,9 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE-devel.fd \ +-s 0:0,hostbridge \ +-s 1:0,lpc \ +-s 2:0,virtio-scsi,/dev/cam/ctl5.0 bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.xml b/tests/= bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.xml new file mode 100644 index 0000000000..23ad90a2a5 --- /dev/null +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-virtio-scsi.xml @@ -0,0 +1,20 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + destroy + destroy + destroy + + + +
+ + + diff --git a/tests/bhyveargv2xmltest.c b/tests/bhyveargv2xmltest.c index 735cc4b338..1cfe4e3ddb 100644 --- a/tests/bhyveargv2xmltest.c +++ b/tests/bhyveargv2xmltest.c @@ -173,6 +173,8 @@ mymain(void) DO_TEST("ahci-hd"); DO_TEST("virtio-blk"); DO_TEST("virtio-net"); + DO_TEST("virtio-scsi"); + DO_TEST("passthru"); DO_TEST("e1000"); DO_TEST_WARN("virtio-net2"); DO_TEST_WARN("virtio-net3"); diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args b/tests/bh= yvexml2argvdata/bhyvexml2argv-passthru.args new file mode 100644 index 0000000000..c268da957c --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args @@ -0,0 +1,11 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-S \ +-u \ +-H \ +-P \ +-s 0:0,hostbridge \ +-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE-devel.fd \ +-s 0:3:0,passthru,5/0/7 \ +-s 1,lpc bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs b/tests/= bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs new file mode 100644 index 0000000000..2995a4d0e7 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.ldargs @@ -0,0 +1 @@ +dummy \ No newline at end of file diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml b/tests/bhy= vexml2argvdata/bhyvexml2argv-passthru.xml new file mode 100644 index 0000000000..ba0744f35d --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml @@ -0,0 +1,22 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + + + + 1 + + hvm + /usr/local/share/uefi-firmwar= e/BHYVE_UEFI_CODE-devel.fd + + + + + +
+ +
+ + + diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.args b/tests= /bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.args new file mode 100644 index 0000000000..372f989095 --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.args @@ -0,0 +1,9 @@ +/usr/sbin/bhyve \ +-c 1 \ +-m 214 \ +-H \ +-P \ +-s 0:0,hostbridge \ +-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE-devel.fd \ +-s 2:0,virtio-scsi,/dev/cam/ctl5.0 \ +-s 1,lpc bhyve \ No newline at end of file diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.ldargs b/tes= ts/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.ldargs new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.ldargs @@ -0,0 +1 @@ +dummy diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.xml b/tests/= bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.xml new file mode 100644 index 0000000000..394ff20ffc --- /dev/null +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-virtio-scsi.xml @@ -0,0 +1,21 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + /usr/local/share/uefi-firmwar= e/BHYVE_UEFI_CODE-devel.fd + + + destroy + destroy + destroy + + + +
+ + + diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c index 9e7eb218b8..7ce2d5c6b1 100644 --- a/tests/bhyvexml2argvtest.c +++ b/tests/bhyvexml2argvtest.c @@ -175,7 +175,7 @@ mymain(void) driver.bhyvecaps =3D BHYVE_CAP_RTC_UTC | BHYVE_CAP_AHCI32SLOT | \ BHYVE_CAP_NET_E1000 | BHYVE_CAP_LPC_BOOTROM | \ BHYVE_CAP_FBUF | BHYVE_CAP_XHCI | \ - BHYVE_CAP_CPUTOPOLOGY; + BHYVE_CAP_CPUTOPOLOGY | BHYVE_CAP_VIRTIOSCSI; =20 DO_TEST("base"); DO_TEST("wired"); @@ -210,6 +210,8 @@ mymain(void) DO_TEST_FAILURE("cputopology-nvcpu-mismatch"); DO_TEST("commandline"); DO_TEST("msrs"); + DO_TEST("virtio-scsi"); + DO_TEST("passthru"); =20 /* Address allocation tests */ DO_TEST("addr-single-sata-disk"); diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml b/tests= /bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml new file mode 100644 index 0000000000..0313fa0dfa --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml @@ -0,0 +1,29 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 219136 + + + + 1 + + hvm + /usr/local/share/uefi-firmwar= e/BHYVE_UEFI_CODE-devel.fd + + + + destroy + restart + destroy + + + + + +
+ +
+ + + diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-virtio-scsi.xml b/te= sts/bhyvexml2xmloutdata/bhyvexml2xmlout-virtio-scsi.xml new file mode 100644 index 0000000000..771591689a --- /dev/null +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-virtio-scsi.xml @@ -0,0 +1,23 @@ + + bhyve + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + /usr/local/share/uefi-firmwar= e/BHYVE_UEFI_CODE-devel.fd + + + + destroy + destroy + destroy + + + + +
+ + + diff --git a/tests/bhyvexml2xmltest.c b/tests/bhyvexml2xmltest.c index a0c20a14c1..3a2a46014a 100644 --- a/tests/bhyvexml2xmltest.c +++ b/tests/bhyvexml2xmltest.c @@ -83,6 +83,7 @@ mymain(void) DO_TEST_DIFFERENT("acpiapic"); DO_TEST_DIFFERENT("base"); DO_TEST_DIFFERENT("wired"); + DO_TEST_DIFFERENT("passthru"); DO_TEST_DIFFERENT("bhyveload-bootorder"); DO_TEST_DIFFERENT("bhyveload-bootorder1"); DO_TEST_DIFFERENT("bhyveload-bootorder2"); @@ -94,6 +95,7 @@ mymain(void) DO_TEST_DIFFERENT("disk-cdrom"); DO_TEST_DIFFERENT("disk-cdrom-grub"); DO_TEST_DIFFERENT("disk-virtio"); + DO_TEST_DIFFERENT("virtio-scsi"); DO_TEST_DIFFERENT("grub-bootorder"); DO_TEST_DIFFERENT("grub-bootorder2"); DO_TEST_DIFFERENT("grub-defaults"); --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353693; cv=none; d=zohomail.com; s=zohoarc; b=Zxv4++nMFOeyDDYr7TT0L6Nku4KdYsgQKHH9Lef95VMMV0Rvf5RxUKlhjn+G8VJEQlq+gZR5C3rrRNO5mcoixnF9rVmmDv7hTtiJicXGgW+NZaIT24LUQddPRyQJjp8WaV9oaBN93Yqp5C50ok4jXzAbtJn+4lL9BNwvJicagMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353693; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wY/TrJDa9mzgF7+AlzXNB5m1GeWfFBoJtPGEvJpS3xM=; b=BLaEJy4jH5hJcuzNFLMc7lT9vpiziRub1By9/b+zJ81vfYs6IySBWRtt4mJfV3lLvunVXU7dPAfSdf3q/DWMgPZDT2poThu1/qFddz4wtXrMMitLwe3G87ssxLw4HNsNd/+r7fG0x9ZAqhkIfrQ9qk5X/zSiTsKwr2l34eQHgNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353693193330.94771665293456; Fri, 21 Feb 2020 22:41:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-HVHjC8UlP4uzxyXRkT54Dg-1; Sat, 22 Feb 2020 01:41:30 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C99618A5508; Sat, 22 Feb 2020 06:41:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60BC58B74A; Sat, 22 Feb 2020 06:41:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1D293860D4; Sat, 22 Feb 2020 06:41:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6e8YG021837 for ; Sat, 22 Feb 2020 01:40:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3EC6013AF75; Sat, 22 Feb 2020 06:40:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3A0D813BB9C for ; Sat, 22 Feb 2020 06:40:08 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 19C50800295 for ; Sat, 22 Feb 2020 06:40:08 +0000 (UTC) Received: from mail-yw1-f65.google.com (mail-yw1-f65.google.com [209.85.161.65]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-NGLEHWI-NNawxHHpluxouQ-1; Sat, 22 Feb 2020 01:40:05 -0500 Received: by mail-yw1-f65.google.com with SMTP id 10so2643935ywv.5 for ; Fri, 21 Feb 2020 22:40:05 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.40.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353692; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wY/TrJDa9mzgF7+AlzXNB5m1GeWfFBoJtPGEvJpS3xM=; b=YSANMagLKVf0rbVr5Vq6xAyEG5oVcDCuFwgm0SlKU6b99rbEONtvs/0BrJ9i6VLFwLDcPQ izSwNI357aJKJ4LifZoR4hT1wNndy3zdB3WA67/NHYnDQ7viofiBqC7fxV0nBoxDF51vKx Rfc07UOTvuq/GJzgswyGfiyFriVTsTo= X-MC-Unique: HVHjC8UlP4uzxyXRkT54Dg-1 X-MC-Unique: NGLEHWI-NNawxHHpluxouQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CA/9EF3v8+Rh7JOzsHJiWj6nJAqUWDURNJWLQYvCdBE=; b=T3DJiFc9uyc+8XSB4CLrGRmqs4lvdDAhIu05hN3gBFWaSnBknn0ADcmRH+GUiBnjBo oXykn6/a2PnIIyXLfUDKJAUqHvh2Sq06Y0jCSB9k3QCQzoTwLF+S90dbrixDDEfcaDPO roENkO3CjosyEGYvg2jybfY5Mh+9dik7mM0lQufWf3TageKi7Lhl9lsbS2ufERmn2V5W ZTJ+RC1ULycv3lrqBv/Nu53EarrPy2aBJBeh90xSLEfD6aF0gEjlB0xdSTvENlcVkKMl hMuoy6/ec47zkU0tZ/DSr8SzD/9LZgSpUzU+NqYtXxl1AI/tfVFHnHD4CWjZdICYPp3S j4lg== X-Gm-Message-State: APjAAAXr8wN5cVp4Hg9UaJWeevA4xYb/4QFDvehl4qRnssA5vF20EQua OshfrKbIbOL1V4+dcjqs+ftGvlQvwK99QZPb1XJwQ7uNlLSj8ArjaIdaBl+Xy9QIK1FTLXsCRq2 QwAGkquyUe8R47Sx1zwY3+8MfG9qj1LmdS5e3+/QsznQ0Bm2IItsx+GpjfJLSxIvvqio= X-Google-Smtp-Source: APXvYqy1dJjL1JzLZCUXW2I+OU2Qru/Sgy1r94LMWQMSLt1U6cIqvnxIP/dqSHAZf+4zsZJYaUYchQ== X-Received: by 2002:a81:2313:: with SMTP id j19mr34765637ywj.201.1582353604638; Fri, 21 Feb 2020 22:40:04 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 15/16] Enable booting from hostdevs with bhyve Date: Sat, 22 Feb 2020 01:38:54 -0500 Message-Id: <20200222063855.89637-16-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6e8YG021837 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ryan Moeller --- src/bhyve/bhyve_command.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index dbf6fbf168..14e80e6eec 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -997,11 +997,8 @@ virBhyveGetBootDisk(virDomainDefPtr def) virDomainDiskDefPtr match =3D NULL; int boot_dev =3D -1; =20 - if (def->ndisks < 1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Domain should have at least one disk defined")); + if (def->ndisks =3D=3D 0) return NULL; - } =20 if (def->os.nBootDevs > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.24.1 From nobody Sun May 5 18:48:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=ixsystems.com ARC-Seal: i=1; a=rsa-sha256; t=1582353724; cv=none; d=zohomail.com; s=zohoarc; b=KHXiRu3G0q6Ww9ovyT5qyxnIVAhXNBztHza32khxh4DZYiif6cStLjvEvQXcgDrQurqj+5vWio3U5bcxHL3egdNQ4zIKiglw+mMR1yIPd5A8JzJ252yqQCh4q84J0hVWN1XO2ls6CrbG6jWbghLbfmU+QTMCgwWtoVtrR3RkrSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582353724; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yd29tU3zoaHnkt6wmasRl7FXCqrJQaiJd1komoxu/xw=; b=L0B6IB2pdzVgzFA5Bz3gSWPdHUDiYo4TXDkrFf8285yXQSTa4or73Gv3qP61WPuzRtQL5TZuoY6uCQtalPHX1E3buyNTPmffXUg2gLWksy0GRKP4YmqEXuY5472tD+XYWPKFKkUTvLfX43IlkiQHckvYrt7eaRI3K8SQrASWvOE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582353724756256.60886030323104; Fri, 21 Feb 2020 22:42:04 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-27-nN0wQH-DMLifmRnEY70smg-1; Sat, 22 Feb 2020 01:41:30 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF5A8107ACCD; Sat, 22 Feb 2020 06:41:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82A2E60BE0; Sat, 22 Feb 2020 06:41:24 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 33CE6860CD; Sat, 22 Feb 2020 06:41:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01M6eEHU021866 for ; Sat, 22 Feb 2020 01:40:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5080B1032547; Sat, 22 Feb 2020 06:40:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 493FE1032523 for ; Sat, 22 Feb 2020 06:40:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A017F8007C9 for ; Sat, 22 Feb 2020 06:40:11 +0000 (UTC) Received: from mail-yw1-f48.google.com (mail-yw1-f48.google.com [209.85.161.48]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-IUlEnnffOG6fcnMjjP5CmA-1; Sat, 22 Feb 2020 01:40:09 -0500 Received: by mail-yw1-f48.google.com with SMTP id 192so2654745ywy.0 for ; Fri, 21 Feb 2020 22:40:09 -0800 (PST) Received: from xeon-freebsd.freqlabs.com. (69-228-200-148.lightspeed.knvltn.sbcglobal.net. [69.228.200.148]) by smtp.gmail.com with ESMTPSA id c84sm2482131ywa.1.2020.02.21.22.40.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2020 22:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582353722; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=yd29tU3zoaHnkt6wmasRl7FXCqrJQaiJd1komoxu/xw=; b=X91s6htxXqVAkmdeQYrW5FObdmASIBAA+F5i4jJO2AzFaFLQx/JNxkfkHMEnxXUS4IEmfo G7arad4mMq4sworhTD/Jf2M9v/A5im6Yz71U4Ql7YPS//KRKZglnT/d84/HOXSj083G1pT 6B/GE4lPFwgpRcMdhTuIB3CAYyw0aaA= X-MC-Unique: nN0wQH-DMLifmRnEY70smg-1 X-MC-Unique: IUlEnnffOG6fcnMjjP5CmA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FF+CsBuGwhA1c8jVXzSEy0rRgRKjEoIZHVFOoi7U5TQ=; b=hH9Hq4Hyj7LB6TCDgiU3rOcrfXxcykNjEUURn/yfRJXFTW86uoffo849w8R0DCfTFX dzSEVZstuxQ4jzER1MsYquNgEhK6tGbFLvL+3QN4pTqXEvKgOIUNtdwm+nOCDVWH4Yo9 WaBb3L5FlvrkmC7KHoqpFwGWJgE4Xex3qKWlF2G6X5oJVm89rheUmvsqe3W5zMFY8ESK vkushTPMIFYBIS1B4AayFm2dNDgQJCubGbVozlAp5g2K2EzrvJXVqQxX7b+cB3MJ47/h KfDYQT2tRCqOQ5PqHB9jG82tfQpiLfComiPKBNk0caVgBdTSYXpSHZMDEde8uSkgIyO5 ONsA== X-Gm-Message-State: APjAAAXWjPr8qR12Ztj32OOknRZ7EW99GlrNbuRkooWJCv7ICAkq3tjm UPQxSFnHfjMQxAppQIghHcSZut5Mo7SZBOGc4IFbb8lypZE9Bqy/unBp80HT3vED3mcXYa5kuhl xXVk6riknE4KCTu4chAEU1Oni9Lpr5/z0JusITjSacFOoLy6anoAXQ9t3upFDgI0zaQU= X-Google-Smtp-Source: APXvYqz3hMCO8MdxIQw37zFwB+BhQr/w3dZz1Ly8IgX9tL2X35Xkurym4dr++jJuyJXZv80uVBn4fw== X-Received: by 2002:a25:fc27:: with SMTP id v39mr11542974ybd.473.1582353608223; Fri, 21 Feb 2020 22:40:08 -0800 (PST) From: Ryan Moeller X-Google-Original-From: Ryan Moeller To: libvir-list@redhat.com Subject: [PATCH 16/16] Allow PCI functions up to 255 for PCI ARI Date: Sat, 22 Feb 2020 01:38:55 -0500 Message-Id: <20200222063855.89637-17-ryan@iXsystems.com> In-Reply-To: <20200222063855.89637-1-ryan@iXsystems.com> References: <20200222063855.89637-1-ryan@iXsystems.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 01M6eEHU021866 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" PCI Alternative Routing-ID Interpretation (ARI) capable devices use an implied Device Number of 0 and repurpose those bits to allow for 256 Function Numbers instead of 8. An example of such a device is the Chelsio T580-LP-CR, which uses the additional function numbers to provide Virtual Function (VF) features. Below is an excerpt from the `pciconf -lvc` output for this device when a few VFs are configured: ppt7@pci0:5:0:21: class=3D0x020000 card=3D0x00001425 chip=3D0x5810142= 5 rev=3D0x00 hdr=3D0x00 vendor =3D 'Chelsio Communications Inc' device =3D 'T580-LP-CR Unified Wire Ethernet Controller [VF]' class =3D network subclass =3D ethernet cap 10[70] =3D PCI-Express 2 endpoint max data 256(2048) FLR NS link x0(x8) speed 0.0(8.0) ASPM disabled(L0s/L1) cap 11[b0] =3D MSI-X supports 8 messages Table in map 0x20[0x0], PBA in map 0x20[0x8000] cap 05[50] =3D MSI supports 32 messages, 64 bit, vector masks ecap 0001[100] =3D AER 2 0 fatal 0 non-fatal 0 corrected ecap 000e[140] =3D ARI 1 ecap 0017[150] =3D TPH Requester 1 Of note: the Bus/Device/Function 5/0/21 and the ARI ecap. Attempting to pass this through to a VM as a PCI device produces a validation error due to the function number being out of range. To enable use of devices that use ARI, relax the schema and validity check for PCI addresses to permit function numbers up to 255. Update a few tests to give coverage. Ref: https://pcisig.com/sites/default/files/specification_documents/ECN-alt= -rid-interpretation-070604.pdf Signed-off-by: Ryan Moeller --- docs/schemas/basictypes.rng | 10 +--------- src/util/virpci.c | 4 ++-- tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args | 2 +- tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args | 2 +- tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml | 2 +- tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml | 2 +- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng index 81465273c8..03ce3f3be3 100644 --- a/docs/schemas/basictypes.rng +++ b/docs/schemas/basictypes.rng @@ -341,15 +341,7 @@ - - - (0x)?[0-7] - - - 0 - 7 - - + =20 diff --git a/src/util/virpci.c b/src/util/virpci.c index 0b1222373e..d60cf5eff7 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1302,11 +1302,11 @@ virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr a= ddr, addr->slot); return false; } - if (addr->function > 7) { + if (addr->function > 255) { if (report) virReportError(VIR_ERR_XML_ERROR, _("Invalid PCI address function=3D0x%x, " - "must be <=3D 7"), + "must be <=3D 255"), addr->function); return false; } diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args b/tests/bh= yveargv2xmldata/bhyveargv2xml-passthru.args index 697bafd642..726dade59e 100644 --- a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.args @@ -5,4 +5,4 @@ -P \ -S \ -s 0:0,hostbridge \ --s 0:1:0,passthru,5/0/7 bhyve +-s 0:1:0,passthru,5/0/9 bhyve diff --git a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml b/tests/bhy= veargv2xmldata/bhyveargv2xml-passthru.xml index af99279448..a8d7a574af 100644 --- a/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml +++ b/tests/bhyveargv2xmldata/bhyveargv2xml-passthru.xml @@ -18,7 +18,7 @@ -
+
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args b/tests/bh= yvexml2argvdata/bhyvexml2argv-passthru.args index c268da957c..afa99344af 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.args @@ -7,5 +7,5 @@ -P \ -s 0:0,hostbridge \ -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CODE-devel.fd \ --s 0:3:0,passthru,5/0/7 \ +-s 0:3:0,passthru,5/0/9 \ -s 1,lpc bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml b/tests/bhy= vexml2argvdata/bhyvexml2argv-passthru.xml index ba0744f35d..e8b3a4064f 100644 --- a/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml +++ b/tests/bhyvexml2argvdata/bhyvexml2argv-passthru.xml @@ -14,7 +14,7 @@ -
+
diff --git a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml b/tests= /bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml index 0313fa0dfa..7f96831df9 100644 --- a/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml +++ b/tests/bhyvexml2xmloutdata/bhyvexml2xmlout-passthru.xml @@ -21,7 +21,7 @@ -
+
--=20 2.24.1