From nobody Wed May 15 09:51:44 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=1648058676; cv=none; d=zohomail.com; s=zohoarc; b=hYWa4qoLB7bmLKbybOeUbnwMeK38HlzFkE2npSMjkjYiuvFyQMLSQjregtrmFHsCM85IFfg+HftlXOXjZtVnRnXkkWjkpMWnkQqC/ugdPan0AB4wCsCsgBLHm6XtPRUjbXwvJGouKfLWaOeTf4CaEGDuDRFgAE/6HNZtN4uvoW4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648058676; 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=wVwJeuDV9K8d24ocllptCNYe5LmJ1064NI1VHUQY8Zw=; b=d4Clj+hgTsprDofW9DR6CY9BqB86F+pdgmnaMnZz7KQ9hBx0Fd3qfcp5nLIJcGXV/gGpYraSKdD25NfyWGAJKHWeMfSD1eR7QmxTswc+bohMee40bnHmnoPsxKTPYQoOH0+Tl0lHAWPnJnIHMtfUTukxjqFEIW3Fm4PZ0WuqTMo= 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 1648058676651948.4843974201902; Wed, 23 Mar 2022 11:04:36 -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-255-RBtQdUfUOdyDFKUDdGuOTw-1; Wed, 23 Mar 2022 14:04:33 -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 909EF299E74E; Wed, 23 Mar 2022 18:04:30 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40860401E8E; Wed, 23 Mar 2022 18:04:29 +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 D61CD194035F; Wed, 23 Mar 2022 18:04:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0114D1949761 for ; Wed, 23 Mar 2022 18:04:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D449953C6; Wed, 23 Mar 2022 18:04:26 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.40.193.232]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5EA0679A9 for ; Wed, 23 Mar 2022 18:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648058675; 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=wVwJeuDV9K8d24ocllptCNYe5LmJ1064NI1VHUQY8Zw=; b=LsGtb1jX30g1nL/BtG+Sd6N85iyvCwpS+8hAYWB+i+wSGDE1Err9zkxdQWkg+8Fc34UJ0K n08uPZOCqNPWiwP+8gTGZEDDnwkYBOFuEzW/dKFhpm2wEbKndCStgGOWe05Hr5QxK7VCGq V3USVNuf1LxQUiGXUBL3T8Dke/SDeS8= X-MC-Unique: RBtQdUfUOdyDFKUDdGuOTw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [RFC 1/1] virxml: Accept 'default' for virTristate* properties Date: Wed, 23 Mar 2022 19:04:20 +0100 Message-Id: <20220323180420.60890-2-abologna@redhat.com> In-Reply-To: <20220323180420.60890-1-abologna@redhat.com> References: <20220323180420.60890-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1648058678428100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The _ABSENT value of each enumeration has 'default' as string representation, and when that's been formatted to XML we should parse it back successfully, so we can't just treat encountering it as an error. Callers of virXMLPropTristate*() can of course still pass VIR_XML_PROP_NONZERO explicitly to the helpers if the current behavior is the one they want. After this change, libvirtd no longer logs error : virXMLPropEnumInternal:516 : XML error: Invalid value for attribute 'value' in element 'allowReboot': 'default'. when it gets restarted while there are running guests. Fixes: 8861d96c880d25c940456c5997a2ac93fc073c78 Fixes: c8726ede83ac117cb18c0b0a1fbfeeac8b80384b Signed-off-by: Andrea Bolognani --- src/util/virxml.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/util/virxml.c b/src/util/virxml.c index 8ff59e7cda..db5212de20 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -545,8 +545,6 @@ virXMLPropTristateBool(xmlNodePtr node, virXMLPropFlags flags, virTristateBool *result) { - flags |=3D VIR_XML_PROP_NONZERO; - return virXMLPropEnumInternal(node, name, virTristateBoolTypeFromStrin= g, flags, result, VIR_TRISTATE_BOOL_ABSENT); } @@ -573,8 +571,6 @@ virXMLPropTristateSwitch(xmlNodePtr node, virXMLPropFlags flags, virTristateSwitch *result) { - flags |=3D VIR_XML_PROP_NONZERO; - return virXMLPropEnumInternal(node, name, virTristateSwitchTypeFromStr= ing, flags, result, VIR_TRISTATE_SWITCH_ABSEN= T); } --=20 2.35.1