From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1598559618; cv=none; d=zohomail.com; s=zohoarc; b=Q/x+dcBUsMMKvMJj2a35UrU4fAVD9eGYWr+pQNAcrACQd+3MKwmpITgENEKNhoWh5FG1Rk/qPLQvbBKl7FE+uneJBbDwIUc3wtqaPHay8AhKwQvD3fPvNH0CNdzvwHz2b+0reEEtvqGtj4tFkftlRvgs9jOwwZ0PrSKlrx+tgRk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559618; 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=+AHVwcVVQcunVOW3td7la1/ljQ8BsT8/lZsfikV0iw0=; b=FJuIKSN+GHV4lbrd8bNSAj3rPhfwXTDLjufIaBHbe53yfcat1pxxL5yHv2ivZdieP0p0WIzpyLoIPZ7IWRVT7g72pTl3y61C7NJHKYKns7ltLNxt0ts7Dc5FD33MMzBDy2ifmb+IqVPF0coofjqWZCjHI4LMpLH/AVEkGSwYz4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1598559618123883.343135140863; Thu, 27 Aug 2020 13:20:18 -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-277-Eu_gMNTgMQO-AElMcosd9g-1; Thu, 27 Aug 2020 16:20:14 -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 E5E9910ABDCD; Thu, 27 Aug 2020 20:20:08 +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 746AC5C1D0; Thu, 27 Aug 2020 20:20:08 +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 8E3AE18408A1; Thu, 27 Aug 2020 20:20:05 +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 07RKK089029043 for ; Thu, 27 Aug 2020 16:20:00 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F09619D61; Thu, 27 Aug 2020 20:20:00 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id B275619C71 for ; Thu, 27 Aug 2020 20:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559616; 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=+AHVwcVVQcunVOW3td7la1/ljQ8BsT8/lZsfikV0iw0=; b=KVAzvZPRpQXVm8WRJyxLQ0CbswkdkyszpQuf0jpbuN3TSuDT+b1Mlg/ASkTz8vz/kYB+iE dm2m+EpFnc3ZaUThr1IZRejvimKnweFnK18HbsyKAqXXoP/kq8vdeiKSpG2lyhHQtGAtK/ oT67QOk3K52muK7mWVa2XEinNdS23uc= X-MC-Unique: Eu_gMNTgMQO-AElMcosd9g-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/11] conf: split out virDomainDefParseIDs Date: Thu, 27 Aug 2020 22:19:43 +0200 Message-Id: <84f1bf19b69395755e39c2c4d2728c9e72f0dd19.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 | 139 +++++++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 60 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5d3ae8bb28..189f0ac71f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20952,6 +20952,83 @@ virDomainCachetuneDefParse(virDomainDefPtr def, } =20 =20 +static int +virDomainDefParseIDs(virDomainDefPtr def, + xmlXPathContextPtr ctxt, + unsigned int flags, + bool *uuid_generated) +{ + g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree char *tmp =3D NULL; + long id =3D -1; + int n; + + if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) + if (virXPathLong("string(./@id)", ctxt, &id) < 0) + id =3D -1; + def->id =3D (int)id; + + /* Extract domain name */ + if (!(def->name =3D virXPathString("string(./name[1])", ctxt))) { + virReportError(VIR_ERR_NO_NAME, NULL); + goto error; + } + + /* Extract domain uuid. If both uuid and sysinfo/system/entry/uuid + * exist, they must match; and if only the latter exists, it can + * also serve as the uuid. */ + tmp =3D virXPathString("string(./uuid[1])", ctxt); + if (!tmp) { + if (virUUIDGenerate(def->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate UUID")); + goto error; + } + *uuid_generated =3D true; + } else { + if (virUUIDParse(tmp, def->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); + goto error; + } + VIR_FREE(tmp); + } + + /* Extract domain genid - a genid can either be provided or generated = */ + if ((n =3D virXPathNodeSet("./genid", ctxt, &nodes)) < 0) + goto error; + + if (n > 0) { + if (n !=3D 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("element 'genid' can only appear once")); + goto error; + } + def->genidRequested =3D true; + if (!(tmp =3D virXPathString("string(./genid)", ctxt))) { + if (virUUIDGenerate(def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("Failed to generate genid")); + goto error; + } + def->genidGenerated =3D true; + } else { + if (virUUIDParse(tmp, def->genid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed genid element")); + goto error; + } + VIR_FREE(tmp); + } + } + VIR_FREE(nodes); + return 0; + + error: + return -1; +} + + static int virDomainDefParseCaps(virDomainDefPtr def, xmlXPathContextPtr ctxt, @@ -21161,7 +21238,6 @@ virDomainDefParseXML(xmlDocPtr xml, xmlNodePtr node =3D NULL; size_t i, j; int n; - long id =3D -1; virDomainDefPtr def; bool uuid_generated =3D false; bool usb_none =3D false; @@ -21185,69 +21261,12 @@ virDomainDefParseXML(xmlDocPtr xml, if (!(def =3D virDomainDefNew())) return NULL; =20 - if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)) - if (virXPathLong("string(./@id)", ctxt, &id) < 0) - id =3D -1; - def->id =3D (int)id; + if (virDomainDefParseIDs(def, ctxt, flags, &uuid_generated) < 0) + goto error; =20 if (virDomainDefParseCaps(def, ctxt, xmlopt) < 0) goto error; =20 - /* Extract domain name */ - if (!(def->name =3D virXPathString("string(./name[1])", ctxt))) { - virReportError(VIR_ERR_NO_NAME, NULL); - goto error; - } - - /* Extract domain uuid. If both uuid and sysinfo/system/entry/uuid - * exist, they must match; and if only the latter exists, it can - * also serve as the uuid. */ - tmp =3D virXPathString("string(./uuid[1])", ctxt); - if (!tmp) { - if (virUUIDGenerate(def->uuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to generate UUID")); - goto error; - } - uuid_generated =3D true; - } else { - if (virUUIDParse(tmp, def->uuid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed uuid element")); - goto error; - } - VIR_FREE(tmp); - } - - /* Extract domain genid - a genid can either be provided or generated = */ - if ((n =3D virXPathNodeSet("./genid", ctxt, &nodes)) < 0) - goto error; - - if (n > 0) { - if (n !=3D 1) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("element 'genid' can only appear once")); - goto error; - } - def->genidRequested =3D true; - if (!(tmp =3D virXPathString("string(./genid)", ctxt))) { - if (virUUIDGenerate(def->genid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Failed to generate genid")); - goto error; - } - def->genidGenerated =3D true; - } else { - if (virUUIDParse(tmp, def->genid) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("malformed genid element")); - goto error; - } - VIR_FREE(tmp); - } - } - VIR_FREE(nodes); - /* Extract short description of domain (title) */ def->title =3D virXPathString("string(./title[1])", ctxt); if (def->title && strchr(def->title, '\n')) { --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1598559618; cv=none; d=zohomail.com; s=zohoarc; b=ehPywcRI4pd+m2IvxaZxx+yaSv5XdnnZOfPIg7cwK13Ge56nzUg6YUHXB2QDHpu1GrVRmZU4dX5bSUbHV5qsUx0R1v0sKLHkEyvRpPohMcfaObH6oqESSneAdUuNwZWHDVF6GuSoy+DObxZqjS6G/DrAvEykBFY5vW+r3XKypi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559618; 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=D9226d0tXiUWZZEUNdx7iF1J7GmE0Smen5RB6xsoHh8=; b=I3ILPPPFDJQByCqaQi53mrpJ1Rglsv8UxWc3F0Nr3RR0u8WKHnL4vecW1IGyXG5oh5Hp+l0G/ZDMQVVsjcmF6Asdj5Vm5aoAfMKL6krJ8qLgIedVmTC3iMr7Qj0In7Gt8CGOeZNDApgvxr05V32CZWrh2IiKzMfORBFCnprCMPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1598559618216434.89695147247846; Thu, 27 Aug 2020 13:20:18 -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-498-RWv6OsO9OdyqQIHV0PL1Fg-1; Thu, 27 Aug 2020 16:20:14 -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 93FE356BE8; Thu, 27 Aug 2020 20:20:08 +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 67C215C1C2; Thu, 27 Aug 2020 20:20:07 +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 AD82718408AB; Thu, 27 Aug 2020 20:20:05 +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 07RKK1Gb029052 for ; Thu, 27 Aug 2020 16:20:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F62119D7C; Thu, 27 Aug 2020 20:20:01 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFA1D19C71 for ; Thu, 27 Aug 2020 20:20:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559617; 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=D9226d0tXiUWZZEUNdx7iF1J7GmE0Smen5RB6xsoHh8=; b=dDfVnNKwJgjeMopBBL8yZy6ZM4jEjFfBw41bNgMcRRtRWRrZi4oo8oSoFHpTzr67vjvym4 x6z5uObBgMOD6a3T4JySRqQHyE2uU0qwXggJU+KbbYw077G3IyK7SNFaFjPM73juA+uv/P IOukRnkD+Oy1YY39fa2jE4UHE7Ts00E= X-MC-Unique: RWv6OsO9OdyqQIHV0PL1Fg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/11] conf: split out virDomainDefParseMemory Date: Thu, 27 Aug 2020 22:19:44 +0200 Message-Id: <09d6b2350d5c9d80c21a916ed0c0e544c4a00d69.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 | 209 ++++++++++++++++++++++------------------- 1 file changed, 114 insertions(+), 95 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 189f0ac71f..94def18f8a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21101,6 +21101,119 @@ virDomainDefParseCaps(virDomainDefPtr def, } =20 =20 +static int +virDomainDefParseMemory(virDomainDefPtr def, + xmlXPathContextPtr ctxt) +{ + g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree char *tmp =3D NULL; + xmlNodePtr node =3D NULL; + size_t i; + int n; + + /* Extract domain memory */ + if (virDomainParseMemory("./memory[1]", NULL, ctxt, + &def->mem.total_memory, false, true) < 0) + goto error; + + if (virDomainParseMemory("./currentMemory[1]", NULL, ctxt, + &def->mem.cur_balloon, false, true) < 0) + goto error; + + if (virDomainParseMemory("./maxMemory[1]", NULL, ctxt, + &def->mem.max_memory, false, false) < 0) + goto error; + + if (virXPathUInt("string(./maxMemory[1]/@slots)", ctxt, &def->mem.memo= ry_slots) =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Failed to parse memory slot count")); + goto error; + } + + /* and info about it */ + if ((tmp =3D virXPathString("string(./memory[1]/@dumpCore)", ctxt)) && + (def->mem.dump_core =3D virTristateSwitchTypeFromString(tmp)) <=3D= 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid memory core dump attribute value '%s'"),= tmp); + goto error; + } + VIR_FREE(tmp); + + tmp =3D virXPathString("string(./memoryBacking/source/@type)", ctxt); + if (tmp) { + if ((def->mem.source =3D virDomainMemorySourceTypeFromString(tmp))= <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown memoryBacking/source/type '%s'"), tm= p); + goto error; + } + VIR_FREE(tmp); + } + + tmp =3D virXPathString("string(./memoryBacking/access/@mode)", ctxt); + if (tmp) { + if ((def->mem.access =3D virDomainMemoryAccessTypeFromString(tmp))= <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown memoryBacking/access/mode '%s'"), tm= p); + goto error; + } + VIR_FREE(tmp); + } + + tmp =3D virXPathString("string(./memoryBacking/allocation/@mode)", ctx= t); + if (tmp) { + if ((def->mem.allocation =3D virDomainMemoryAllocationTypeFromStri= ng(tmp)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown memoryBacking/allocation/mode '%s'")= , tmp); + goto error; + } + VIR_FREE(tmp); + } + + if (virXPathNode("./memoryBacking/hugepages", ctxt)) { + /* hugepages will be used */ + if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt,= &nodes)) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cannot extract hugepages nodes")); + goto error; + } + + if (n) { + if (VIR_ALLOC_N(def->mem.hugepages, n) < 0) + goto error; + + for (i =3D 0; i < n; i++) { + if (virDomainHugepagesParseXML(nodes[i], ctxt, + &def->mem.hugepages[i]) < 0) + goto error; + def->mem.nhugepages++; + } + + VIR_FREE(nodes); + } else { + /* no hugepage pages */ + if (VIR_ALLOC(def->mem.hugepages) < 0) + goto error; + + def->mem.nhugepages =3D 1; + } + } + + if ((node =3D virXPathNode("./memoryBacking/nosharepages", ctxt))) + def->mem.nosharepages =3D true; + + if (virXPathBoolean("boolean(./memoryBacking/locked)", ctxt)) + def->mem.locked =3D true; + + if (virXPathBoolean("boolean(./memoryBacking/discard)", ctxt)) + def->mem.discard =3D VIR_TRISTATE_BOOL_YES; + + return 0; + + error: + return -1; +} + + static int virDomainMemorytuneDefParseMemory(xmlXPathContextPtr ctxt, xmlNodePtr node, @@ -21285,102 +21398,8 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } =20 - /* Extract domain memory */ - if (virDomainParseMemory("./memory[1]", NULL, ctxt, - &def->mem.total_memory, false, true) < 0) + if (virDomainDefParseMemory(def, ctxt) < 0) goto error; - - if (virDomainParseMemory("./currentMemory[1]", NULL, ctxt, - &def->mem.cur_balloon, false, true) < 0) - goto error; - - if (virDomainParseMemory("./maxMemory[1]", NULL, ctxt, - &def->mem.max_memory, false, false) < 0) - goto error; - - if (virXPathUInt("string(./maxMemory[1]/@slots)", ctxt, &def->mem.memo= ry_slots) =3D=3D -2) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Failed to parse memory slot count")); - goto error; - } - - /* and info about it */ - if ((tmp =3D virXPathString("string(./memory[1]/@dumpCore)", ctxt)) && - (def->mem.dump_core =3D virTristateSwitchTypeFromString(tmp)) <=3D= 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Invalid memory core dump attribute value '%s'"),= tmp); - goto error; - } - VIR_FREE(tmp); - - tmp =3D virXPathString("string(./memoryBacking/source/@type)", ctxt); - if (tmp) { - if ((def->mem.source =3D virDomainMemorySourceTypeFromString(tmp))= <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown memoryBacking/source/type '%s'"), tm= p); - goto error; - } - VIR_FREE(tmp); - } - - tmp =3D virXPathString("string(./memoryBacking/access/@mode)", ctxt); - if (tmp) { - if ((def->mem.access =3D virDomainMemoryAccessTypeFromString(tmp))= <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown memoryBacking/access/mode '%s'"), tm= p); - goto error; - } - VIR_FREE(tmp); - } - - tmp =3D virXPathString("string(./memoryBacking/allocation/@mode)", ctx= t); - if (tmp) { - if ((def->mem.allocation =3D virDomainMemoryAllocationTypeFromStri= ng(tmp)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown memoryBacking/allocation/mode '%s'")= , tmp); - goto error; - } - VIR_FREE(tmp); - } - - if (virXPathNode("./memoryBacking/hugepages", ctxt)) { - /* hugepages will be used */ - if ((n =3D virXPathNodeSet("./memoryBacking/hugepages/page", ctxt,= &nodes)) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot extract hugepages nodes")); - goto error; - } - - if (n) { - if (VIR_ALLOC_N(def->mem.hugepages, n) < 0) - goto error; - - for (i =3D 0; i < n; i++) { - if (virDomainHugepagesParseXML(nodes[i], ctxt, - &def->mem.hugepages[i]) < 0) - goto error; - def->mem.nhugepages++; - } - - VIR_FREE(nodes); - } else { - /* no hugepage pages */ - if (VIR_ALLOC(def->mem.hugepages) < 0) - goto error; - - def->mem.nhugepages =3D 1; - } - } - - if ((node =3D virXPathNode("./memoryBacking/nosharepages", ctxt))) - def->mem.nosharepages =3D true; - - if (virXPathBoolean("boolean(./memoryBacking/locked)", ctxt)) - def->mem.locked =3D true; - - if (virXPathBoolean("boolean(./memoryBacking/discard)", ctxt)) - def->mem.discard =3D VIR_TRISTATE_BOOL_YES; - /* Extract blkio cgroup tunables */ if (virXPathUInt("string(./blkiotune/weight)", ctxt, &def->blkio.weight) < 0) --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=m1hLpY1uV7eZAWYtWUToxdwOncwhlZmZ8NhPppo4wjJZnaDiHpGollYyI6ZZ63habjxLiCVFBXq5iWeD9FrKJAR0kGxFRqXzg4kribEGRXend/Yl+rpP2HA3pcLw+CCDUEAsKS1K9Cy8gmPtw1SncpDrzUpP4w1uptyqwXm7/Us= 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=1cxuik7aMH2unhA3SqEhA/414H6qva+0VnH7MStyHK0=; b=HgVyQfZWfuza3gMC4Q2m0SJ6J21nt0ZfwNYktP89ou/lIOigZK8dOFwBwJT9d4nKg77j3HddHXHLaKfo+bk2m8b7cQODwCotSYNRcefZNxiMYcv320kn3EkRs/e/cur6LkVlYg3pmnRvJlAywWsgasJh0LHBRTsUwTkb3BR54d4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1598559632809643.3089070145496; 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-516-YK72XoFtPzahAfv4CGMokA-1; Thu, 27 Aug 2020 16:20:29 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DED81029D23; 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 79D54100238C; 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 456B718408AC; 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 07RKK2xb029067 for ; Thu, 27 Aug 2020 16:20:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BB3B19D61; Thu, 27 Aug 2020 20:20:02 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B19119C71 for ; Thu, 27 Aug 2020 20:20:01 +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=1cxuik7aMH2unhA3SqEhA/414H6qva+0VnH7MStyHK0=; b=AhUD2bO0TRJSLe58oLCBsUwRLOjgL+Ut363/Jqa9AOEeMrdD5BMyhlYEQAJ65td8bJRbKv h9Ms8Esw3wpFQXywB7epfTuRmEyvuIltMX9nbIidk2ffSi5KzEo1eWn9rOJg5XP/34j369 8cOyv68S9LhPeFBaqfloW4m92LiJMX4= X-MC-Unique: YK72XoFtPzahAfv4CGMokA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/11] conf: introduce virDomainDefTunablesParse Date: Thu, 27 Aug 2020 22:19:45 +0200 Message-Id: <3f140b28e22f3507cd82cf847930bd3ba8ed269d.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.84 on 10.5.11.22 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 | 129 ++++++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 54 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 94def18f8a..62f9b6316e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21342,64 +21342,16 @@ virDomainMemorytuneDefParse(virDomainDefPtr def, } =20 =20 -static virDomainDefPtr -virDomainDefParseXML(xmlDocPtr xml, - xmlXPathContextPtr ctxt, - virDomainXMLOptionPtr xmlopt, - unsigned int flags) +static int +virDomainDefTunablesParse(virDomainDefPtr def, + xmlXPathContextPtr ctxt, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) { - xmlNodePtr node =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; size_t i, j; int n; - virDomainDefPtr def; - bool uuid_generated =3D false; - bool usb_none =3D false; - bool usb_other =3D false; - bool usb_master =3D false; - g_autofree xmlNodePtr *nodes =3D NULL; - g_autofree char *tmp =3D NULL; =20 - if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) { - g_autofree char *schema =3D NULL; - - schema =3D virFileFindResource("domain.rng", - abs_top_srcdir "/docs/schemas", - PKGDATADIR "/schemas"); - if (!schema) - return NULL; - if (virXMLValidateAgainstSchema(schema, xml) < 0) - return NULL; - } - - if (!(def =3D virDomainDefNew())) - return NULL; - - if (virDomainDefParseIDs(def, ctxt, flags, &uuid_generated) < 0) - goto error; - - if (virDomainDefParseCaps(def, ctxt, xmlopt) < 0) - goto error; - - /* Extract short description of domain (title) */ - def->title =3D virXPathString("string(./title[1])", ctxt); - if (def->title && strchr(def->title, '\n')) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Domain title can't contain newlines")); - goto error; - } - - /* Extract documentation if present */ - def->description =3D virXPathString("string(./description[1])", ctxt); - - /* analysis of security label, done early even though we format it - * late, so devices can refer to this for defaults */ - if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL)) { - if (virSecurityLabelDefsParseXML(def, ctxt, xmlopt, flags) =3D=3D = -1) - goto error; - } - - if (virDomainDefParseMemory(def, ctxt) < 0) - goto error; /* Extract blkio cgroup tunables */ if (virXPathUInt("string(./blkiotune/weight)", ctxt, &def->blkio.weight) < 0) @@ -21628,6 +21580,75 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(nodes); =20 + return 0; + + error: + return -1; +} + + +static virDomainDefPtr +virDomainDefParseXML(xmlDocPtr xml, + xmlXPathContextPtr ctxt, + virDomainXMLOptionPtr xmlopt, + unsigned int flags) +{ + xmlNodePtr node =3D NULL; + size_t i, j; + int n; + virDomainDefPtr def; + bool uuid_generated =3D false; + bool usb_none =3D false; + bool usb_other =3D false; + bool usb_master =3D false; + g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree char *tmp =3D NULL; + + if (flags & VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA) { + g_autofree char *schema =3D NULL; + + schema =3D virFileFindResource("domain.rng", + abs_top_srcdir "/docs/schemas", + PKGDATADIR "/schemas"); + if (!schema) + return NULL; + if (virXMLValidateAgainstSchema(schema, xml) < 0) + return NULL; + } + + if (!(def =3D virDomainDefNew())) + return NULL; + + if (virDomainDefParseIDs(def, ctxt, flags, &uuid_generated) < 0) + goto error; + + if (virDomainDefParseCaps(def, ctxt, xmlopt) < 0) + goto error; + + /* Extract short description of domain (title) */ + def->title =3D virXPathString("string(./title[1])", ctxt); + if (def->title && strchr(def->title, '\n')) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Domain title can't contain newlines")); + goto error; + } + + /* Extract documentation if present */ + def->description =3D virXPathString("string(./description[1])", ctxt); + + /* analysis of security label, done early even though we format it + * late, so devices can refer to this for defaults */ + if (!(flags & VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL)) { + if (virSecurityLabelDefsParseXML(def, ctxt, xmlopt, flags) =3D=3D = -1) + goto error; + } + + if (virDomainDefParseMemory(def, ctxt) < 0) + goto error; + + if (virDomainDefTunablesParse(def, ctxt, xmlopt, flags) < 0) + goto error; + if (virCPUDefParseXML(ctxt, "./cpu[1]", VIR_CPU_TYPE_GUEST, &def->cpu)= < 0) goto error; =20 --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 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 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1598559634; cv=none; d=zohomail.com; s=zohoarc; b=Gdm5GKBkXhrd9uoaHflGDJF0CGImvV1ufktFXGJ3b6zi4Yn8R64n39CF4HIwVFchQQwFGCdO5KyDJHnDVKpcEUDVTkSNueDKgZ7++cIZYmAONxFPCBnN20qfAaa1QoK2iFAFe36dsLCpPQWL1KLTbnWN8ELf5KhBUkXg8Jt4Tvw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559634; 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=xLYCuz5SeToGODtT60uAQyiqVpXHaMxIHl8Y8toYp/U=; b=gATv/xUxka4mIuRuTh0C8f7cf2w8OBwVsenDGno6OhxjMnrytR8Cq93F4M0DMQAiw9xlO1z9VN9GsHoBkYelChcTBptDSzZUY5VXoV4fnxRhaEpWR/I/tDzo7f/ZrV6WekMMQ6QQC8R/Lf72BQhRBupUYbUWI1iE+UqUfPP+5zU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159855963439656.27065304978032; Thu, 27 Aug 2020 13:20:34 -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-330-DyaNjKzlNUmjwyka46wLmQ-1; Thu, 27 Aug 2020 16:20:30 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96FF456BE3; Thu, 27 Aug 2020 20:20:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 793237D656; 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 4B51E66915; 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 07RKK6Sg029101 for ; Thu, 27 Aug 2020 16:20:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC1BB19D61; Thu, 27 Aug 2020 20:20:06 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4016C19C71 for ; Thu, 27 Aug 2020 20:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559633; 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=xLYCuz5SeToGODtT60uAQyiqVpXHaMxIHl8Y8toYp/U=; b=GLDhQ5LsIlgqhb+V1Ma4xAbNaxUKeDYIgEhHH7YK4lYLVpqw/S/iZ32Sr4oABHXLo8n6O+ cnYdKNQvGQRfpTi9ge2A5hPAgp7DACfMKgV8L/jRittCry5SwE21FKIR0SFWWkBN/U0Va/ 9nDS7nMZhk9lk3GZbqG0zc2OexQyV58= X-MC-Unique: DyaNjKzlNUmjwyka46wLmQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/11] conf: introduce virDomainDefClockParse Date: Thu, 27 Aug 2020 22:19:47 +0200 Message-Id: <26c4344ff99bd334958707743d0e5360a466e20b.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.15 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 | 185 +++++++++++++++++++++++------------------ 1 file changed, 102 insertions(+), 83 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 79998635ac..656277731c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21636,6 +21636,107 @@ virDomainDefLifecycleParse(virDomainDefPtr def, } =20 =20 +static int +virDomainDefClockParse(virDomainDefPtr def, + xmlXPathContextPtr ctxt) +{ + size_t i; + int n; + g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree char *tmp =3D NULL; + + if ((tmp =3D virXPathString("string(./clock/@offset)", ctxt)) && + (def->clock.offset =3D virDomainClockOffsetTypeFromString(tmp)) < = 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown clock offset '%s'"), tmp); + goto error; + } + VIR_FREE(tmp); + + switch (def->clock.offset) { + case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: + case VIR_DOMAIN_CLOCK_OFFSET_UTC: + tmp =3D virXPathString("string(./clock/@adjustment)", ctxt); + if (tmp) { + if (STREQ(tmp, "reset")) { + def->clock.data.utc_reset =3D true; + } else { + if (virStrToLong_ll(tmp, NULL, 10, + &def->clock.data.variable.adjustment) = < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown clock adjustment '%s'"), + tmp); + goto error; + } + switch (def->clock.offset) { + case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: + def->clock.data.variable.basis =3D VIR_DOMAIN_CLOCK_BA= SIS_LOCALTIME; + break; + case VIR_DOMAIN_CLOCK_OFFSET_UTC: + def->clock.data.variable.basis =3D VIR_DOMAIN_CLOCK_BA= SIS_UTC; + break; + } + def->clock.offset =3D VIR_DOMAIN_CLOCK_OFFSET_VARIABLE; + } + VIR_FREE(tmp); + } else { + def->clock.data.utc_reset =3D false; + } + break; + + case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE: + if (virXPathLongLong("number(./clock/@adjustment)", ctxt, + &def->clock.data.variable.adjustment) < 0) + def->clock.data.variable.adjustment =3D 0; + if (virXPathLongLong("number(./clock/@adjustment0)", ctxt, + &def->clock.data.variable.adjustment0) < 0) + def->clock.data.variable.adjustment0 =3D 0; + tmp =3D virXPathString("string(./clock/@basis)", ctxt); + if (tmp) { + if ((def->clock.data.variable.basis =3D virDomainClockBasisTyp= eFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown clock basis '%s'"), tmp); + goto error; + } + VIR_FREE(tmp); + } else { + def->clock.data.variable.basis =3D VIR_DOMAIN_CLOCK_BASIS_UTC; + } + break; + + case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE: + def->clock.data.timezone =3D virXPathString("string(./clock/@timez= one)", ctxt); + if (!def->clock.data.timezone) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing 'timezone' attribute for clock with = offset=3D'timezone'")); + goto error; + } + break; + } + + if ((n =3D virXPathNodeSet("./clock/timer", ctxt, &nodes)) < 0) + goto error; + + if (n && VIR_ALLOC_N(def->clock.timers, n) < 0) + goto error; + + for (i =3D 0; i < n; i++) { + virDomainTimerDefPtr timer =3D virDomainTimerDefParseXML(nodes[i], + ctxt); + if (!timer) + goto error; + + def->clock.timers[def->clock.ntimers++] =3D timer; + } + VIR_FREE(nodes); + + return 0; + + error: + return -1; +} + + static virDomainDefPtr virDomainDefParseXML(xmlDocPtr xml, xmlXPathContextPtr ctxt, @@ -21755,90 +21856,8 @@ virDomainDefParseXML(xmlDocPtr xml, if (virDomainPerfDefParseXML(def, ctxt) < 0) goto error; =20 - if ((tmp =3D virXPathString("string(./clock/@offset)", ctxt)) && - (def->clock.offset =3D virDomainClockOffsetTypeFromString(tmp)) < = 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown clock offset '%s'"), tmp); + if (virDomainDefClockParse(def, ctxt) < 0) goto error; - } - VIR_FREE(tmp); - - switch (def->clock.offset) { - case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: - case VIR_DOMAIN_CLOCK_OFFSET_UTC: - tmp =3D virXPathString("string(./clock/@adjustment)", ctxt); - if (tmp) { - if (STREQ(tmp, "reset")) { - def->clock.data.utc_reset =3D true; - } else { - if (virStrToLong_ll(tmp, NULL, 10, - &def->clock.data.variable.adjustment) = < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("unknown clock adjustment '%s'"), - tmp); - goto error; - } - switch (def->clock.offset) { - case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME: - def->clock.data.variable.basis =3D VIR_DOMAIN_CLOCK_BA= SIS_LOCALTIME; - break; - case VIR_DOMAIN_CLOCK_OFFSET_UTC: - def->clock.data.variable.basis =3D VIR_DOMAIN_CLOCK_BA= SIS_UTC; - break; - } - def->clock.offset =3D VIR_DOMAIN_CLOCK_OFFSET_VARIABLE; - } - VIR_FREE(tmp); - } else { - def->clock.data.utc_reset =3D false; - } - break; - - case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE: - if (virXPathLongLong("number(./clock/@adjustment)", ctxt, - &def->clock.data.variable.adjustment) < 0) - def->clock.data.variable.adjustment =3D 0; - if (virXPathLongLong("number(./clock/@adjustment0)", ctxt, - &def->clock.data.variable.adjustment0) < 0) - def->clock.data.variable.adjustment0 =3D 0; - tmp =3D virXPathString("string(./clock/@basis)", ctxt); - if (tmp) { - if ((def->clock.data.variable.basis =3D virDomainClockBasisTyp= eFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown clock basis '%s'"), tmp); - goto error; - } - VIR_FREE(tmp); - } else { - def->clock.data.variable.basis =3D VIR_DOMAIN_CLOCK_BASIS_UTC; - } - break; - - case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE: - def->clock.data.timezone =3D virXPathString("string(./clock/@timez= one)", ctxt); - if (!def->clock.data.timezone) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing 'timezone' attribute for clock with = offset=3D'timezone'")); - goto error; - } - break; - } - - if ((n =3D virXPathNodeSet("./clock/timer", ctxt, &nodes)) < 0) - goto error; - - if (n && VIR_ALLOC_N(def->clock.timers, n) < 0) - goto error; - - for (i =3D 0; i < n; i++) { - virDomainTimerDefPtr timer =3D virDomainTimerDefParseXML(nodes[i], - ctxt); - if (!timer) - goto error; - - def->clock.timers[def->clock.ntimers++] =3D timer; - } - VIR_FREE(nodes); =20 if (virDomainDefParseBootOptions(def, ctxt) < 0) goto error; --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 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=1598559733; cv=none; d=zohomail.com; s=zohoarc; b=kcJe2FMx69JBpy5HJlWyUSIF3kGpR618G2ZWBq962eRwhaMhv6PCY8qP1Zc+5A9EOKDtQ4JRjJ3iBEXxHtDCjN9bnKCyQiYUhJOFuJlYw35xQju2Udrf36CionDh1u1xcpHiZSFW2Q3mx6YjaCS8I9HUKz/ZTLDTvx9yqc1uh2I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559733; 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=9qGjJ+ZDgIX7/qoCkH8L4zxfXUKqNJIqW0+N/ZpnssE=; b=EoTHoGEyQvbL11P0v7GOyZBCTQ+1+T3Ig0pASd+e4ioxFWloRICjNnjrQu6T/Lbz4uGcjQCaF+Rf/btOn0Ykxfr4vJdegH2OPpoAalH2f8jCxEOm0tAC/fVSSenQnUW+bTXpxtqI9FHyI2V7Yq9bijGT6Ttkt4mmmaPWEq6Ppf8= 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 1598559733477591.1632185794134; Thu, 27 Aug 2020 13:22:13 -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-460-7jR_lytWNMCPN_Q9vZfWuQ-1; Thu, 27 Aug 2020 16:20:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24335802B68; Thu, 27 Aug 2020 20:20:30 +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 03E4060DA7; Thu, 27 Aug 2020 20:20:30 +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 C60D918408A5; Thu, 27 Aug 2020 20:20:29 +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 07RKK7vq029111 for ; Thu, 27 Aug 2020 16:20:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id C475219D7C; Thu, 27 Aug 2020 20:20:07 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 382E719C71 for ; Thu, 27 Aug 2020 20:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559732; 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=9qGjJ+ZDgIX7/qoCkH8L4zxfXUKqNJIqW0+N/ZpnssE=; b=II/CwtuH4oOGz1aQUtEXS5/a+B+BRZLFJyx33sgSCqAOVL8PXlArP/o860gFjRxp45wLt0 JXdNTUArvQgTkwATuyVA5l6W8fEAgA0iqdgvhwgk8EQkW6V3OPDxNxWfJDSLOev6q6ILsV SUnUQfYo6EJhcBgXgYIIQN2wGEQLzsI= X-MC-Unique: 7jR_lytWNMCPN_Q9vZfWuQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/11] conf: introduce virDomainDefControllersParse Date: Thu, 27 Aug 2020 22:19:48 +0200 Message-Id: <5755de2bb5e8eba4bc5a5b6881e8a6338d6e2d26.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.13 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 | 122 +++++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 52 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 656277731c..8e2e1eadaa 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21736,6 +21736,75 @@ virDomainDefClockParse(virDomainDefPtr def, return -1; } =20 +static int +virDomainDefControllersParse(virDomainDefPtr def, + xmlXPathContextPtr ctxt, + virDomainXMLOptionPtr xmlopt, + unsigned int flags, + bool *usb_none) +{ + g_autofree xmlNodePtr *nodes =3D NULL; + bool usb_other =3D false; + bool usb_master =3D false; + size_t i; + int n; + + if ((n =3D virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) + goto error; + + if (n && VIR_ALLOC_N(def->controllers, n) < 0) + goto error; + + for (i =3D 0; i < n; i++) { + virDomainControllerDefPtr controller =3D virDomainControllerDefPar= seXML(xmlopt, + = nodes[i], + = ctxt, + = flags); + + if (!controller) + goto error; + + /* sanitize handling of "none" usb controller */ + if (controller->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB) { + if (controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_N= ONE) { + if (usb_other || *usb_none) { + virDomainControllerDefFree(controller); + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("Can't add another USB controller: " + "USB is disabled for this domain")); + goto error; + } + *usb_none =3D true; + } else { + if (*usb_none) { + virDomainControllerDefFree(controller); + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("Can't add another USB controller: " + "USB is disabled for this domain")); + goto error; + } + usb_other =3D true; + } + + if (controller->info.mastertype =3D=3D VIR_DOMAIN_CONTROLLER_M= ASTER_NONE) + usb_master =3D true; + } + + virDomainControllerInsertPreAlloced(def, controller); + } + VIR_FREE(nodes); + + if (usb_other && !usb_master) { + virReportError(VIR_ERR_XML_DETAIL, "%s", + _("No master USB controller specified")); + goto error; + } + + return 0; + + error: + return -1; +} =20 static virDomainDefPtr virDomainDefParseXML(xmlDocPtr xml, @@ -21749,8 +21818,6 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainDefPtr def; bool uuid_generated =3D false; bool usb_none =3D false; - bool usb_other =3D false; - bool usb_master =3D false; g_autofree xmlNodePtr *nodes =3D NULL; g_autofree char *tmp =3D NULL; =20 @@ -21881,58 +21948,9 @@ virDomainDefParseXML(xmlDocPtr xml, } VIR_FREE(nodes); =20 - /* analysis of the controller devices */ - if ((n =3D virXPathNodeSet("./devices/controller", ctxt, &nodes)) < 0) + if (virDomainDefControllersParse(def, ctxt, xmlopt, flags, &usb_none) = < 0) goto error; =20 - if (n && VIR_ALLOC_N(def->controllers, n) < 0) - goto error; - - for (i =3D 0; i < n; i++) { - virDomainControllerDefPtr controller =3D virDomainControllerDefPar= seXML(xmlopt, - = nodes[i], - = ctxt, - = flags); - - if (!controller) - goto error; - - /* sanitize handling of "none" usb controller */ - if (controller->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB) { - if (controller->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_N= ONE) { - if (usb_other || usb_none) { - virDomainControllerDefFree(controller); - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("Can't add another USB controller: " - "USB is disabled for this domain")); - goto error; - } - usb_none =3D true; - } else { - if (usb_none) { - virDomainControllerDefFree(controller); - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("Can't add another USB controller: " - "USB is disabled for this domain")); - goto error; - } - usb_other =3D true; - } - - if (controller->info.mastertype =3D=3D VIR_DOMAIN_CONTROLLER_M= ASTER_NONE) - usb_master =3D true; - } - - virDomainControllerInsertPreAlloced(def, controller); - } - VIR_FREE(nodes); - - if (usb_other && !usb_master) { - virReportError(VIR_ERR_XML_DETAIL, "%s", - _("No master USB controller specified")); - goto error; - } - /* analysis of the resource leases */ if ((n =3D virXPathNodeSet("./devices/lease", ctxt, &nodes)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598559638; cv=none; d=zohomail.com; s=zohoarc; b=Tp4bMycdmtCC3otEhqDxr4+xd+dp1LCviQPPLgl4CHwOfN368c9+0qg+miKtkCzKb6BQM7cvPYfM6gBa/GPwkI4jQ7AXbf1qDESgEa6L4s7Y8Xp8yipAQ4AfAWRCsU70x8+6YeiYCMDzsOOrwMV8wtkkDKkuKhhHWAbFgjHiw44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559638; 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=eXzcfFT7MbNrYFd2+F2oT/gRrCGObCMR6zrTDrR33sI=; b=F9/oP3MWuOvJ2mAd1GWVERo0NNHZtKs6/nHVVF62py9qjI857ChBViOFhO5fjiaWXuFu1Dds5vJeaUrdl5czXz5t6zWbIPPFx3lUwXg2ZuMYS7QXsaTgHI/q7gtmKrTPBxrK2o8KtiXE4b/Z5FrEl8PXGEe+aLWTOBXOXPy9ATA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1598559638124875.9864435788942; Thu, 27 Aug 2020 13:20:38 -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-306-dyyjNqdtOgm_Y6xXBvEEuQ-1; Thu, 27 Aug 2020 16:20:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 46ED856BE4; Thu, 27 Aug 2020 20:20:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 25BD360DA7; Thu, 27 Aug 2020 20:20:28 +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 EB9B09A054; Thu, 27 Aug 2020 20:20:27 +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 07RKK8GU029120 for ; Thu, 27 Aug 2020 16:20:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id B1E6419D7C; Thu, 27 Aug 2020 20:20:08 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F35219C71 for ; Thu, 27 Aug 2020 20:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559636; 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=eXzcfFT7MbNrYFd2+F2oT/gRrCGObCMR6zrTDrR33sI=; b=efD8bRSw24LeInpf1XTdap/w2T6gjuGvdVq7R+zJvikPZBf7vDxkZ7ReUJa/qRIv3DV5eR MRBloG/Qhb6JMqOTLjD1vR6SQ47zS52ztQnjEHxDQbNfwaVmAs815eqkfwfQ5QYXE1x7Bn CnhgqrTg/0nhQSDpjPHW5aDRS0/oKNM= X-MC-Unique: dyyjNqdtOgm_Y6xXBvEEuQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/11] esx: esxConnectOpen: use allocated buffer Date: Thu, 27 Aug 2020 22:19:49 +0200 Message-Id: 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.13 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/esx/esx_driver.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 3fb7a3b62c..9158a2bc89 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -813,7 +813,7 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr au= th, virDrvOpenStatus result =3D VIR_DRV_OPEN_ERROR; esxPrivate *priv =3D NULL; char *potentialVCenterIPAddress =3D NULL; - char vCenterIPAddress[NI_MAXHOST] =3D ""; + g_autofree char *vCenterIPAddress =3D g_new0(char, NI_MAXHOST); =20 virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); =20 @@ -876,8 +876,9 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr au= th, goto cleanup; } =20 - if (virStrcpyStatic(vCenterIPAddress, - potentialVCenterIPAddress) < 0) { + if (virStrcpy(vCenterIPAddress, + potentialVCenterIPAddress, + NI_MAXHOST) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("vCenter IP address %s too big for de= stination"), potentialVCenterIPAddress); --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598559645; cv=none; d=zohomail.com; s=zohoarc; b=C7A/+RT51F6kvUon9thtPGgK83K6XH8VwJv8wc/esaqkB2DihtjOH8/rTNKFqoPyCmaPirm6ds2K8vQnww6Zm5ev4b527H5xFVKcyP5EctXiR2CoLe1ZdRc4XjhyADf5ZM/l+k/crI72R1nJ1+yMo2op3cvAsa28Zz5cwAQvRlE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559645; 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=9EzZOwCAhIdyIX88zKQtky6qqBI2nu7vXkjY1H2s/7k=; b=V3uABYZjF8TqtbWG4RGHRMp3Eoi8b9Z+Hpbjtb2g87Qh2ZKKR9FEwL/1yNEsttohuGg3jvEtvzogdoqZb2T89JGoEJsi7WafVQK4cWh+PfFyH80zKIJh/Og+8F2BDyDyi4auIIMUiKn2M7V6P3dmFH0PWa+Lf/RYEEQNu9pPL6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1598559645811858.8942713433057; Thu, 27 Aug 2020 13:20:45 -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-205-kCwET4MRMJmDIkH7e68Ezw-1; Thu, 27 Aug 2020 16:20:39 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 92DAC56BE5; Thu, 27 Aug 2020 20:20:33 +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 750567D656; Thu, 27 Aug 2020 20:20:33 +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 4240018408C5; Thu, 27 Aug 2020 20:20:33 +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 07RKK9vC029127 for ; Thu, 27 Aug 2020 16:20:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA0F219D7C; Thu, 27 Aug 2020 20:20:09 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E80719C71 for ; Thu, 27 Aug 2020 20:20:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559644; 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=9EzZOwCAhIdyIX88zKQtky6qqBI2nu7vXkjY1H2s/7k=; b=SHz/Dh7K35PSc8jOBJaemdHoSkg0BKeSf9my5C8W6uymLZqOYKctmPObaYmm9WMmnzXoU5 sT4UbPo7QXaoFJv3UScx6rNFRa5AkzZnl6Odmcss8WkVV1CsVs/zbUDV0OEZ5IVGwSSA2o QUvSxTBhxToTIKCdOJMangzW5/Q7nU4= X-MC-Unique: kCwET4MRMJmDIkH7e68Ezw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/11] libxl: allocate d_config Date: Thu, 27 Aug 2020 22:19:50 +0200 Message-Id: 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) clang reports: stack frame size of 2152 bytes in function 'libxlDomainStart' This is mostly due to the d_config variable: sizeof(libxl_domain_config) =3D 1232 Use g_new0 to allocate it and bring the frame size down. Signed-off-by: J=C3=A1n Tomko --- src/libxl/libxl_domain.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index de2059fa24..ae428fc7c1 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -1267,7 +1267,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, int restore_fd, uint32_t restore_ver LIBXL_DOMSTART_RESTORE_VER_ATTR) { - libxl_domain_config d_config; + libxl_domain_config *d_config =3D NULL; virDomainDefPtr def =3D NULL; virObjectEventPtr event =3D NULL; libxlSavefileHeader hdr; @@ -1288,7 +1288,9 @@ libxlDomainStart(libxlDriverPrivatePtr driver, hostdev_flags |=3D VIR_HOSTDEV_SP_USB; #endif =20 - libxl_domain_config_init(&d_config); + d_config =3D g_new0(libxl_domain_config, 1); + + libxl_domain_config_init(d_config); =20 /* If there is a managed saved state restore it instead of starting * from scratch. The old state is removed once the restoring succeeded= . */ @@ -1364,10 +1366,10 @@ libxlDomainStart(libxlDriverPrivatePtr driver, goto cleanup_dom; =20 if (libxlBuildDomainConfig(driver->reservedGraphicsPorts, vm->def, - cfg, &d_config) < 0) + cfg, d_config) < 0) goto cleanup_dom; =20 - if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0) + if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, d_config) < 0) goto cleanup_dom; =20 if (virHostdevPrepareDomainDevices(hostdev_mgr, LIBXL_DRIVER_INTERNAL_= NAME, @@ -1407,14 +1409,14 @@ libxlDomainStart(libxlDriverPrivatePtr driver, aop_console_how.for_callback =3D vm; aop_console_how.callback =3D libxlConsoleCallback; if (restore_fd < 0) { - ret =3D libxl_domain_create_new(cfg->ctx, &d_config, + ret =3D libxl_domain_create_new(cfg->ctx, d_config, &domid, NULL, &aop_console_how); } else { libxl_domain_restore_params_init(¶ms); #ifdef LIBXL_HAVE_SRM_V2 params.stream_version =3D restore_ver; #endif - ret =3D libxl_domain_create_restore(cfg->ctx, &d_config, &domid, + ret =3D libxl_domain_create_restore(cfg->ctx, d_config, &domid, restore_fd, ¶ms, NULL, &aop_console_how); libxl_domain_restore_params_dispose(¶ms); @@ -1425,11 +1427,11 @@ libxlDomainStart(libxlDriverPrivatePtr driver, if (restore_fd < 0) virReportError(VIR_ERR_INTERNAL_ERROR, _("libxenlight failed to create new domain '%s'= "), - d_config.c_info.name); + d_config->c_info.name); else virReportError(VIR_ERR_INTERNAL_ERROR, _("libxenlight failed to restore domain '%s'"), - d_config.c_info.name); + d_config->c_info.name); goto cleanup_dom; } =20 @@ -1438,7 +1440,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, * be cleaned up if there are any subsequent failures. */ vm->def->id =3D domid; - config_json =3D libxl_domain_config_to_json(cfg->ctx, &d_config); + config_json =3D libxl_domain_config_to_json(cfg->ctx, d_config); =20 libxlLoggerOpenFile(cfg->logger, domid, vm->def->name, config_json); =20 @@ -1453,7 +1455,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, if (libxl_evenable_domain_death(cfg->ctx, vm->def->id, 0, &priv->death= W)) goto destroy_dom; =20 - libxlDomainCreateIfaceNames(vm->def, &d_config); + libxlDomainCreateIfaceNames(vm->def, d_config); libxlDomainUpdateDiskParams(vm->def, cfg->ctx); =20 #ifdef LIBXL_HAVE_DEVICE_CHANNEL @@ -1523,7 +1525,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, libxlDomainCleanup(driver, vm); =20 cleanup: - libxl_domain_config_dispose(&d_config); + libxl_domain_config_dispose(d_config); VIR_FREE(config_json); VIR_FREE(dom_xml); VIR_FREE(managed_save_path); --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1598559647; cv=none; d=zohomail.com; s=zohoarc; b=B+GGYpGVzC0d+lahSrX0i2an/looZvelSTqXqnf2qDZlxili26ClPQiTXwBpjtwNrzfm2EScNZOmXNQfyR6QdpHkx9MTarbVpup5C61HgMhJ0YTr8bLy0MNK/HYeFMZLpiur4bk4KFPkMOFLQBMUj2w8KNxNq1oI1mr/cJ+fRFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559647; 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=8JFWqIHTryHAGLjCmx+AFDTR9aolkW0812e3PDSwtJo=; b=Y0vHOkQCfXveohExix6ReV4k5c2THYTHzuV4zrW3Fl6WgH46FATujDWgBmUTXtj3j0XQ5mckZh2mNt223NNHMvmY1uZY2R6eSVFHy8JWao9upX+hq4esTwz6aUQp49n9KWFwLvUHmPkOSROAZRxGT5gNEvOA4vvqb9r4BlNezdc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1598559647694895.7004958140423; Thu, 27 Aug 2020 13:20:47 -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-364-TPnJcpqZPB6vRPfr5uSZ0Q-1; Thu, 27 Aug 2020 16:20:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0C144802B68; Thu, 27 Aug 2020 20:20:38 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD1B96842B; Thu, 27 Aug 2020 20:20:37 +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 AC587A21E5; Thu, 27 Aug 2020 20:20:37 +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 07RKKAFK029137 for ; Thu, 27 Aug 2020 16:20:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id A1CEF19D7C; Thu, 27 Aug 2020 20:20:10 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1601E19C71 for ; Thu, 27 Aug 2020 20:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559646; 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=8JFWqIHTryHAGLjCmx+AFDTR9aolkW0812e3PDSwtJo=; b=fx1QKB3XNTrhndykR3pMLpK1rbyWOEVK1vP1d9f0vt4ajnjC7c8aHqXBnJERuNuzpstzjp 2tf59wb2lc77Lg1PLynGI+eOl6PnfTzdJ5QqlevJmzgtbjrIRL/mCjDfMdfOwU5VBzRLkO q6LotU/kbEH5GOwvbDfLEeMSJfzVml8= X-MC-Unique: TPnJcpqZPB6vRPfr5uSZ0Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/11] lxc: virLXCProcessStart: use allocated buffers Date: Thu, 27 Aug 2020 22:19:51 +0200 Message-Id: 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.12 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) Lower the stack frame by using allocated buffers. Signed-off-by: J=C3=A1n Tomko --- src/lxc/lxc_process.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index fc59c2e5af..78509a718e 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1185,7 +1185,6 @@ int virLXCProcessStart(virConnectPtr conn, VIR_AUTOSTRINGLIST veths =3D NULL; int handshakefds[2] =3D { -1, -1 }; off_t pos =3D -1; - char ebuf[1024]; g_autofree char *timestamp =3D NULL; int nsInheritFDs[VIR_LXC_DOMAIN_NAMESPACE_LAST]; virCommandPtr cmd =3D NULL; @@ -1402,13 +1401,14 @@ int virLXCProcessStart(virConnectPtr conn, goto cleanup; =20 if (status !=3D 0) { + g_autofree char *ebuf =3D g_new0(char, BUFSIZ); if (virLXCProcessReadLogOutput(vm, logfile, pos, ebuf, - sizeof(ebuf)) <=3D 0) { + BUFSIZ) <=3D 0) { if (WIFEXITED(status)) - g_snprintf(ebuf, sizeof(ebuf), _("unexpected exit status %= d"), + g_snprintf(ebuf, BUFSIZ, _("unexpected exit status %d"), WEXITSTATUS(status)); else - g_snprintf(ebuf, sizeof(ebuf), "%s", _("terminated abnorma= lly")); + g_snprintf(ebuf, BUFSIZ, "%s", _("terminated abnormally")); } virReportError(VIR_ERR_INTERNAL_ERROR, _("guest failed to start: %s"), ebuf); @@ -1417,7 +1417,8 @@ int virLXCProcessStart(virConnectPtr conn, =20 /* It has started running, so get its pid */ if ((r =3D virPidFileReadPath(pidfile, &vm->pid)) < 0) { - if (virLXCProcessReadLogOutput(vm, logfile, pos, ebuf, sizeof(ebuf= )) > 0) + g_autofree char *ebuf =3D g_new0(char, BUFSIZ); + if (virLXCProcessReadLogOutput(vm, logfile, pos, ebuf, BUFSIZ) > 0) virReportError(VIR_ERR_INTERNAL_ERROR, _("guest failed to start: %s"), ebuf); else @@ -1454,9 +1455,9 @@ int virLXCProcessStart(virConnectPtr conn, driver->inhibitCallback(true, driver->inhibitOpaque); =20 if (lxcContainerWaitForContinue(handshakefds[0]) < 0) { - char out[1024]; + g_autofree char *out =3D g_new0(char, BUFSIZ); =20 - if (!(virLXCProcessReadLogOutput(vm, logfile, pos, out, 1024) < 0)= ) { + if (!(virLXCProcessReadLogOutput(vm, logfile, pos, out, BUFSIZ) < = 0)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("guest failed to start: %s"), out); } @@ -1486,10 +1487,12 @@ int virLXCProcessStart(virConnectPtr conn, =20 /* And we can get the first monitor connection now too */ if (!(priv->monitor =3D virLXCProcessConnectMonitor(driver, vm))) { + g_autofree char *ebuf =3D g_new0(char, BUFSIZ); + /* Intentionally overwrite the real monitor error message, * since a better one is almost always found in the logs */ - if (virLXCProcessReadLogOutput(vm, logfile, pos, ebuf, sizeof(ebuf= )) > 0) { + if (virLXCProcessReadLogOutput(vm, logfile, pos, ebuf, BUFSIZ) > 0= ) { virResetLastError(); virReportError(VIR_ERR_INTERNAL_ERROR, _("guest failed to start: %s"), ebuf); --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1598559653; cv=none; d=zohomail.com; s=zohoarc; b=T4mFMyO39JlDQU4zqecerCWtC7Kxqsk+3Hv4qyAehFGxABDBas7Qad1kZ4tNjNLGu0yUSHL2w8GAGwZZdpBxLZsEUY7skhF6Qe+D4MLRTjjSX7tzaOZmQQdkPzAhHiCEsDcoipVng33MiuPwJ6hd0sT6VJoCayvFKp2CGwEcYwU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559653; 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=n2UFKb5qhl6D7WqU4qVt2zqiXODwejW5BpmSWrLdOFY=; b=Z/ja641i/lELYx9aNAViF5MjD7KRpz6qqmtQ7jfPIaR3ljvi+QpMIX2km06NQL3d0SKa6lzKL/JYDBGi01VMmvceU57n3aKKMBKuFgUL2EKAbsu8uyY1c43ivTAwSUs1RQCU/j3mSFx6p6eFX/vgD7Ul08xQx6Q4Cz03w3xKzRA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1598559653618238.5213298855216; Thu, 27 Aug 2020 13:20:53 -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-187-L0gPMRmiM0qW2Ri9H108cw-1; Thu, 27 Aug 2020 16:20:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 62315801AE8; Thu, 27 Aug 2020 20:20:42 +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 3FF625DA2A; Thu, 27 Aug 2020 20:20:42 +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 0E38918408C4; Thu, 27 Aug 2020 20:20:42 +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 07RKKBpQ029149 for ; Thu, 27 Aug 2020 16:20:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8F6C619D7C; Thu, 27 Aug 2020 20:20:11 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DA9719C71 for ; Thu, 27 Aug 2020 20:20:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559652; 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=n2UFKb5qhl6D7WqU4qVt2zqiXODwejW5BpmSWrLdOFY=; b=I7Uii4uRRqZxic0pfl7Tvz7DVbiMwg5yFePQK65JwWkwiLjfWF27h7pc0PEo4PC6/Gqc16 eAyB4VsXqCU52erVEXxUA0aId6JElBO6m0WWUjVhCtsFbrE+hhgLzJPWXhlBs6Au6iPWRX R0wVokdFlXMCiU9fxf8FYeddWeB87W0= X-MC-Unique: L0gPMRmiM0qW2Ri9H108cw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/11] remote: allocate def in remoteRelayDomainEventCheckACL Date: Thu, 27 Aug 2020 22:19:52 +0200 Message-Id: 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.14 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/remote/remote_daemon_dispatch.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 53d17a8f4a..84cc45e1ac 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -159,22 +159,21 @@ static bool remoteRelayDomainEventCheckACL(virNetServerClientPtr client, virConnectPtr conn, virDomainPtr dom) { - virDomainDef def; + g_autoptr(virDomainDef) def =3D g_new0(virDomainDef, 1); g_autoptr(virIdentity) identity =3D NULL; bool ret =3D false; =20 /* For now, we just create a virDomainDef with enough contents to * satisfy what viraccessdriverpolkit.c references. This is a bit * fragile, but I don't know of anything better. */ - memset(&def, 0, sizeof(def)); - def.name =3D dom->name; - memcpy(def.uuid, dom->uuid, VIR_UUID_BUFLEN); + def->name =3D dom->name; + memcpy(def->uuid, dom->uuid, VIR_UUID_BUFLEN); =20 if (!(identity =3D virNetServerClientGetIdentity(client))) goto cleanup; if (virIdentitySetCurrent(identity) < 0) goto cleanup; - ret =3D virConnectDomainEventRegisterAnyCheckACL(conn, &def); + ret =3D virConnectDomainEventRegisterAnyCheckACL(conn, def); =20 cleanup: ignore_value(virIdentitySetCurrent(NULL)); --=20 2.26.2 From nobody Sun May 5 16:06:07 2024 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=1598559642; cv=none; d=zohomail.com; s=zohoarc; b=gjThiYiV6DYwlfLUcpC7MnXhepGGH32rNpqKe28FKGkqPC/A1HiHGZSE7NYN3JWWch5rmGhWffnzKqAaPkiRgZz6wMPVFsS+wBtPUfaXpCDq1xXR9zdP9NVrdDsHJPUCk3i3wpG5AxerHFzqsyNsua/1/TuKflPqPA9TQcgj00s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598559642; 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=NaGPQ6xT6Y0jXEP5GQWlF8uQp4Dc3BBBhcIoxXZwnFE=; b=StS6yaCBzj5GyCvH3MoxvMjXVBuGX4pWM+I9CfUhoRVnqmYtd4Kz6kk4LiqM4d+oDHZda35zs8Uj76V4xa6WGOzt1nS5pDLOgYhV+/dNUUkNoDeeDwV/t1WopojgmTTnVKTS91FgP6VMKbNyCG6wmEwy5a6TLoy3RdDTLJ+bdRQ= 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 1598559642776765.7843403036992; Thu, 27 Aug 2020 13:20:42 -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-160-t0w41WfQPBW-v97MfNh__Q-1; Thu, 27 Aug 2020 16:20:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F0FB56BE6; Thu, 27 Aug 2020 20:20:32 +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 77A3E672D0; Thu, 27 Aug 2020 20:20:32 +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 4345418408C2; Thu, 27 Aug 2020 20:20:32 +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 07RKKCwQ029161 for ; Thu, 27 Aug 2020 16:20:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id A22D619D7C; Thu, 27 Aug 2020 20:20:12 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id EE7D619C71 for ; Thu, 27 Aug 2020 20:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598559641; 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=NaGPQ6xT6Y0jXEP5GQWlF8uQp4Dc3BBBhcIoxXZwnFE=; b=D2HxzjBM6l7LOyCHDHcydM0H/8dI4y615KPbcW1oufsRl7axJnSwyhv0cbsJy+xMNXZ9Gh z0gG9FUeLrPQObcPsqon9P5Qocq4gxLxzRa3uIenHuiL2HGX7MimG5kTREVKVMxLuAAJe3 HT3zQ22PS0q5I2s1vlQDzdDKHoqQdHA= X-MC-Unique: t0w41WfQPBW-v97MfNh__Q-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 11/11] build: lower maximum frame size to 1972 Date: Thu, 27 Aug 2020 22:19:53 +0200 Message-Id: <783a01d706a6e88b8208cd18ef325a0225e55917.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.12 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) This number is the closest multiple of 100000000 above the largest frame value reported by clang in the current codebase. It is unrelated to the closure of the last trolleybus line in the UK: https://en.wikipedia.org/wiki/Trolleybuses_in_Bradford Signed-off-by: J=C3=A1n Tomko --- meson.build | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index dabd4196e6..68ae67a47c 100644 --- a/meson.build +++ b/meson.build @@ -417,10 +417,9 @@ cc_flags +=3D [ # but need to rewrite various areas of code first '-Wno-format-truncation', =20 - # This should be < 256 really. Currently we're down to 4096, - # but using 1024 bytes sized buffers (mostly for virStrerror) - # stops us from going down further - '-Wframe-larger-than=3D4096', + # This should be < 256 really. + # Using 1024 bytes sized buffers stops us from going down further + '-Wframe-larger-than=3D1972', =20 # extra special flags '-fexceptions', --=20 2.26.2