From nobody Sun Feb 8 10:43:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1598559632; cv=none; d=zohomail.com; s=zohoarc; b=IqpQRYxuSDUeaSRf3MVIcrjEEDJnCE1NLvXJ7K+WZjpKyQ2s9EsAeJ7+T7aJHdQpIFesRQJ9KLJZSqbeXPKw8Q263w/rsX7OWPd1iPY+7aPXizKkEm3l2lctQxsjo3GWcSHyzlwvIcy4AhM+O38cNMAMNCum5TsZKm5zGIIq5hg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559632; 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=kn4g1u0doPIKhOhn627av9BIXA7CVT07D6j2iLuhBWk=; b=KR//RxHKTWLbrRBVqxNcjvvkzoFSAFhpjqk2avtxR/JFtFtaHOsJnCjp/ch2/eW8NzcjFP44R2VZHqmWrOPap8RTILbjM1rEYdLLc3GQ0PhUAIKPJZ/tCBBrFR4DSVma+DP9pPyYe5H3PQKh/UoK2CKLN5S1EJ/ytPU8zkLJC6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1598559632863399.2020748446829; Thu, 27 Aug 2020 13:20:32 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-ur7cWYewP7-sj3MOcmTNHw-1; Thu, 27 Aug 2020 16:20:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DD17710ABDCD; Thu, 27 Aug 2020 20:20:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC6695C1D0; Thu, 27 Aug 2020 20:20:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 89C7718408B5; Thu, 27 Aug 2020 20:20:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07RKK5Yr029095 for ; Thu, 27 Aug 2020 16:20:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id D1CDC19C71; Thu, 27 Aug 2020 20:20:05 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4668619D61 for ; Thu, 27 Aug 2020 20:20:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559631; 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=kn4g1u0doPIKhOhn627av9BIXA7CVT07D6j2iLuhBWk=; b=IWXJUptfQOQLqHJhrH18xbCwN2mFnjuUdsJoeym1MkYFONTfz/xAZH0rPotwrv7MIzcTXQ 7BHZ2e1NlnS3TdLWLh1nA4/ZXVSeCaMmBoVofuyMlJnppKL7Q0SmWPZgZnRo1K2swyw03t WZCRVTBE9UNJorYv2cgVrsw3ekzmVt8= X-MC-Unique: ur7cWYewP7-sj3MOcmTNHw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/11] conf: introduce virDomainDefLifecycleParse Date: Thu, 27 Aug 2020 22:19:46 +0200 Message-Id: <9aae10835e5aaa4ba23192784b08d7cf406f2ece.1598559571.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 86 ++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 62f9b6316e..79998635ac 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21587,6 +21587,55 @@ virDomainDefTunablesParse(virDomainDefPtr def, } =20 =20 +static int +virDomainDefLifecycleParse(virDomainDefPtr def, + xmlXPathContextPtr ctxt) +{ + if (virDomainEventActionParseXML(ctxt, "on_reboot", + "string(./on_reboot[1])", + &def->onReboot, + VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, + virDomainLifecycleActionTypeFromStrin= g) < 0) + goto error; + + if (virDomainEventActionParseXML(ctxt, "on_poweroff", + "string(./on_poweroff[1])", + &def->onPoweroff, + VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, + virDomainLifecycleActionTypeFromStrin= g) < 0) + goto error; + + if (virDomainEventActionParseXML(ctxt, "on_crash", + "string(./on_crash[1])", + &def->onCrash, + VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, + virDomainLifecycleActionTypeFromStrin= g) < 0) + goto error; + + if (virDomainEventActionParseXML(ctxt, "on_lockfailure", + "string(./on_lockfailure[1])", + &def->onLockFailure, + VIR_DOMAIN_LOCK_FAILURE_DEFAULT, + virDomainLockFailureTypeFromString) <= 0) + goto error; + + if (virDomainPMStateParseXML(ctxt, + "string(./pm/suspend-to-mem/@enabled)", + &def->pm.s3) < 0) + goto error; + + if (virDomainPMStateParseXML(ctxt, + "string(./pm/suspend-to-disk/@enabled)", + &def->pm.s4) < 0) + goto error; + + return 0; + + error: + return -1; +} + + static virDomainDefPtr virDomainDefParseXML(xmlDocPtr xml, xmlXPathContextPtr ctxt, @@ -21700,42 +21749,7 @@ virDomainDefParseXML(xmlDocPtr xml, if (virDomainFeaturesDefParse(def, ctxt) < 0) goto error; =20 - if (virDomainEventActionParseXML(ctxt, "on_reboot", - "string(./on_reboot[1])", - &def->onReboot, - VIR_DOMAIN_LIFECYCLE_ACTION_RESTART, - virDomainLifecycleActionTypeFromStrin= g) < 0) - goto error; - - if (virDomainEventActionParseXML(ctxt, "on_poweroff", - "string(./on_poweroff[1])", - &def->onPoweroff, - VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, - virDomainLifecycleActionTypeFromStrin= g) < 0) - goto error; - - if (virDomainEventActionParseXML(ctxt, "on_crash", - "string(./on_crash[1])", - &def->onCrash, - VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY, - virDomainLifecycleActionTypeFromStrin= g) < 0) - goto error; - - if (virDomainEventActionParseXML(ctxt, "on_lockfailure", - "string(./on_lockfailure[1])", - &def->onLockFailure, - VIR_DOMAIN_LOCK_FAILURE_DEFAULT, - virDomainLockFailureTypeFromString) <= 0) - goto error; - - if (virDomainPMStateParseXML(ctxt, - "string(./pm/suspend-to-mem/@enabled)", - &def->pm.s3) < 0) - goto error; - - if (virDomainPMStateParseXML(ctxt, - "string(./pm/suspend-to-disk/@enabled)", - &def->pm.s4) < 0) + if (virDomainDefLifecycleParse(def, ctxt) < 0) goto error; =20 if (virDomainPerfDefParseXML(def, ctxt) < 0) --=20 2.26.2