From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713978; cv=none; d=zohomail.com; s=zohoarc; b=Gu/DFGYvH8M72QXSShlCTGkPj+IINyvpmjS4YCa9Px9WaUm/wVVvFHX2DzuGV9dwdFROseXqqxJBevzl61NmVctHkh0NOHdAoPEHAQtVInZVZcepCNxV39m+VSu7ONhq/FmZxG+lHz8GpkuYs0bJbxE0x3CNREaF1ph/rfxhllA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713978; 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=KOht7UUop3hJP789sNFsRdEJqF9Wb3bqixnPvawU0h0=; b=Zr/Baw/yjLQfGJ0oINQQJZFcyL5cjh33gtxRKe8EAx73b6nfGc4uTPWFSCC5t5fNYjGm+w3r5IgtU/WZV+kbNDNrAIOFO4AujVeSN5cCed1q6GbWLez0tyerbz2gzXE2iK/2YxquNBen7PzXRUwBwccNEk1kZs5j5fx24UfuwRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652713978121199.04205865804158; Mon, 16 May 2022 08:12:58 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-322-QREvaH9aM3iJhzX1J0vaDQ-1; Mon, 16 May 2022 11:12:51 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AD0BD29ABA1D; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9603640CF8E2; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7EAA91947054; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A013F194704E for ; Mon, 16 May 2022 15:12:44 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 85131403152; Mon, 16 May 2022 15:12:44 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9754492C14 for ; Mon, 16 May 2022 15:12:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713977; 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=KOht7UUop3hJP789sNFsRdEJqF9Wb3bqixnPvawU0h0=; b=QgmRdKqEfEnhacdr8GdJkEydWRLXW2agiguQ+0/jlrCSSfI6AgpglLNxrjYZxkCW0h9PNY EHfTsHEBHF6o7B4+JLtw35QLsi9ldDlDuG3iEzpTmWC1ZV80d+IfQQoQkgNkuF31UVSeWf SLc5yxBIqSYqcPs+81XreT9sbI2r+Qc= X-MC-Unique: QREvaH9aM3iJhzX1J0vaDQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/11] virConnectDomainXMLToNative: Add note about dynamically configured features Date: Mon, 16 May 2022 17:12:31 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652714880086100001 Content-Type: text/plain; charset="utf-8" In the qemu driver certain configs such as disk throttling or CPU hotplug is configured by interacting with the monitor at the startup phase of the hypervisor and thus is not part of the "native config" as returned by 'virConnectDomainXMLToNative'. Similarly at least the commandline for qemu contains resources passed via file descriptors which are obviously not part of the returned "native config". Add a paragraph into the documentation outlining that the native configuration might not be completely usable. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/libvirt-domain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index a32630a6e9..e3ced700b8 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -2909,6 +2909,13 @@ virConnectDomainXMLFromNative(virConnectPtr conn, * a native configuration file describing the domain. * The format of the native data is hypervisor dependent. * + * Note that certain hypervisor drivers such as the QEMU driver configure = many + * aspects of the domain dynamically via hypervisor APIs and that may not = be + * part of the returned native configuration format. Similarly certain res= ources + * are passed to the hypervisor via file descriptors, which are not part o= f the + * native configuration returned by this API. Such configuration is thus n= ot + * trivially usable outside of libvirt. + * * Returns a 0 terminated UTF-8 encoded native config datafile, or * NULL in case of error. The caller must free() the returned value. * --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713979; cv=none; d=zohomail.com; s=zohoarc; b=GhuD6M1lXyqj0ntJW1rEs34kYQmZCnsO0nE72xXsTDIywAj2UJHUV1Tgmj9yHhJl8wS9+At4YxlJtmwwR2BiAaF9Q+PxSsjTvaj1yLuKSDyIxsAMREpbeVDKv9eJrD2eW1IKXVWuQzcSJq1CCVNRZmEQIZ0rtOVCV8BvmsvgHEk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713979; 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=S7Rpkmb/p7amxxuKt5E7/dofjNdpuBoI7oOIIRl429A=; b=nuMT4ZPgHg6ZAKmcRnjf3Cjk+zZoyivpeA1+3ASrssJWsiv3e7JaoEvCTfimCdkSdTrStDNmc4SkgAnQWExdvSuzpCLisyC/r09fqMF8Q9kE2mIW8ITTnRmWOqEaCzVPBdqYGebV/L6qrYv4lIy1YEna4AUVcFv7fXKwUMXOdoI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652713979287820.0274330621111; Mon, 16 May 2022 08:12:59 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-398-Pi-vSxveOx-0qoVhhw53yA-1; Mon, 16 May 2022 11:12:53 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D77E29ABA2A; Mon, 16 May 2022 15:12:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06AEC492C14; Mon, 16 May 2022 15:12:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C8E571947075; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8F93D1947073 for ; Mon, 16 May 2022 15:12:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 74AA7492C14; Mon, 16 May 2022 15:12:45 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB4D4401E74 for ; Mon, 16 May 2022 15:12:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713978; 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=S7Rpkmb/p7amxxuKt5E7/dofjNdpuBoI7oOIIRl429A=; b=LirZokdBKsYDx6zy9BKspQ0LvcMBy3ebSp4Ifu/QOi1pS/LJ1lCMO03Vu3ASF3Nnr2+/os Tndj5+KC58Y3KKKG9DQ5+/jH+u74mx9onwUIOlX1aaU++F+OD7Bc0+sEwywd8v5n0gdYag p4y+Fq17s+S7W40zqXB9GAQRUc7t3h8= X-MC-Unique: Pi-vSxveOx-0qoVhhw53yA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/11] docs: drvqemu: Decrease expectations about command line from 'virsh domxml-to-native' Date: Mon, 16 May 2022 17:12:32 +0200 Message-Id: <32cba5edcea7fed617ba531914630792315079c9.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652713980446100007 Content-Type: text/plain; charset="utf-8" In the qemu driver certain configs such as disk throttling or CPU hotplug is configured by interacting with the monitor at the startup phase of the hypervisor and thus is not part of the "native config". Add a paragraph into the documentation outlining that the native configuration might not be completely usable. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- docs/drvqemu.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/drvqemu.rst b/docs/drvqemu.rst index 6368a91fb9..e08a60c705 100644 --- a/docs/drvqemu.rst +++ b/docs/drvqemu.rst @@ -443,10 +443,16 @@ Converting from domain XML to QEMU args ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The ``virsh domxml-to-native`` provides a way to convert a guest descripti= on -using libvirt Domain XML, into a set of QEMU args that can be run manually= . Note -that currently the command line formatted by libvirt is no longer suited f= or -manually running qemu as the configuration expects various resources and o= pen -file descriptors passed to the process which are usually prepared by libvi= rtd. +using libvirt Domain XML, into a set of QEMU args that would be used by li= bvirt +to start the qemu process. + +Note that currently the command line formatted by libvirt is no longer sui= ted +for manually running qemu as the configuration expects various resources a= nd +open file descriptors passed to the process which are usually prepared by +libvirtd as well as certain features being configured via the monitor. + +The qemu arguments as returned by ``virsh domxml-to-native`` thus are not +trivially usable outside of libvirt. Pass-through of arbitrary qemu commands --------------------------------------- --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713985; cv=none; d=zohomail.com; s=zohoarc; b=B3hjWGaYInBkuBcVCkrX7Wb3XIpxYP+sYkBsarFwHdh2z+2Iv//eH63YgWxYo0+v9kuwPCa15kS8mccYX2kBP/kSMHQ5Zbj2+bNQTWr3ABrLxgPlGgK9kDxZrGLDAih9hIz6q30lYlS8MI3g8eNocg1f7Nwv4SHdF1swO742Gxc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713985; 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=FeYjjpbmb0zi++n2CjdxvQ8CD5Ezfb8K860YSgVDCrw=; b=eFsYtpGJiiZWWKuT1WsMZtzwDgHvenioy/vkfDEUcnrC/CN1r2yEap1M5fmT29QYrQqnPuwrqeTd3/SPBYosOwpfqSyH8vEwOIdGvvItsz/1f6Uf0m67BTlYSEx/0qaC3iKFGY1TRUSKb/XHqT28XUo1lHP0Y/Y9go0PMtTX7Ow= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652713985532959.1995580699969; Mon, 16 May 2022 08:13:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-LuwefZZyNQmMWVyyZ_UHcg-1; Mon, 16 May 2022 11:12:59 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ABD57100BAAD; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9274E40CF8E2; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 504711947054; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 8D4A6194704E for ; Mon, 16 May 2022 15:12:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 61CA2401DBE; Mon, 16 May 2022 15:12:46 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB40F492C14 for ; Mon, 16 May 2022 15:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713984; 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=FeYjjpbmb0zi++n2CjdxvQ8CD5Ezfb8K860YSgVDCrw=; b=ItYiGRbs1XuxrHHQl8hJJv7n2C71VSr9R/HBhHenINQymMjAHJ7xltSjNFWXCD0oyJh846 6LqzladLC9EaIMsd4HXugwhj04uD0I55ITucYKyFMxJHWCiv2s6ECSCYKS4bS9jB+6dGi0 YIMjtOYZo7dP6IdJWOG81eqz8Y1GxnE= X-MC-Unique: LuwefZZyNQmMWVyyZ_UHcg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/11] qemu: command: Don't hide 'vhost' fds from 'standalone' command line Date: Mon, 16 May 2022 17:12:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652713986473100003 Content-Type: text/plain; charset="utf-8" We already format a commandline using FD passing for the tap devices so formatting the 'vhost' file descriptors won't make it any less usable directly. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 15 +++++---------- src/qemu/qemu_command.h | 3 +-- src/qemu/qemu_hotplug.c | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a52ba70066..f0d92a2a10 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8676,8 +8676,7 @@ qemuInterfaceVhostuserConnect(virCommand *cmd, int qemuBuildInterfaceConnect(virDomainObj *vm, virDomainNetDef *net, - virNetDevVPortProfileOp vmop, - bool standalone) + virNetDevVPortProfileOp vmop) { qemuDomainObjPrivate *priv =3D vm->privateData; @@ -8759,7 +8758,7 @@ qemuBuildInterfaceConnect(virDomainObj *vm, } } - if (vhostfd && !standalone) { + if (vhostfd) { if (qemuInterfaceOpenVhostNet(vm, net) < 0) return -1; } @@ -8775,7 +8774,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, virDomainNetDef *net, virQEMUCaps *qemuCaps, virNetDevVPortProfileOp vmop, - bool standalone, size_t *nnicindexes, int **nicindexes) { @@ -8793,7 +8791,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriver *driver, if (qemuDomainValidateActualNetDef(net, qemuCaps) < 0) return -1; - if (qemuBuildInterfaceConnect(vm, net, vmop, standalone) < 0) + if (qemuBuildInterfaceConnect(vm, net, vmop) < 0) return -1; switch (actualType) { @@ -8983,7 +8981,6 @@ qemuBuildNetCommandLine(virQEMUDriver *driver, virCommand *cmd, virQEMUCaps *qemuCaps, virNetDevVPortProfileOp vmop, - bool standalone, size_t *nnicindexes, int **nicindexes) { @@ -8997,8 +8994,7 @@ qemuBuildNetCommandLine(virQEMUDriver *driver, if (qemuBuildInterfaceCommandLine(driver, vm, cmd, net, qemuCaps, vmop, - standalone, nnicindexes, - nicindexes) < 0) + nnicindexes, nicindexes) < 0) goto error; last_good_net =3D i; @@ -10588,8 +10584,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, if (qemuBuildFilesystemCommandLine(cmd, def, qemuCaps, priv) < 0) return NULL; - if (qemuBuildNetCommandLine(driver, vm, cmd, - qemuCaps, vmop, standalone, + if (qemuBuildNetCommandLine(driver, vm, cmd, qemuCaps, vmop, nnicindexes, nicindexes) < 0) return NULL; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 84877b3d90..9e8eef1e29 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -91,8 +91,7 @@ qemuBuildHostNetProps(virDomainNetDef *net); int qemuBuildInterfaceConnect(virDomainObj *vm, virDomainNetDef *net, - virNetDevVPortProfileOp vmop, - bool standalone); + virNetDevVPortProfileOp vmop); /* Current, best practice */ virJSONValue * diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index cae7b0dd3b..f7fcd9d3f7 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1268,7 +1268,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, */ VIR_APPEND_ELEMENT_COPY(vm->def->nets, vm->def->nnets, net); - if (qemuBuildInterfaceConnect(vm, net, VIR_NETDEV_VPORT_PROFILE_OP_CRE= ATE, false) < 0) + if (qemuBuildInterfaceConnect(vm, net, VIR_NETDEV_VPORT_PROFILE_OP_CRE= ATE) < 0) return -1; iface_connected =3D true; --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713976; cv=none; d=zohomail.com; s=zohoarc; b=FpGwnoFgrACToy9aqJKm2F1WYM/SVVrWLAYIIipx5lSgBP1henFof90CVIfuf70oR2RXU0iPU3iB4BnnnAssUc/JWbFCSuSCUBheK9g/iDP2Qk4kjK64xNQdH4syutN7HrSob9PAEvvbm9/wkDePiN0a+kv2QlCUD9JPWznrscA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713976; 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=bSLjPfhGEBw4BE2vZGmb/szuTZfPLnbKVUBe7lY6Qdw=; b=gG637Fjgc1yW2MUBGTEm6XdKv1PdJ/JUU/9uINoV+l8ekWWfQ21MVk3yi8c5gebiWJL8j3oFkpF5CkfJFanbHD+bUDR4l92Bfa40UNOGs0VEQvbNoDlbFl0uivlrDwe1ge8O6cpgF5TVlKTGtWhekyosajBy5XE0j7ytxTsfPVg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652713976834342.5019554609356; Mon, 16 May 2022 08:12:56 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-rN72eMnHP3K-M7UWa8WSuQ-1; Mon, 16 May 2022 11:12:53 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C2C1100BAA0; Mon, 16 May 2022 15:12:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5942D151F5C6; Mon, 16 May 2022 15:12:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E34DB194704E; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BDB50194704E for ; Mon, 16 May 2022 15:12:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9AC52403156; Mon, 16 May 2022 15:12:47 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id C1B75492C14 for ; Mon, 16 May 2022 15:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713975; 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=bSLjPfhGEBw4BE2vZGmb/szuTZfPLnbKVUBe7lY6Qdw=; b=czulE3EFNGRld8KKPjOlBD/+r1PztDlzAuf71jXUnP7Jv9ONFEekhcqj5/hWbvnf6uq54F 5Q7hNBtRMdJ7y532gKvhPba+85Wm4cbDwm85fjH+X1BUVeQOe+Ny9exI4NkR002gzs5daL BsfnKqZh1fn7gLBpA4ycN4U+1YJyOCg= X-MC-Unique: rN72eMnHP3K-M7UWa8WSuQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/11] qemuBuildCommandLine: Convert 'standalone' flag to use 'flags' Date: Mon, 16 May 2022 17:12:34 +0200 Message-Id: <4bd736018db843035b3013fc23c46d4c72a5e9ca.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652713978437100003 Content-Type: text/plain; charset="utf-8" Introduce 'qemuBuildCommandLineFlags' and use it instead of specific flag booleans. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 3 +-- src/qemu/qemu_command.h | 5 ++++- src/qemu/qemu_driver.c | 4 +++- src/qemu/qemu_process.c | 6 ++---- src/qemu/qemu_process.h | 8 ++++---- tests/qemuxml2argvtest.c | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f0d92a2a10..d3b3603fbe 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10428,7 +10428,6 @@ qemuBuildCommandLine(virQEMUDriver *driver, const char *migrateURI, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, - bool standalone, bool enableFips, size_t *nnicindexes, int **nicindexes, @@ -10476,7 +10475,7 @@ qemuBuildCommandLine(virQEMUDriver *driver, qemuBuildCompatDeprecatedCommandLine(cmd, cfg, def, qemuCaps); - if (!standalone) + if (!(flags & QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING)) virCommandAddArg(cmd, "-S"); /* freeze CPU */ if (qemuBuildMasterKeyCommandLine(cmd, priv) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 9e8eef1e29..df46e80067 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -43,12 +43,15 @@ VIR_ENUM_DECL(qemuVideo); VIR_ENUM_DECL(qemuSoundCodec); +typedef enum { + QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING =3D 1 << 0, +} qemuBuildCommandLineFlags; + virCommand *qemuBuildCommandLine(virQEMUDriver *driver, virDomainObj *vm, const char *migrateURI, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, - bool standalone, bool enableFips, size_t *nnicindexes, int **nicindexes, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 702fd0239c..4f6b295859 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6330,6 +6330,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, virQEMUDriver *driver =3D conn->privateData; virDomainObj *vm =3D NULL; g_autoptr(virCommand) cmd =3D NULL; + unsigned int commandlineflags =3D QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING; char *ret =3D NULL; size_t i; @@ -6383,7 +6384,8 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, goto cleanup; if (!(cmd =3D qemuProcessCreatePretendCmdBuild(driver, vm, NULL, - qemuCheckFips(vm), true))) + qemuCheckFips(vm), + commandlineflags))) goto cleanup; ret =3D virCommandToString(cmd, false); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 07e467d01e..38079ce159 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7450,7 +7450,6 @@ qemuProcessLaunch(virConnectPtr conn, vm, incoming ? "defer" : NULL, snapshot, vmop, - false, qemuCheckFips(vm), &nnicindexes, &nicindexes, 0))) goto cleanup; @@ -7952,7 +7951,7 @@ qemuProcessCreatePretendCmdBuild(virQEMUDriver *drive= r, virDomainObj *vm, const char *migrateURI, bool enableFips, - bool standalone) + unsigned int flags) { VIR_DEBUG("Building emulator command line"); return qemuBuildCommandLine(driver, @@ -7960,11 +7959,10 @@ qemuProcessCreatePretendCmdBuild(virQEMUDriver *dri= ver, migrateURI, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP, - standalone, enableFips, NULL, NULL, - 0); + flags); } diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index f81bfd930a..fa3634c64f 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -98,10 +98,10 @@ int qemuProcessCreatePretendCmdPrepare(virQEMUDriver *d= river, unsigned int flags); virCommand *qemuProcessCreatePretendCmdBuild(virQEMUDriver *driver, - virDomainObj *vm, - const char *migrateURI, - bool enableFips, - bool standalone); + virDomainObj *vm, + const char *migrateURI, + bool enableFips, + unsigned int flags); int qemuProcessInit(virQEMUDriver *driver, virDomainObj *vm, diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7708e3ba3e..8d0d4acca9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -488,7 +488,7 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, enableFips =3D false; return qemuProcessCreatePretendCmdBuild(drv, vm, migrateURI, - enableFips, false); + enableFips, 0); } --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713982; cv=none; d=zohomail.com; s=zohoarc; b=Kqch5wrd0JM+2EhBKCCDZbpLRPSOAFePAfuvkov67WkTVZb2XBMUSCMGmkJ3oaZDcZcDJd5q3LkgrNR82OGGd7Ekiz2cJEwrgmnraZH1ij3KDWlyxGHhnbIMu1vGmRG8l41jcjWir7BzA+JrpvjXk7kKPV575xSiZvWy6CIIkHk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713982; 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=asUgkIs7FoDv5I5wtMoyBpmrWIKEGJvMRoGvoKHgWnU=; b=Ma5Hz+8oToxe3ZRwXCnXGTTfdD4fiLuRuyMhJ8U+tWcZkmXOUc/x6OZ7FWOQOwPQazc29Wo68Lx915kfbt0wBmw23xCFmCCYa96Pfv5xwv6a39K49ENwNDbqzDfRjcAiLVwmPEcL9Xz7gVrmBo2vplXRfaf3kNpthTtwj+apvSQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652713982924185.36889888971484; Mon, 16 May 2022 08:13:02 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-524-ueMHH76rMXO8uZpmAgBcVQ-1; Mon, 16 May 2022 11:12:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ABE373C138A9; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 92320400DE5E; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5DF6E194706E; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BF9A71947072 for ; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A9ED1401DBE; Mon, 16 May 2022 15:12:48 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E9AB492C14 for ; Mon, 16 May 2022 15:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713981; 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=asUgkIs7FoDv5I5wtMoyBpmrWIKEGJvMRoGvoKHgWnU=; b=FEdVYAnxtAoNImNMMKMr8LEUX3kj5eLzrzLvGK9qIOMLe85Fc2/Ao/Gw4Yqn35zmY55wUg 2sq8/VEeNugHNBPcOM/jxDOTqrURkyrkbTuihCZWdNWRAYjj2IFmEVuvf4WKirzQFQ+ZHR K8uPQSUSBlyd07bgL7HbhF8D+CJniaA= X-MC-Unique: ueMHH76rMXO8uZpmAgBcVQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/11] qemu: Store state of FIPS in virQEMUDriver Date: Mon, 16 May 2022 17:12:35 +0200 Message-Id: <548a9433f968a97ba937da10d92cbce1b09c6198.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652713984457100001 Content-Type: text/plain; charset="utf-8" Rather than re-query all the time we can cache the state of FIPS of the host as it will not change during the runtime of the guest. Introduce a 'hostFips' flag to 'virQEMUDriver' and move the code checking the state from 'qemuCheckFips' to 'qemuStateInitialize' and also populate 'hostFips' in qemuxml2argvtest. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 14 ++------------ src/qemu/qemu_conf.h | 1 + src/qemu/qemu_driver.c | 9 +++++++++ tests/qemuxml2argvtest.c | 5 ++++- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d3b3603fbe..3e9db271b1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1787,21 +1787,11 @@ bool qemuCheckFips(virDomainObj *vm) { qemuDomainObjPrivate *priv =3D vm->privateData; - virQEMUCaps *qemuCaps =3D priv->qemuCaps; - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_FIPS)) + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) return false; - if (virFileExists("/proc/sys/crypto/fips_enabled")) { - g_autofree char *buf =3D NULL; - - if (virFileReadAll("/proc/sys/crypto/fips_enabled", 10, &buf) < 0) - return false; - if (STREQ(buf, "1\n")) - return true; - } - - return false; + return priv->driver->hostFips; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index c71a666aea..5e752d075e 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -251,6 +251,7 @@ struct _virQEMUDriver { /* Immutable values */ bool privileged; char *embeddedRoot; + bool hostFips; /* FIPS mode is enabled on the host */ /* Immutable pointers. Caller must provide locking */ virStateInhibitCallback inhibitCallback; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4f6b295859..96ca67dfca 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -735,6 +735,15 @@ qemuStateInitialize(bool privileged, if (qemuMigrationDstErrorInit(qemu_driver) < 0) goto error; + /* qemu-5.1 and older requires use of '-enable-fips' flag when the host + * is in FIPS mode. We store whether FIPS is enabled */ + if (virFileExists("/proc/sys/crypto/fips_enabled")) { + g_autofree char *buf =3D NULL; + + if (virFileReadAll("/proc/sys/crypto/fips_enabled", 10, &buf) > 0) + qemu_driver->hostFips =3D STREQ(buf, "1\n"); + } + if (privileged) { g_autofree char *channeldir =3D NULL; diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8d0d4acca9..385448b57a 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -386,9 +386,12 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, unsigned int flags) { qemuDomainObjPrivate *priv =3D vm->privateData; - bool enableFips =3D !!(flags & FLAG_FIPS_HOST); + bool enableFips; size_t i; + drv->hostFips =3D flags & FLAG_FIPS_HOST; + enableFips =3D drv->hostFips; + if (qemuProcessCreatePretendCmdPrepare(drv, vm, migrateURI, VIR_QEMU_PROCESS_START_COLD) < = 0) return NULL; --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713985; cv=none; d=zohomail.com; s=zohoarc; b=h/HSBxUM87eLv3sE2/yb4pMqK/O2Jbfe+mXwnXYH6YS2gZfJwoOb62qZcAfP3YTp1bpUXwsSH4FaslDo2sMJEhbqGSxhEjiHj/jjYG4WzRoe3uNk1o/0s+ud3eIoA5r++umAGG9aThIE8FG9bGo6A7XIMJfUaWC/zyLuaNZTk00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713985; 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=SWV1msh3Xb4Q+MqiSpFpN62eF+W6OzKQnNkggiBn8nU=; b=DGNhpeUUQUvmozNZJifBHgXCkE3ySMApQQIl81dKKAEWmP5n20oRlV1Ahfkii+MJw4dw01bbXeBLp2t3S70j8iJSecw6mndRDnPCYFaMZJ975TxSy7PvvKO9syEb39j8ZlZKvHOQA5PhZNuMz2xPMccL+F0nrVHNDNhNT2OzsD8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 165271398570681.75545201576608; Mon, 16 May 2022 08:13:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-325-UT_S5EPiOKirJHQdRNmX8g-1; Mon, 16 May 2022 11:12:58 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7048485A5BE; Mon, 16 May 2022 15:12:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A88F46A382; Mon, 16 May 2022 15:12:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BBA591947055; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C66C8194704E for ; Mon, 16 May 2022 15:12:49 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B7E4B401E74; Mon, 16 May 2022 15:12:49 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09AAF401DBE for ; Mon, 16 May 2022 15:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713984; 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=SWV1msh3Xb4Q+MqiSpFpN62eF+W6OzKQnNkggiBn8nU=; b=MlLYNVWk269RvmTi89SGCn9pY/CY1Vz28I/wTkYNoLuEGT8B9sTiSNP54U+8ssKlOiY+WO k9OnQ1g3C1GLhH4clZAQIKNXZwYCRFXEm/+RniVPVS+26NNlYUCpMNIFZl3QE2snnrUMgd Ehca/3OyFYTizQVmsAscn8XPxCtBdLw= X-MC-Unique: UT_S5EPiOKirJHQdRNmX8g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/11] qemuBuildCommandLine: Sanitize debug logging Date: Mon, 16 May 2022 17:12:36 +0200 Message-Id: <6d7153ca974057885d106a3d357cea7c3669b343.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652713986480100004 Content-Type: text/plain; charset="utf-8" Improve the debug log inside 'qemuBuildCommandLine' to include the name from the definition and remove useless data such as the pointer to the qemuDriver object or qemuCaps. Additionally remove the non-specific debug statements: VIR_DEBUG("Building emulator command line"); from the two callers of qemuBuildCommandLine. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 6 ++---- src/qemu/qemu_process.c | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3e9db271b1..35ed8ac0ed 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10431,10 +10431,8 @@ qemuBuildCommandLine(virQEMUDriver *driver, virDomainDef *def =3D vm->def; virQEMUCaps *qemuCaps =3D priv->qemuCaps; - VIR_DEBUG("driver=3D%p def=3D%p mon=3D%p " - "qemuCaps=3D%p migrateURI=3D%s snapshot=3D%p vmop=3D%d flags= =3D0x%x", - driver, def, priv->monConfig, - qemuCaps, migrateURI, snapshot, vmop, flags); + VIR_DEBUG("Building qemu commandline for def=3D%s(%p) migrateURI=3D%s = snapshot=3D%p vmop=3D%d flags=3D0x%x", + def->name, def, migrateURI, snapshot, vmop, flags); if (qemuBuildCommandLineValidate(driver, def) < 0) return NULL; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 38079ce159..1098c3bf93 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7445,7 +7445,6 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuExtDevicesStart(driver, vm, incoming !=3D NULL) < 0) goto cleanup; - VIR_DEBUG("Building emulator command line"); if (!(cmd =3D qemuBuildCommandLine(driver, vm, incoming ? "defer" : NULL, @@ -7953,7 +7952,6 @@ qemuProcessCreatePretendCmdBuild(virQEMUDriver *drive= r, bool enableFips, unsigned int flags) { - VIR_DEBUG("Building emulator command line"); return qemuBuildCommandLine(driver, vm, migrateURI, --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652713984; cv=none; d=zohomail.com; s=zohoarc; b=mCFWIrbCQqyi1BhEo6kEtMoIizj4sTQqq6SXhBO2pC4rsjr+1wt5jyWkzg8zWep+5PeiLkLSnjBHwAvHpPcwWhAMuhtyLSjjfubl6QZ+6pp9ahSkUwA1jWi2qqMstfk5E8Ky4lr1mdSG8WJlv1YT/ate7tbVZtUd4eUOV618qAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652713984; 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=+AgRmt8kK4sG0J9A3AYQkWf0JWZge/718OVYOeAwRuM=; b=Z0MfwfIKHO6pAZ0wp3uSr1LNNIgw8VV8tPPwlR/BKSmggBxuWC2oiQw4kaFINpdQZnxY3ucACegiFbuVgvpG2fdhPSPr6cwtDnJNfeVIHUp2kG0o63ZEs3rgXkaYip+NtvAAjS/DoTkXYevRvk9np5D0ZJLdAMiVuGHNinCJgJ0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652713984530296.9835114759454; Mon, 16 May 2022 08:13:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-301-_5Q25Y_HOLuRnjiMP4LFDg-1; Mon, 16 May 2022 11:12:59 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 628E0811E80; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F3D2492C14; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2AAA31947054; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D17A4194704E for ; Mon, 16 May 2022 15:12:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AFFB2403152; Mon, 16 May 2022 15:12:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B52340316E for ; Mon, 16 May 2022 15:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652713983; 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=+AgRmt8kK4sG0J9A3AYQkWf0JWZge/718OVYOeAwRuM=; b=UDwPX99iSwkHmMErnUU/uL9NiLwJIfM8HLdxhbON0H/5rJzgKTFRc1A+gVrqfRItyvqdvb XrzZdHIHKWjInNi++yJ1IuLqHSK2hHCQ9b1/bK/5Yf79UAbg7jPZ+9N4M0s5G4eXVC6xXV 5hsp7hKEscFxKVx1D92rJg0nva+eq7Y= X-MC-Unique: _5Q25Y_HOLuRnjiMP4LFDg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/11] qemuConnectDomainXMLToNative: Refactor cleanup Date: Mon, 16 May 2022 17:12:37 +0200 Message-Id: <9f0d4d78239f51666c7057b73523d7dd46da87a3.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652713986491100005 Content-Type: text/plain; charset="utf-8" Automatically free the 'vm' temporary domain object and remove the 'cleanup' label and 'ret' helper variable. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 96ca67dfca..b862208327 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6337,30 +6337,29 @@ static char *qemuConnectDomainXMLToNative(virConnec= tPtr conn, unsigned int flags) { virQEMUDriver *driver =3D conn->privateData; - virDomainObj *vm =3D NULL; + g_autoptr(virDomainObj) vm =3D NULL; g_autoptr(virCommand) cmd =3D NULL; unsigned int commandlineflags =3D QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING; - char *ret =3D NULL; size_t i; virCheckFlags(0, NULL); if (virConnectDomainXMLToNativeEnsureACL(conn) < 0) - goto cleanup; + return NULL; if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) { virReportError(VIR_ERR_INVALID_ARG, _("unsupported config type %s"), format); - goto cleanup; + return NULL; } if (!(vm =3D virDomainObjNew(driver->xmlopt))) - goto cleanup; + return NULL; if (!(vm->def =3D virDomainDefParseString(xmlData, driver->xmlopt, NUL= L, VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_ABI_UPDAT= E))) - goto cleanup; + return NULL; /* Since we're just exporting args, we can't do bridge/network/direct * setups, since libvirt will normally create TAP/macvtap devices @@ -6372,7 +6371,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, virDomainNetDef *newNet =3D virDomainNetDefNew(driver->xmlopt); if (!newNet) - goto cleanup; + return NULL; newNet->type =3D VIR_DOMAIN_NET_TYPE_ETHERNET; newNet->info.bootIndex =3D net->info.bootIndex; @@ -6387,21 +6386,17 @@ static char *qemuConnectDomainXMLToNative(virConnec= tPtr conn, if (qemuProcessCreatePretendCmdPrepare(driver, vm, NULL, VIR_QEMU_PROCESS_START_COLD) < = 0) - goto cleanup; + return NULL; if (qemuConnectDomainXMLToNativePrepareHost(vm) < 0) - goto cleanup; + return NULL; if (!(cmd =3D qemuProcessCreatePretendCmdBuild(driver, vm, NULL, qemuCheckFips(vm), commandlineflags))) - goto cleanup; - - ret =3D virCommandToString(cmd, false); + return NULL; - cleanup: - virObjectUnref(vm); - return ret; + return virCommandToString(cmd, false); } --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652714044; cv=none; d=zohomail.com; s=zohoarc; b=XF6skQ+7MNx86CQGlc1P3qWEwGfWwn0VpCvFx321/AytbCHOpm5BbYDe8n+X1rs8v5Vyunlxi1vybKGvLGq7zzUiKIuy2H6K7un+h68iNkPtWp24KWzVXATYbvc/Q3UTf6mEPo+BBNht32Io8yDTG9FtDTepoUv5oJZ+tazG+dM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652714044; 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=whrDvHVcOJFf6XdVo/u3fwY73I3vm7cwVxhkgyA6QHc=; b=EReH7FgTrnDmmrMqSTMi5ygf103Eluw0Z8Ozv+QA0r7mOuGquFB0XTKcpVN600U8nWWRnOjWdl1E2ws7EnmwNDb2edTo9LtIBrameeMpQ1VcrxuZnCfJPw3b8K+2Ii3GPWYr0k2gyTQLlSWfEIgFbDr0zVtxL5iB0XmPK4Q7nYs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652714044841114.85443022899733; Mon, 16 May 2022 08:14:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-672-FoGMO7L9OM-13Ux3ASolRA-1; Mon, 16 May 2022 11:13:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3B900299E74A; Mon, 16 May 2022 15:12:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 194E040CF8E2; Mon, 16 May 2022 15:12:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C23DE1947054; Mon, 16 May 2022 15:12:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E593C1947B90 for ; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C9B3040316E; Mon, 16 May 2022 15:12:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11018403152 for ; Mon, 16 May 2022 15:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652714042; 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=whrDvHVcOJFf6XdVo/u3fwY73I3vm7cwVxhkgyA6QHc=; b=EjRwWOGKud7cK47GEgeTxENQDGBOU/bzTqvSWqJsg3MZLbpEFxZpxpk1Jbp5uKXxs5TQQg svQ3vkWSrgflqSX8k76mxuwiPpqZtzSkPwwqCSK51EorUBuuoBJwXdR/x5R3Z1OMIt6LT9 FZoxsIq9/2xwdT42hf6AEszMJatsyHY= X-MC-Unique: FoGMO7L9OM-13Ux3ASolRA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/11] qemuBuildCommandLine: Remove 'driver' argument Date: Mon, 16 May 2022 17:12:38 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652714045153100001 Content-Type: text/plain; charset="utf-8" We pass 'vm' which already contains it. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 6 +++--- src/qemu/qemu_command.h | 17 ++++++++--------- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 9 +++------ src/qemu/qemu_process.h | 3 +-- tests/qemuxml2argvtest.c | 2 +- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 35ed8ac0ed..c48575f78c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10413,8 +10413,7 @@ qemuBuildCompatDeprecatedCommandLine(virCommand *cm= d, * for a given virtual machine. */ virCommand * -qemuBuildCommandLine(virQEMUDriver *driver, - virDomainObj *vm, +qemuBuildCommandLine(virDomainObj *vm, const char *migrateURI, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, @@ -10426,8 +10425,9 @@ qemuBuildCommandLine(virQEMUDriver *driver, size_t i; char uuid[VIR_UUID_STRING_BUFLEN]; g_autoptr(virCommand) cmd =3D NULL; - g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); qemuDomainObjPrivate *priv =3D vm->privateData; + virQEMUDriver *driver =3D priv->driver; + g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); virDomainDef *def =3D vm->def; virQEMUCaps *qemuCaps =3D priv->qemuCaps; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index df46e80067..db5b532cb8 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -47,15 +47,14 @@ typedef enum { QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING =3D 1 << 0, } qemuBuildCommandLineFlags; -virCommand *qemuBuildCommandLine(virQEMUDriver *driver, - virDomainObj *vm, - const char *migrateURI, - virDomainMomentObj *snapshot, - virNetDevVPortProfileOp vmop, - bool enableFips, - size_t *nnicindexes, - int **nicindexes, - unsigned int flags); +virCommand *qemuBuildCommandLine(virDomainObj *vm, + const char *migrateURI, + virDomainMomentObj *snapshot, + virNetDevVPortProfileOp vmop, + bool enableFips, + size_t *nnicindexes, + int **nicindexes, + unsigned int flags); /* Generate the object properties for pr-manager */ virJSONValue *qemuBuildPRManagerInfoProps(virStorageSource *src); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b862208327..8097dcf144 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6391,7 +6391,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, if (qemuConnectDomainXMLToNativePrepareHost(vm) < 0) return NULL; - if (!(cmd =3D qemuProcessCreatePretendCmdBuild(driver, vm, NULL, + if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL, qemuCheckFips(vm), commandlineflags))) return NULL; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1098c3bf93..fbad1254a0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7445,8 +7445,7 @@ qemuProcessLaunch(virConnectPtr conn, if (qemuExtDevicesStart(driver, vm, incoming !=3D NULL) < 0) goto cleanup; - if (!(cmd =3D qemuBuildCommandLine(driver, - vm, + if (!(cmd =3D qemuBuildCommandLine(vm, incoming ? "defer" : NULL, snapshot, vmop, qemuCheckFips(vm), @@ -7946,14 +7945,12 @@ qemuProcessCreatePretendCmdPrepare(virQEMUDriver *d= river, virCommand * -qemuProcessCreatePretendCmdBuild(virQEMUDriver *driver, - virDomainObj *vm, +qemuProcessCreatePretendCmdBuild(virDomainObj *vm, const char *migrateURI, bool enableFips, unsigned int flags) { - return qemuBuildCommandLine(driver, - vm, + return qemuBuildCommandLine(vm, migrateURI, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP, diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index fa3634c64f..9856da3bb5 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -97,8 +97,7 @@ int qemuProcessCreatePretendCmdPrepare(virQEMUDriver *dri= ver, const char *migrateURI, unsigned int flags); -virCommand *qemuProcessCreatePretendCmdBuild(virQEMUDriver *driver, - virDomainObj *vm, +virCommand *qemuProcessCreatePretendCmdBuild(virDomainObj *vm, const char *migrateURI, bool enableFips, unsigned int flags); diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 385448b57a..2385fa1209 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -490,7 +490,7 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) enableFips =3D false; - return qemuProcessCreatePretendCmdBuild(drv, vm, migrateURI, + return qemuProcessCreatePretendCmdBuild(vm, migrateURI, enableFips, 0); } --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652714055; cv=none; d=zohomail.com; s=zohoarc; b=FNixW61btbz5KOV8KJBanG2lEoaf4t0wACWsQqXkPaSNjKBaHbykcNAzcsBzItiYTKYf6dvzSeejuB9D75+/J0vpVzSuDFvUkxeczfRsP7WxKqq6FodNl6uoko4hMZVDxpLQzUIYgLliG+48NRHPLnB8sOzCNYzLRS1XWXjWhS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652714055; 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=waeyKoyCGB7CGAikihWfFRquj5PsfJwXbqFY3/XZ0lY=; b=oGPVrm9nOF4/iMlAMTAcfsfsHC0a4sOP2fStAu+be4Sv0YhETY9sw4ArclxOa2RYqDLwp6hlUGufGf/pIazL+vL9LfW3GIoW0QCW+xpt02WHsuqoCsK0aT+Z9DV997uTLqZCVWCIx+4YBPX12rDMtSGmnw/SsqFRXy7bTcUC7HU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652714055491827.2133696267291; Mon, 16 May 2022 08:14:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-656-k4R2a4ahPqWDInWJSQj6ag-1; Mon, 16 May 2022 11:13:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BAF981C01B24; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A529CC50941; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 78CB81947070; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 011A6194704E for ; Mon, 16 May 2022 15:12:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C9209401DBE; Mon, 16 May 2022 15:12:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CCE2492C14 for ; Mon, 16 May 2022 15:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652714054; 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=waeyKoyCGB7CGAikihWfFRquj5PsfJwXbqFY3/XZ0lY=; b=KuhaXsJ4bu0L5boEEKhEfpFeU18GVny0pszHsJvLUuSVZC6RUO++rcModVNKm/8MNWH3jp F9pow7yVESTql/cVQncj+LDtk054HuICdn2Yf3WXyj8gzaU99w2OBeqN4191b4+GlrrRhA ndSpcjhFtCfge0LfQWaa39AD8HHvCnI= X-MC-Unique: k4R2a4ahPqWDInWJSQj6ag-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/11] qemuBuildCommandLine: Inline qemuCheckFips Date: Mon, 16 May 2022 17:12:39 +0200 Message-Id: <31d2a578b67e10a5b43bff9aced406bcba615701.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652714057213100001 Content-Type: text/plain; charset="utf-8" Now that we store the state of the host FIPS mode setting in the qemu driver object, we don't need to outsource the logic into 'qemuCheckFips'. Additionally since we no longer support very old qemu's which would not yet have --enable-fips we can drop the part of the comment about very old qemus. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 41 +++++++++++++--------------------------- src/qemu/qemu_command.h | 5 ----- src/qemu/qemu_driver.c | 4 +--- src/qemu/qemu_process.c | 3 --- src/qemu/qemu_process.h | 1 - tests/qemuxml2argvtest.c | 9 +-------- 6 files changed, 15 insertions(+), 48 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c48575f78c..8705f0018c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1769,32 +1769,6 @@ qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDef *= disk) } -/* QEMU 1.2 and later have a binary flag -enable-fips that must be - * used for VNC auth to obey FIPS settings; but the flag only - * exists on Linux, and with no way to probe for it via QMP. Our - * solution: if FIPS mode is required, then unconditionally use - * the flag, regardless of qemu version, for the following matrix: - * - * old QEMU new QEMU - * FIPS enabled doesn't start VNC auth disabled - * FIPS disabled/missing VNC auth enabled VNC auth enabled - * - * In QEMU 5.2.0, use of -enable-fips was deprecated. In scenarios - * where FIPS is required, QEMU must be built against libgcrypt - * which automatically enforces FIPS compliance. - */ -bool -qemuCheckFips(virDomainObj *vm) -{ - qemuDomainObjPrivate *priv =3D vm->privateData; - - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) - return false; - - return priv->driver->hostFips; -} - - /** * qemuDiskBusIsSD: * @bus: disk bus @@ -10417,7 +10391,6 @@ qemuBuildCommandLine(virDomainObj *vm, const char *migrateURI, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, - bool enableFips, size_t *nnicindexes, int **nicindexes, unsigned int flags) @@ -10478,7 +10451,19 @@ qemuBuildCommandLine(virDomainObj *vm, if (qemuBuildPflashBlockdevCommandLine(cmd, priv) < 0) return NULL; - if (enableFips) + /* QEMU 1.2 and later have a binary flag -enable-fips that must be + * used for VNC auth to obey FIPS settings; but the flag only + * exists on Linux, and with no way to probe for it via QMP. Our + * solution: if FIPS mode is required, then unconditionally use the fl= ag. + * + * In QEMU 5.2.0, use of -enable-fips was deprecated. In scenarios + * where FIPS is required, QEMU must be built against libgcrypt + * which automatically enforces FIPS compliance. + * + * Note this is the only use of driver->hostFips. + */ + if (driver->hostFips && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) virCommandAddArg(cmd, "-enable-fips"); if (qemuBuildMachineCommandLine(cmd, cfg, def, qemuCaps, priv) < 0) diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index db5b532cb8..72b0401c7b 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -51,7 +51,6 @@ virCommand *qemuBuildCommandLine(virDomainObj *vm, const char *migrateURI, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, - bool enableFips, size_t *nnicindexes, int **nicindexes, unsigned int flags); @@ -214,10 +213,6 @@ int qemuGetDriveSourceString(virStorageSource *src, bool qemuDiskConfigBlkdeviotuneEnabled(virDomainDiskDef *disk); - -bool -qemuCheckFips(virDomainObj *vm); - virJSONValue *qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) ATTRIBUTE_NONNULL(1); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 8097dcf144..2ca264d9f9 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6391,9 +6391,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, if (qemuConnectDomainXMLToNativePrepareHost(vm) < 0) return NULL; - if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL, - qemuCheckFips(vm), - commandlineflags))) + if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL, commandlinefl= ags))) return NULL; return virCommandToString(cmd, false); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fbad1254a0..d50cf2e6be 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7448,7 +7448,6 @@ qemuProcessLaunch(virConnectPtr conn, if (!(cmd =3D qemuBuildCommandLine(vm, incoming ? "defer" : NULL, snapshot, vmop, - qemuCheckFips(vm), &nnicindexes, &nicindexes, 0))) goto cleanup; @@ -7947,14 +7946,12 @@ qemuProcessCreatePretendCmdPrepare(virQEMUDriver *d= river, virCommand * qemuProcessCreatePretendCmdBuild(virDomainObj *vm, const char *migrateURI, - bool enableFips, unsigned int flags) { return qemuBuildCommandLine(vm, migrateURI, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP, - enableFips, NULL, NULL, flags); diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 9856da3bb5..2387fcdcdc 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -99,7 +99,6 @@ int qemuProcessCreatePretendCmdPrepare(virQEMUDriver *dri= ver, virCommand *qemuProcessCreatePretendCmdBuild(virDomainObj *vm, const char *migrateURI, - bool enableFips, unsigned int flags); int qemuProcessInit(virQEMUDriver *driver, diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 2385fa1209..50aea47a68 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -386,11 +386,9 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, unsigned int flags) { qemuDomainObjPrivate *priv =3D vm->privateData; - bool enableFips; size_t i; drv->hostFips =3D flags & FLAG_FIPS_HOST; - enableFips =3D drv->hostFips; if (qemuProcessCreatePretendCmdPrepare(drv, vm, migrateURI, VIR_QEMU_PROCESS_START_COLD) < = 0) @@ -486,12 +484,7 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, } } - /* we can't use qemuCheckFips() directly as it queries host state */ - if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) - enableFips =3D false; - - return qemuProcessCreatePretendCmdBuild(vm, migrateURI, - enableFips, 0); + return qemuProcessCreatePretendCmdBuild(vm, migrateURI, 0); } --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652714045; cv=none; d=zohomail.com; s=zohoarc; b=VXd6vMXzv3BYfjSk3aROAgZ1MqpXKR3a8DruW89GpGnCLgpmPVUln9YqF8H1iVWab1699XcSGdRdUXe8q3rxGhaLmwbFmDjF6VIgqWReew8WAbPm2fqlmZXA1SdKL3wuCJEfG/v4cSjixWWwq/L02eMZaAHdME5S1BoYEew/ucg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652714045; 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=4v+k43UtrxexoDNoTbUjgA46ry+v4oLj0VC5HdrPzVE=; b=gyTCHj1ELUuWasHwxaRBmfN4+3q9f3x04k4a5OhN1DhI6bmcHPENxRxbdgN4n3O3S9iCu2pj8VnsjDtd+tMgVYh7A1VJh8WqZWniqWJDA+mIubi5jugZIe8mImc8EmQ2sTsBy4Eds9eSMQHNKoIYm1seR3IXrocNkIbNbadLXd8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652714045437825.384430217681; Mon, 16 May 2022 08:14:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-534-Ly3ibavxPcqoSIIK7wkxoA-1; Mon, 16 May 2022 11:13:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 37CEA185A7BA; Mon, 16 May 2022 15:12:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 212324010E22; Mon, 16 May 2022 15:12:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E51081947055; Mon, 16 May 2022 15:12:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EEBDA194706E for ; Mon, 16 May 2022 15:12:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D20BA492C14; Mon, 16 May 2022 15:12:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 306EB401E74 for ; Mon, 16 May 2022 15:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652714044; 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=4v+k43UtrxexoDNoTbUjgA46ry+v4oLj0VC5HdrPzVE=; b=hl65ioTxmimWNa4KwlrRnbI9ySbA+nbOyA0j0dsy47kFJQB20sLbkhNpx21JbYps0C3izd ytTJFvDLYC/DxM8DtnACbRkfrg3UP/D6XBwh8LmO2wCJyCmxL4xZM+Mk4exwrxqnWMwdI6 IA7u3mu8wHzyTrKWXA64E9dTNJMkP6c= X-MC-Unique: Ly3ibavxPcqoSIIK7wkxoA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/11] qemuBuildCommandLine: Don't avoid '-S' flag for 'domxml-to-native' conversion Date: Mon, 16 May 2022 17:12:40 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652714047135100003 Content-Type: text/plain; charset="utf-8" The commandline generated from our XML->native convertor is the majority of cases not usable without libvirt anyways and the situation will not improve any more. As of such there's no much utility of avoiding the use of stopped CPUs flag in such case. Remove the QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING flag and the associated logic. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 3 +-- src/qemu/qemu_command.h | 4 ---- src/qemu/qemu_driver.c | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8705f0018c..25b8dcb10a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10436,8 +10436,7 @@ qemuBuildCommandLine(virDomainObj *vm, qemuBuildCompatDeprecatedCommandLine(cmd, cfg, def, qemuCaps); - if (!(flags & QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING)) - virCommandAddArg(cmd, "-S"); /* freeze CPU */ + virCommandAddArg(cmd, "-S"); /* freeze CPUs during startup */ if (qemuBuildMasterKeyCommandLine(cmd, priv) < 0) return NULL; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 72b0401c7b..087ab52ee5 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -43,10 +43,6 @@ VIR_ENUM_DECL(qemuVideo); VIR_ENUM_DECL(qemuSoundCodec); -typedef enum { - QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING =3D 1 << 0, -} qemuBuildCommandLineFlags; - virCommand *qemuBuildCommandLine(virDomainObj *vm, const char *migrateURI, virDomainMomentObj *snapshot, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2ca264d9f9..5f4990b09c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6339,7 +6339,6 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, virQEMUDriver *driver =3D conn->privateData; g_autoptr(virDomainObj) vm =3D NULL; g_autoptr(virCommand) cmd =3D NULL; - unsigned int commandlineflags =3D QEMU_BUILD_COMMAND_LINE_CPUS_RUNNING; size_t i; virCheckFlags(0, NULL); @@ -6391,7 +6390,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, if (qemuConnectDomainXMLToNativePrepareHost(vm) < 0) return NULL; - if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL, commandlinefl= ags))) + if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL, 0))) return NULL; return virCommandToString(cmd, false); --=20 2.35.3 From nobody Mon May 6 18:25:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1652714050; cv=none; d=zohomail.com; s=zohoarc; b=JiCKqz+8a/Ti1ogJB+cNkznMoiC3BHSWV4Or/cELTeayNVBbDZoVXvIuL7P4BmO6ek+A2xAy69Rie0nQQaKVpD9JmuJJ2tgxlhNnjBkvlr4wszknAPySiuYQnBVEyryEz4Gis3hJyJmnXk4ktH2sEzWAMkYYLr1aTCVlqY6AR5c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652714050; 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=gyd5G6UKUJAa98nzMAIqsrhKWpkJ8mIRVuU/jMxkSNc=; b=KZXg6QiZ6rLLbgqO2Lgk/77CdgYEoavPuuUa6rRqBYl9l8L9BCa9glvWkPStO6ThP4V36ez3IKGZzZ72osu3482ptdPBoVadba81kb9s/OeIY6lo8n5cfb6P+jRt8Tb0aC4FRBjwEJIZRIijPwImpsROnAAuQetZLtnmIw7Y78I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1652714050649486.53256196030793; Mon, 16 May 2022 08:14:10 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-378-yMY4EWXrOoewOPRNjCZLcg-1; Mon, 16 May 2022 11:13:04 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14365805F70; Mon, 16 May 2022 15:12:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3FBA151F5D0; Mon, 16 May 2022 15:12:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5A381194707C; Mon, 16 May 2022 15:12:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 186151947054 for ; Mon, 16 May 2022 15:12:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E800A403152; Mon, 16 May 2022 15:12:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D25D401DBE for ; Mon, 16 May 2022 15:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652714049; 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=gyd5G6UKUJAa98nzMAIqsrhKWpkJ8mIRVuU/jMxkSNc=; b=Jfm0WZta9gn8iSHAKnLzfcFcSy6alkuMKVKTtD5B3fbjb9eEBB3mLD+n7Rhy/Qdc1CxkyU 9a14/e8U+gFiC1gIr40iCPE+WNx1TT4GY5t235K+HIL7sCnTZsDw/GV57XbnmzFH3eufjK qRNqKNqEkUKfnL8Z69sTxU/PLYsE2UI= X-MC-Unique: yMY4EWXrOoewOPRNjCZLcg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/11] qemuBuildCommandLine: Remove 'flags' argument Date: Mon, 16 May 2022 17:12:41 +0200 Message-Id: <35349a5f06b620b85c9bd74d17deb6acfacc69ed.1652710341.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652714051155100001 Content-Type: text/plain; charset="utf-8" The flags are not used for anything. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- src/qemu/qemu_command.c | 7 +++---- src/qemu/qemu_command.h | 3 +-- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_process.c | 8 +++----- src/qemu/qemu_process.h | 3 +-- tests/qemuxml2argvtest.c | 2 +- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 25b8dcb10a..38bf4ebea5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10392,8 +10392,7 @@ qemuBuildCommandLine(virDomainObj *vm, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, size_t *nnicindexes, - int **nicindexes, - unsigned int flags) + int **nicindexes) { size_t i; char uuid[VIR_UUID_STRING_BUFLEN]; @@ -10404,8 +10403,8 @@ qemuBuildCommandLine(virDomainObj *vm, virDomainDef *def =3D vm->def; virQEMUCaps *qemuCaps =3D priv->qemuCaps; - VIR_DEBUG("Building qemu commandline for def=3D%s(%p) migrateURI=3D%s = snapshot=3D%p vmop=3D%d flags=3D0x%x", - def->name, def, migrateURI, snapshot, vmop, flags); + VIR_DEBUG("Building qemu commandline for def=3D%s(%p) migrateURI=3D%s = snapshot=3D%p vmop=3D%d", + def->name, def, migrateURI, snapshot, vmop); if (qemuBuildCommandLineValidate(driver, def) < 0) return NULL; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 087ab52ee5..2bb4984656 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -48,8 +48,7 @@ virCommand *qemuBuildCommandLine(virDomainObj *vm, virDomainMomentObj *snapshot, virNetDevVPortProfileOp vmop, size_t *nnicindexes, - int **nicindexes, - unsigned int flags); + int **nicindexes); /* Generate the object properties for pr-manager */ virJSONValue *qemuBuildPRManagerInfoProps(virStorageSource *src); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5f4990b09c..2533e22c38 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6390,7 +6390,7 @@ static char *qemuConnectDomainXMLToNative(virConnectP= tr conn, if (qemuConnectDomainXMLToNativePrepareHost(vm) < 0) return NULL; - if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL, 0))) + if (!(cmd =3D qemuProcessCreatePretendCmdBuild(vm, NULL))) return NULL; return virCommandToString(cmd, false); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d50cf2e6be..cabec71c1e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7448,7 +7448,7 @@ qemuProcessLaunch(virConnectPtr conn, if (!(cmd =3D qemuBuildCommandLine(vm, incoming ? "defer" : NULL, snapshot, vmop, - &nnicindexes, &nicindexes, 0))) + &nnicindexes, &nicindexes))) goto cleanup; if (incoming && incoming->fd !=3D -1) @@ -7945,16 +7945,14 @@ qemuProcessCreatePretendCmdPrepare(virQEMUDriver *d= river, virCommand * qemuProcessCreatePretendCmdBuild(virDomainObj *vm, - const char *migrateURI, - unsigned int flags) + const char *migrateURI) { return qemuBuildCommandLine(vm, migrateURI, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP, NULL, - NULL, - flags); + NULL); } diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 2387fcdcdc..9866d2bf35 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -98,8 +98,7 @@ int qemuProcessCreatePretendCmdPrepare(virQEMUDriver *dri= ver, unsigned int flags); virCommand *qemuProcessCreatePretendCmdBuild(virDomainObj *vm, - const char *migrateURI, - unsigned int flags); + const char *migrateURI); int qemuProcessInit(virQEMUDriver *driver, virDomainObj *vm, diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 50aea47a68..afb8aa1aea 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -484,7 +484,7 @@ testCompareXMLToArgvCreateArgs(virQEMUDriver *drv, } } - return qemuProcessCreatePretendCmdBuild(vm, migrateURI, 0); + return qemuProcessCreatePretendCmdBuild(vm, migrateURI); } --=20 2.35.3