From nobody Sun May 19 20:02:55 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=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1691571008; cv=none; d=zohomail.com; s=zohoarc; b=IWwo22wpOyxwiYnbyjuZUWKrzzSCCEnrRCTPUcWHdSNZ4pawXdF2DEnpx4yzzyKrQdiqXAXEKGQuoFQd5xLVoBA6s/IorZU73e4Y4G7pxAOTsLomhWkSrrUrEJkF8AJvVs5Z7sLHW24uFRPvAjXkpITB5yaGZjvJkycnmvtx728= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691571008; h=Content-Type:Content-Transfer-Encoding:Cc: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=Ygt5S0QLarjAAzb9gq3EH+g1265jP0GNz7MhbG3O4j4=; b=FfiyCpphagXSGnzHxzovS1kanRuVfrxTB6lMlxgYC8yWhO+DirVN8e6yf/hEeOAV8cJ8wRrmQNFu/bZo4ZEljEuoxcDZr+brp9vcyPSHJpxSjR0j9a1qf6XfCxZVLdJNWU/DpgHxjym4N8dpGDbGcr1kEky3hqJ39a4fDPKmTkA= 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=fail header.from= (p=reject 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 1691571008205321.51787947159403; Wed, 9 Aug 2023 01:50:08 -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-568-jCAT3e9ON2eopMF7l5Zfhg-1; Wed, 09 Aug 2023 04:50:03 -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 6F9FA85CBE7; Wed, 9 Aug 2023 08:50:00 +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 57D9E4021AD; Wed, 9 Aug 2023 08:50:00 +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 3E30A1946588; Wed, 9 Aug 2023 08:50:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 681841946589 for ; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5BC2740C6E8A; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 53E1140C6F4E for ; Wed, 9 Aug 2023 08:49:56 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 26D581C0755D for ; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-551-x6dduz0oNsa6xw4x7DLjuA-1; Wed, 09 Aug 2023 04:49:54 -0400 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3798bV6C011653 for ; Wed, 9 Aug 2023 08:49:52 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sc7at8dxa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:52 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3797VGGF000403 for ; Wed, 9 Aug 2023 08:49:51 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa28kpeua-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:51 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3798nmlp17695358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 08:49:48 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1B18C20040; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC5FA2004F; Wed, 9 Aug 2023 08:49:47 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 9 Aug 2023 08:49:47 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691571007; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Ygt5S0QLarjAAzb9gq3EH+g1265jP0GNz7MhbG3O4j4=; b=XqYsdFX64SPdre4MaUirGkA02IPlcqQ1N+Ai1PwJntt7xeDzfqoIsFRkl9eYYh+WaBg2px oKSXSn0TgbGg9pYffJK/sS/YawUo0aYm1Lhxwq00uMxp0Wn3Mr6BD8qAq4WRSSBk7f2PXW RUYcZJGjoQaOHOIeXdwT3+251JipWIk= X-MC-Unique: jCAT3e9ON2eopMF7l5Zfhg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: x6dduz0oNsa6xw4x7DLjuA-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 1/5] schemas: Add virYesNoOptional Date: Wed, 9 Aug 2023 10:49:43 +0200 Message-ID: <20230809084947.13584-2-fiuczy@linux.ibm.com> In-Reply-To: <20230809084947.13584-1-fiuczy@linux.ibm.com> References: <20230809084947.13584-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 4WRYQIdrMmq9oqAX1nbRa4V7hI6lBXfZ X-Proofpoint-GUID: 4WRYQIdrMmq9oqAX1nbRa4V7hI6lBXfZ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-09_06,2023-08-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 phishscore=0 spamscore=0 mlxlogscore=619 adultscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 mlxscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090075 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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: , Cc: mihajlov@linux.ibm.com, mhartmay@linux.ibm.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691571009879100007 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Boris Fiuczynski --- src/conf/schemas/basictypes.rng | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/conf/schemas/basictypes.rng b/src/conf/schemas/basictypes.= rng index 2d6f1a2c84..97d7ad7caf 100644 --- a/src/conf/schemas/basictypes.rng +++ b/src/conf/schemas/basictypes.rng @@ -603,6 +603,14 @@ =20 + + + yes + no + optional + + + on --=20 2.41.0 From nobody Sun May 19 20:02:55 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=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1691571008; cv=none; d=zohomail.com; s=zohoarc; b=EcfrGTE1VQjKknfdyCJrrApyBXKy69/ouHFQIvipgZ/0GyoDtE5/gzOeY/Xq+eoDipr8HmgRYJ6QO3zbW1cu2kT7fAthKPf9+nTIqVlBRX6Gw6YZ9bdjpSfBnXZfChNT8hTdAzAxLf9s05BzoChlEGTdoCXuIMsEdSw5dUIhVzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691571008; h=Content-Type:Content-Transfer-Encoding:Cc: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=bVdwL2NNuRYSl6oXBsSNfqays37aq+4am6oP33e7zU0=; b=CSTJp6U8Y7mhct1ngbGyR/kZXmGRCYYbUkNBJAyts8/9RGbBlSXRSK5N48ck03woBFRW4gkaONYQxBmh/cqCiHA3wtUTCykDgzHktu+1r4d8zKktd3g6+l/wPjlbc+IAPKybLXALnqIIt4vRbmrUPtpJb1PhQzaKTY6seO2QayI= 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=fail header.from= (p=reject 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 1691571008199294.7883476159302; Wed, 9 Aug 2023 01:50:08 -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-619--8LYLQ78NbOJVR8H4Sxm9w-1; Wed, 09 Aug 2023 04:50:03 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2B6CA100B18A; Wed, 9 Aug 2023 08:49: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 15C831121319; Wed, 9 Aug 2023 08:49:59 +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 EFF111946A67; Wed, 9 Aug 2023 08:49:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E29851946586 for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D178E40C2077; Wed, 9 Aug 2023 08:49:55 +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 C9E3040C2076 for ; Wed, 9 Aug 2023 08:49:55 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2AE4855710 for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-148-rAX8gHzDPtSHDDwRfESQ5A-1; Wed, 09 Aug 2023 04:49:53 -0400 Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3798f1bv000906 for ; Wed, 9 Aug 2023 08:49:52 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sc7cx08ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:52 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3797jmZO015363 for ; Wed, 9 Aug 2023 08:49:51 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3sb3f3079n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:51 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3798nmZr14811728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 08:49:48 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 46E3F20040; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 24EC02004B; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691571007; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=bVdwL2NNuRYSl6oXBsSNfqays37aq+4am6oP33e7zU0=; b=Tv+72csycGUPaTZEOABqO+YIxSKP/I5NBNsih3VBXhlsOsqH0S9J5b3g4lK++UWm3aEWjB 2CR10AD/mMgaGerIJA24oZq/onOQo52ok+idmvc8hrWUQK/EOaJQEtVskqRQwcgYrPt3dy pBNg3lJPsxfTk6kRXXAv+nikoqRV9ic= X-MC-Unique: -8LYLQ78NbOJVR8H4Sxm9w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: rAX8gHzDPtSHDDwRfESQ5A-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 2/5] util: Add virQuadstateOption and helpers Date: Wed, 9 Aug 2023 10:49:44 +0200 Message-ID: <20230809084947.13584-3-fiuczy@linux.ibm.com> In-Reply-To: <20230809084947.13584-1-fiuczy@linux.ibm.com> References: <20230809084947.13584-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -yRLYUmKvczVA-7J4AbGWwsK4KC6XYak X-Proofpoint-GUID: -yRLYUmKvczVA-7J4AbGWwsK4KC6XYak X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-09_06,2023-08-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 mlxscore=0 phishscore=0 clxscore=1015 adultscore=0 suspectscore=0 malwarescore=0 mlxlogscore=849 spamscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090075 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: , Cc: mihajlov@linux.ibm.com, mhartmay@linux.ibm.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691571009901100008 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Boris Fiuczynski --- src/util/virenum.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/util/virenum.h | 15 +++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/util/virenum.c b/src/util/virenum.c index c6936e58ff..8474db9b2b 100644 --- a/src/util/virenum.c +++ b/src/util/virenum.c @@ -35,6 +35,14 @@ VIR_ENUM_IMPL(virTristateSwitch, "off", ); =20 +VIR_ENUM_IMPL(virQuadstateOption, + VIR_QUADSTATE_OPTION_LAST, + "default", + "yes", + "no", + "optional", +); + =20 virTristateBool virTristateBoolFromBool(bool val) @@ -110,6 +118,44 @@ virTristateSwitchToBool(virTristateSwitch t, } =20 =20 +virQuadstateOption +virQuadstateOptionFromBool(bool val) +{ + if (val) + return VIR_QUADSTATE_OPTION_YES; + else + return VIR_QUADSTATE_OPTION_NO; +} + + +/** + * virQuadstateOptionToBool: + * @t: a virQuadstateOption value + * @b: pointer to a boolean to be updated according to the value of @t + * + * The value pointed to by @b is updated if the quadstate value @t is neit= her absent or optional. + */ +void +virQuadstateOptionToBool(virQuadstateOption t, + bool *b) +{ + switch (t) { + case VIR_QUADSTATE_OPTION_YES: + *b =3D true; + break; + + case VIR_QUADSTATE_OPTION_NO: + *b =3D false; + break; + + case VIR_QUADSTATE_OPTION_ABSENT: + case VIR_QUADSTATE_OPTION_OPTIONAL: + case VIR_QUADSTATE_OPTION_LAST: + break; + } +} + + int virEnumFromString(const char * const *types, unsigned int ntypes, diff --git a/src/util/virenum.h b/src/util/virenum.h index 98f01d574d..bd45d470c4 100644 --- a/src/util/virenum.h +++ b/src/util/virenum.h @@ -64,16 +64,31 @@ typedef enum { VIR_TRISTATE_SWITCH_LAST } virTristateSwitch; =20 +typedef enum { + VIR_QUADSTATE_OPTION_ABSENT =3D 0, + VIR_QUADSTATE_OPTION_YES, + VIR_QUADSTATE_OPTION_NO, + VIR_QUADSTATE_OPTION_OPTIONAL, + + VIR_QUADSTATE_OPTION_LAST +} virQuadstateOption; + VIR_ENUM_DECL(virTristateBool); VIR_ENUM_DECL(virTristateSwitch); +VIR_ENUM_DECL(virQuadstateOption); =20 virTristateBool virTristateBoolFromBool(bool val); void virTristateBoolToBool(virTristateBool t, bool *b); virTristateSwitch virTristateSwitchFromBool(bool val); void virTristateSwitchToBool(virTristateSwitch t, bool *b); +virQuadstateOption virQuadstateOptionFromBool(bool val); +void virQuadstateOptionToBool(virQuadstateOption t, bool *b); =20 /* the two enums must be in sync to be able to use helpers interchangeably= in * some special cases */ G_STATIC_ASSERT((int)VIR_TRISTATE_BOOL_YES =3D=3D (int)VIR_TRISTATE_SWITCH= _ON); G_STATIC_ASSERT((int)VIR_TRISTATE_BOOL_NO =3D=3D (int)VIR_TRISTATE_SWITCH_= OFF); G_STATIC_ASSERT((int)VIR_TRISTATE_BOOL_ABSENT =3D=3D (int)VIR_TRISTATE_SWI= TCH_ABSENT); +G_STATIC_ASSERT((int)VIR_QUADSTATE_OPTION_YES =3D=3D (int)VIR_TRISTATE_SWI= TCH_ON); +G_STATIC_ASSERT((int)VIR_QUADSTATE_OPTION_NO =3D=3D (int)VIR_TRISTATE_SWIT= CH_OFF); +G_STATIC_ASSERT((int)VIR_QUADSTATE_OPTION_ABSENT =3D=3D (int)VIR_TRISTATE_= SWITCH_ABSENT); --=20 2.41.0 From nobody Sun May 19 20:02:55 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=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1691571007; cv=none; d=zohomail.com; s=zohoarc; b=J+wP0mU91eW4/YVPcsbi9qW1rztwY0qjVjSpDZ2sIPQIBMzyoG4b3GJxKx3CKLAzf7YR5CG9LcCHAgOLXw/3TDvQ7nFmFBdRBix+1uPGu22Sp/ISD2nWRbxC7N57P1s92AcSmK+t7ovWmW0jzd2Ix2OWMcRv3X5f43qW+rvGZg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691571007; h=Content-Type:Content-Transfer-Encoding:Cc: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=j1WLi4UWzL/rNQzXnpiylqqsnm5V6d0cU3glYwpxR5Q=; b=YwnXXnXJ8oSev7n1q2sfD5O6fPM5IChhaOhmEzELUvvtRthDZiRQAV6V/rOTarkLwTmn0nV1GuQiRC7Yh7piHfx/LlfzJ764U3PPybh7tB1pDlZMTUZZm4DTa5T6Bu9B7DI5FFx+FaZW3uo1I6WbjSh9xE7jm8ToayyMALI+ZrI= 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=fail header.from= (p=reject 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 169157100710740.962560529437496; Wed, 9 Aug 2023 01:50:07 -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-160-4wsNGSBkNlS1s3dJtHP9vQ-1; Wed, 09 Aug 2023 04:50:00 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 764E480D11C; Wed, 9 Aug 2023 08:49:57 +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 8E7712166B25; Wed, 9 Aug 2023 08:49: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 657201946588; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 720C21946586 for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5130E40C2076; Wed, 9 Aug 2023 08:49:55 +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 49ED340C2077 for ; Wed, 9 Aug 2023 08:49:55 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2299E185A793 for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-402-VURDMoWcNlKJFOuD-WxFkg-1; Wed, 09 Aug 2023 04:49:53 -0400 Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3798nEi5002277 for ; Wed, 9 Aug 2023 08:49:52 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sc78vgjy6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:52 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3797VGGG000403 for ; Wed, 9 Aug 2023 08:49:51 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa28kpeud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:51 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3798nmZL17695364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 08:49:48 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F1A02004B; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4FAD32004E; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691571006; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=j1WLi4UWzL/rNQzXnpiylqqsnm5V6d0cU3glYwpxR5Q=; b=A6IU6hsvyfhzkJpcBBBdKPTssdayXChUYYp8E5PD8rBJm8K/HCTYEcgnCQsjH7Dnegptef IGoVlY04MunTZIHOl5W8X9z8fcPi+aUBhH3yWYsucDQbz0fdTqR3BFwstxZigIMEh8ri77 vtLcWimI+DdOEhOE4G1vGLaU291RXXM= X-MC-Unique: 4wsNGSBkNlS1s3dJtHP9vQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: VURDMoWcNlKJFOuD-WxFkg-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 3/5] virxml: Add virXMLPropQuadstateOption Date: Wed, 9 Aug 2023 10:49:45 +0200 Message-ID: <20230809084947.13584-4-fiuczy@linux.ibm.com> In-Reply-To: <20230809084947.13584-1-fiuczy@linux.ibm.com> References: <20230809084947.13584-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: grmUoTZy_hQX6oy3RWJoqzy6ahMzQaYy X-Proofpoint-GUID: grmUoTZy_hQX6oy3RWJoqzy6ahMzQaYy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-09_06,2023-08-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 spamscore=0 bulkscore=0 clxscore=1011 mlxlogscore=554 impostorscore=0 mlxscore=0 adultscore=0 suspectscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090075 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: , Cc: mihajlov@linux.ibm.com, mhartmay@linux.ibm.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691571009148100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Convenience function to return the value of a yes / no / optional XML attribute. Signed-off-by: Boris Fiuczynski --- src/libvirt_private.syms | 1 + src/util/virxml.c | 28 ++++++++++++++++++++++++++++ src/util/virxml.h | 7 +++++++ 3 files changed, 36 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index da60c965dd..3c9d4a4b04 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3720,6 +3720,7 @@ virXMLPropEnum; virXMLPropEnumDefault; virXMLPropInt; virXMLPropLongLong; +virXMLPropQuadstateOption; virXMLPropString; virXMLPropStringRequired; virXMLPropTristateBool; diff --git a/src/util/virxml.c b/src/util/virxml.c index 0c1eae8c3c..d0f554fab5 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -475,6 +475,34 @@ virXMLPropTristateSwitch(xmlNodePtr node, } =20 =20 +/** + * virXMLPropQuadstateOption: + * @node: XML dom node pointer + * @name: Name of the property (attribute) to get + * @flags: Bitwise-OR of virXMLPropFlags + * @result: The returned value + * + * Convenience function to return value of a yes / no / optional attribute. + * In case when the property is missing @result is initialized to + * VIR_QUADSTATE_OPTION_ABSENT. + * + * Returns 1 in case of success in which case @result is set, + * or 0 if the attribute is not present, + * or -1 and reports an error on failure. + */ +int +virXMLPropQuadstateOption(xmlNodePtr node, + const char *name, + virXMLPropFlags flags, + virQuadstateOption *result) +{ + flags |=3D VIR_XML_PROP_NONZERO; + + return virXMLPropEnumInternal(node, name, virQuadstateOptionTypeFromSt= ring, + flags, result, VIR_QUADSTATE_OPTION_ABSE= NT); +} + + /** * virXMLPropInt: * @node: XML dom node pointer diff --git a/src/util/virxml.h b/src/util/virxml.h index 7af47437bd..901c82e6e3 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -120,6 +120,13 @@ virXMLPropTristateSwitch(xmlNodePtr node, virTristateSwitch *result) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4); =20 +int +virXMLPropQuadstateOption(xmlNodePtr node, + const char *name, + virXMLPropFlags flags, + virQuadstateOption *result) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4); + int virXMLPropInt(xmlNodePtr node, const char *name, --=20 2.41.0 From nobody Sun May 19 20:02:55 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=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1691571009; cv=none; d=zohomail.com; s=zohoarc; b=aHaEde5clIFAXlJMQmiLbNTQvHzKkh6sLHUiLRHP5uVazUvzEqCH94rtNGJDpLwSwIhJWUdTN8CIAeCfYxr1DKbnmyeYeHEWuEgkSLN+cRkIMuX5Z4kpOFMl0tQ+FYm/yY8LjhVHPhIn0s+05ALeqc4Sg/EnSOuGdBGqXdsPhaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691571009; h=Content-Type:Content-Transfer-Encoding:Cc: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=MFXQAFNMPF5/96nlqai87cE8eeuQHEGkMqG1QIFqjFg=; b=dXa5zfslAF42gXAJXH9qVvxbgnBdSYDcRGd+uef0aFtGQMOxqbAzsMQDmwGi0d5llvnuyHG7HMJkavczBWIGQar8J+0Vcuy6z9gifSwGoj+MI+6EkIdftkjO959q3a7nLOX+ZeREpD1cU/csPo7fhIBBVwA3HHKkLXAb5KgInis= 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=fail header.from= (p=reject 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 1691571009198559.7258595553831; Wed, 9 Aug 2023 01:50:09 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-678-_VCXqEOZN5Op_MnRNH-mEA-1; Wed, 09 Aug 2023 04:50:00 -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 E48DD2815E31; Wed, 9 Aug 2023 08:49:57 +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 CA66E140E96E; Wed, 9 Aug 2023 08:49:57 +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 A173B19465B7; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9B7CE1946586 for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8AD85C15BB8; Wed, 9 Aug 2023 08:49:55 +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 828ECC15BAE for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-inbound-delivery-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 51A33101AA65 for ; Wed, 9 Aug 2023 08:49:55 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-549-YvncR2bYPFyOMdNGbdOeKg-1; Wed, 09 Aug 2023 04:49:53 -0400 Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3798eGJL007762 for ; Wed, 9 Aug 2023 08:49:52 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sc7aqgbfc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:52 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 37982WPf015374 for ; Wed, 9 Aug 2023 08:49:51 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3sb3f3079s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:51 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3798nmO817695366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 08:49:48 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A296D20043; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 795FC20040; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691571008; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=MFXQAFNMPF5/96nlqai87cE8eeuQHEGkMqG1QIFqjFg=; b=iIHregPx3iWQY584HCantN0Rb4syXF6+351fVcI/ansg0vZdQGaWsbtcn3vQ7WU9t/YUMf NKzqG+jR3u5eSoVG+a4zTuUvS+BlVkeqPr3IUVQC7G90HNDJz/g51zXPnGzomwh10yAi8Q 8BKxODpfvjFjIY/5p/MZX5Vnyzu6dDk= X-MC-Unique: _VCXqEOZN5Op_MnRNH-mEA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: YvncR2bYPFyOMdNGbdOeKg-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 4/5] conf: Add 'optional' to feature async-teardown Date: Wed, 9 Aug 2023 10:49:46 +0200 Message-ID: <20230809084947.13584-5-fiuczy@linux.ibm.com> In-Reply-To: <20230809084947.13584-1-fiuczy@linux.ibm.com> References: <20230809084947.13584-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 4e8q8nxsI2UoA6xgtoqcKKw0v4j7XbhN X-Proofpoint-ORIG-GUID: 4e8q8nxsI2UoA6xgtoqcKKw0v4j7XbhN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-09_06,2023-08-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxlogscore=999 spamscore=0 impostorscore=0 malwarescore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 adultscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090075 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 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: , Cc: mihajlov@linux.ibm.com, mhartmay@linux.ibm.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691571009746100005 Content-Type: text/plain; charset="utf-8"; x-default="true" Allow to use 'optional' on attribute 'enabled' of async-teardown. This allows a user to exploit the feature if it is provided by QEMU. Also adding tests and documentation. Signed-off-by: Boris Fiuczynski --- docs/formatdomain.rst | 7 ++-- src/conf/domain_conf.c | 14 ++++---- src/conf/schemas/domaincommon.rng | 2 +- src/qemu/qemu_command.c | 6 ++-- src/qemu/qemu_process.c | 18 ++++++++++ src/qemu/qemu_validate.c | 2 +- ...0-async-teardown-optional.s390x-6.0.0.args | 35 ++++++++++++++++++ ...-async-teardown-optional.s390x-latest.args | 36 +++++++++++++++++++ .../s390-async-teardown-optional.xml | 24 +++++++++++++ tests/qemuxml2argvtest.c | 2 ++ 10 files changed, 132 insertions(+), 14 deletions(-) create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-optional.s39= 0x-6.0.0.args create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-optional.s39= 0x-latest.args create mode 100644 tests/qemuxml2argvdata/s390-async-teardown-optional.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index cd9cb02bf8..61f90e1f11 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2232,9 +2232,10 @@ are: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =20 ``async-teardown`` - Depending on the ``enabled`` attribute (values ``yes``, ``no``) enable = or - disable QEMU asynchronous teardown to improve memory reclaiming on a gu= est. - :since:`Since 9.6.0` (QEMU only) + Depending on the ``enabled`` attribute (values ``yes``, ``no``, ``optio= nal``) + enable or disable QEMU asynchronous teardown to improve memory reclaimi= ng on + a guest. Setting ``optional`` will enable the feature if QEMU supports = the + feature and otherwise disable it. :since:`Since 9.6.0` (QEMU only) =20 Time keeping ------------ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 47693a49bf..7191e37a6c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16691,14 +16691,14 @@ virDomainFeaturesDefParse(virDomainDef *def, break; =20 case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN: { - virTristateBool enabled; + virQuadstateOption enabled; =20 - if (virXMLPropTristateBool(nodes[i], "enabled", - VIR_XML_PROP_NONE, &enabled) < 0) + if (virXMLPropQuadstateOption(nodes[i], "enabled", + VIR_XML_PROP_NONE, &enabled) < 0) return -1; =20 - if (enabled =3D=3D VIR_TRISTATE_BOOL_ABSENT) - enabled =3D VIR_TRISTATE_BOOL_YES; + if (enabled =3D=3D VIR_QUADSTATE_OPTION_ABSENT) + enabled =3D VIR_QUADSTATE_OPTION_YES; =20 def->features[val] =3D enabled; break; @@ -27357,9 +27357,9 @@ virDomainDefFormatFeatures(virBuffer *buf, break; =20 case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN: - if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ABSENT) + if (def->features[i] !=3D VIR_QUADSTATE_OPTION_ABSENT) virBufferAsprintf(&childBuf, "\n", - virTristateBoolTypeToString(def->feature= s[i])); + virQuadstateOptionTypeToString(def->feat= ures[i])); break; =20 case VIR_DOMAIN_FEATURE_LAST: diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index c2f56b0490..cc116a8b24 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -6664,7 +6664,7 @@ - + diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 77c5335bde..ef5e2c5239 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10195,10 +10195,12 @@ qemuBuildAsyncTeardownCommandLine(virCommand *cmd, virQEMUCaps *qemuCaps) { g_autofree char *async =3D NULL; - virTristateBool enabled =3D def->features[VIR_DOMAIN_FEATURE_ASYNC_TEA= RDOWN]; + virQuadstateOption enabled =3D def->features[VIR_DOMAIN_FEATURE_ASYNC_= TEARDOWN]; =20 - if (enabled !=3D VIR_TRISTATE_BOOL_ABSENT && + if (enabled !=3D VIR_QUADSTATE_OPTION_ABSENT && virQEMUCapsGet(qemuCaps, QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN)) { + if (enabled =3D=3D VIR_QUADSTATE_OPTION_OPTIONAL) + enabled =3D VIR_QUADSTATE_OPTION_YES; async =3D g_strdup_printf("async-teardown=3D%s", virTristateSwitchTypeToString(enabled)); virCommandAddArgList(cmd, "-run-with", async, NULL); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0644f80161..7db6e0069e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6591,6 +6591,19 @@ qemuProcessUpdateSEVInfo(virDomainObj *vm) } =20 =20 +static void +qemuProcessUpdateAsyncTeardown(virDomainObj *vm) +{ + virDomainDef *def =3D vm->def; + qemuDomainObjPrivate *priv =3D vm->privateData; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_RUN_WITH_ASYNC_TEARDOWN)) + def->features[VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN] =3D VIR_QUADSTATE= _OPTION_YES; + else + def->features[VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN] =3D VIR_QUADSTATE= _OPTION_NO; +} + + /* qemuProcessPrepareChardevSource: * @def: live domain definition * @cfg: driver configuration @@ -6752,6 +6765,11 @@ qemuProcessPrepareDomain(virQEMUDriver *driver, return -1; } =20 + if (vm->def->features[VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN] =3D=3D VIR_QU= ADSTATE_OPTION_OPTIONAL) { + VIR_DEBUG("Prepare feature async-teardown enablement from optional= "); + qemuProcessUpdateAsyncTeardown(vm); + } + return 0; } =20 diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index d5c2b2cd44..fe010397ba 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -220,7 +220,7 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, break; =20 case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN: - if (def->features[i] =3D=3D VIR_TRISTATE_BOOL_YES && + if (def->features[i] =3D=3D VIR_QUADSTATE_OPTION_YES && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_RUN_WITH_ASYNC_TEARDOW= N)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("asynchronous teardown is not available wi= th this QEMU binary")); diff --git a/tests/qemuxml2argvdata/s390-async-teardown-optional.s390x-6.0.= 0.args b/tests/qemuxml2argvdata/s390-async-teardown-optional.s390x-6.0.0.ar= gs new file mode 100644 index 0000000000..57690530a2 --- /dev/null +++ b/tests/qemuxml2argvdata/s390-async-teardown-optional.s390x-6.0.0.args @@ -0,0 +1,35 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine s390-ccw-virtio-6.0,usb=3Doff,dump-guest-core=3Doff,memory-backen= d=3Ds390.ram \ +-accel tcg \ +-cpu qemu \ +-m size=3D262144k \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456= }' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device virtio-serial-ccw,id=3Dvirtio-serial0,devno=3Dfe.0.0000 \ +-chardev pty,id=3Dcharconsole0 \ +-device virtconsole,chardev=3Dcharconsole0,id=3Dconsole0 \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0001 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/s390-async-teardown-optional.s390x-late= st.args b/tests/qemuxml2argvdata/s390-async-teardown-optional.s390x-latest.= args new file mode 100644 index 0000000000..cc7866499f --- /dev/null +++ b/tests/qemuxml2argvdata/s390-async-teardown-optional.s390x-latest.args @@ -0,0 +1,36 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \ +/usr/bin/qemu-system-s390x \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}' \ +-machine s390-ccw-virtio,usb=3Doff,dump-guest-core=3Doff,memory-backend=3D= s390.ram \ +-accel tcg \ +-cpu qemu \ +-m size=3D262144k \ +-object '{"qom-type":"memory-backend-ram","id":"s390.ram","size":268435456= }' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 9aa4b45c-b9dd-45ef-91fe-862b27b4231f \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"virtio-serial-ccw","id":"virtio-serial0","devno":"fe.0= .0000"}' \ +-chardev pty,id=3Dcharconsole0 \ +-device '{"driver":"virtconsole","chardev":"charconsole0","id":"console0"}= ' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-device '{"driver":"virtio-balloon-ccw","id":"balloon0","devno":"fe.0.0001= "}' \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-run-with async-teardown=3Don \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/s390-async-teardown-optional.xml b/test= s/qemuxml2argvdata/s390-async-teardown-optional.xml new file mode 100644 index 0000000000..6e4fe3b1dd --- /dev/null +++ b/tests/qemuxml2argvdata/s390-async-teardown-optional.xml @@ -0,0 +1,24 @@ + + QEMUGuest1 + 9aa4b45c-b9dd-45ef-91fe-862b27b4231f + 262144 + 262144 + + hvm + + + destroy + restart + destroy + + + + + /usr/bin/qemu-system-s390x + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c44b9bc494..1a84ac1526 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2705,6 +2705,8 @@ mymain(void) DO_TEST_CAPS_ARCH_VER_PARSE_ERROR("s390-async-teardown", "s390x", "6.0= .0"); DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-disabled", "s390x"); DO_TEST_CAPS_ARCH_VER("s390-async-teardown-disabled", "s390x", "6.0.0"= ); + DO_TEST_CAPS_ARCH_LATEST("s390-async-teardown-optional", "s390x"); + DO_TEST_CAPS_ARCH_VER("s390-async-teardown-optional", "s390x", "6.0.0"= ); =20 qemuTestDriverFree(&driver); virFileWrapperClearPrefixes(); --=20 2.41.0 From nobody Sun May 19 20:02:55 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=fail(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1691571066; cv=none; d=zohomail.com; s=zohoarc; b=SoW6yUV2uPluqXgoAvAsJuKz+RLzSS+Ej3NdOp5JIVQSxGROHXNPdqdxIO2wfc3b5EzkliZr29SJj+fBJNn0OHgN0yTshx4Bcx6ZgmpiEQSXs1s7qft+0S27fJFVG6uqKPvtjzgSvctUhhqT39nDpayI5vsF0ylTeoXNYehs754= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691571066; h=Content-Type:Content-Transfer-Encoding:Cc: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=IH/58m8U04AJv8QUGqcVg6e4ujvUyaDHNHfqA56LEOw=; b=akfyj8ztXNEQ2UJNSoB/gZlzAWFsy/qE45yMIx32LDr8koakdjvmPAFqgemCThmHFWer3i0afdRy79nnj9Ic0MxSIVLrGrM2mbXbn4P1rxflAbydLY4Q9zG1NtKlavtuajYiG403AWYtKs/wyfmXLTKeVS3KIayGad1p/EXh9ns= 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=fail header.from= (p=reject 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 1691571066182465.4721344541267; Wed, 9 Aug 2023 01:51:06 -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-687-OY_ty4O8MDSKVnyLqFOcuA-1; Wed, 09 Aug 2023 04:50:02 -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 A0C3385CBFA; Wed, 9 Aug 2023 08:49: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 86B67492B0F; Wed, 9 Aug 2023 08:49: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 9F9B51946A4E; Wed, 9 Aug 2023 08:49:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B8EE21946A40 for ; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A9B4E2026D68; Wed, 9 Aug 2023 08:49:56 +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 A1EDA2026D4B for ; Wed, 9 Aug 2023 08:49:56 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7819E1875845 for ; Wed, 9 Aug 2023 08:49:56 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-222-e8VxSGgmNxCIy8vi214RbA-1; Wed, 09 Aug 2023 04:49:54 -0400 Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3798fwRu003047 for ; Wed, 9 Aug 2023 08:49:53 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3sc7gxg60f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:53 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3797VGGH000403 for ; Wed, 9 Aug 2023 08:49:52 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3sa28kpeue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 Aug 2023 08:49:51 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3798nmAN17695368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 9 Aug 2023 08:49:48 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC4F42004E; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ACADF2004B; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 9 Aug 2023 08:49:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691571065; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=IH/58m8U04AJv8QUGqcVg6e4ujvUyaDHNHfqA56LEOw=; b=aOMDDu7HubIHub6oyC73PirxHzcw68NiSMkC0dPaqFEPg6LFO7nkTQJ9MW9kzjfA8Eu5rL g8lhFFT9NGCybh50cVD09uZDNmkw1Mx5s/Q6J/RZzsS3ql1gMneDiLSa0UR/Ja1lhxYo/L Ojp7txyd0WUPPteSrPOCKg2E76lImDs= X-MC-Unique: OY_ty4O8MDSKVnyLqFOcuA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: e8VxSGgmNxCIy8vi214RbA-1 From: Boris Fiuczynski To: libvir-list@redhat.com Subject: [PATCH 5/5] conf: Ensure migratability if enabled is 'optional' Date: Wed, 9 Aug 2023 10:49:47 +0200 Message-ID: <20230809084947.13584-6-fiuczy@linux.ibm.com> In-Reply-To: <20230809084947.13584-1-fiuczy@linux.ibm.com> References: <20230809084947.13584-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: neQsYA24O0ouMHW6rHES3lOL6Soy0kMq X-Proofpoint-GUID: neQsYA24O0ouMHW6rHES3lOL6Soy0kMq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-09_06,2023-08-08_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=919 lowpriorityscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 adultscore=0 bulkscore=0 spamscore=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2308090075 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: , Cc: mihajlov@linux.ibm.com, mhartmay@linux.ibm.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: linux.ibm.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1691571068348100001 Content-Type: text/plain; charset="utf-8"; x-default="true" If 'optional' is set on enabled and a migratable domain XML is requested the 'optional' value is removed. Signed-off-by: Boris Fiuczynski --- src/conf/domain_conf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7191e37a6c..6f451a9bfe 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -27019,7 +27019,8 @@ virDomainFeatureTCGFormat(virBuffer *buf, =20 static int virDomainDefFormatFeatures(virBuffer *buf, - virDomainDef *def) + virDomainDef *def, + bool migratable) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); size_t i; @@ -27357,6 +27358,9 @@ virDomainDefFormatFeatures(virBuffer *buf, break; =20 case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN: + if (migratable && def->features[i] =3D=3D VIR_QUADSTATE_OPTION= _OPTIONAL) + break; + if (def->features[i] !=3D VIR_QUADSTATE_OPTION_ABSENT) virBufferAsprintf(&childBuf, "\n", virQuadstateOptionTypeToString(def->feat= ures[i])); @@ -27649,7 +27653,7 @@ virDomainDefFormatInternalSetRootName(virDomainDef = *def, virBufferAddLit(buf, "\n"); } =20 - if (virDomainDefFormatFeatures(buf, def) < 0) + if (virDomainDefFormatFeatures(buf, def, migratable) < 0) return -1; =20 if (virCPUDefFormatBufFull(buf, def->cpu, def->numa) < 0) --=20 2.41.0