From nobody Mon Feb 9 19:04:57 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=126.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1651918325456431.15827476695176; Sat, 7 May 2022 03:12:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-660-FR5qWn_-NEa8ELzz2kWk0g-1; Sat, 07 May 2022 06:12:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 723CB3804082; Sat, 7 May 2022 10:11:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E14C112C063; Sat, 7 May 2022 10:11:59 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3681F194705C; Sat, 7 May 2022 10:11:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 26B7C1947058 for ; Sat, 7 May 2022 10:11:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1997A40D2838; Sat, 7 May 2022 10:11:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15B9B40D2837 for ; Sat, 7 May 2022 10:11:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F0D27811E78 for ; Sat, 7 May 2022 10:11:57 +0000 (UTC) Received: from m15112.mail.126.com (m15112.mail.126.com [220.181.15.112]) by relay.mimecast.com with ESMTP id us-mta-663-9FZ9SvwcMam3mWFhbbWr-w-1; Sat, 07 May 2022 06:11:55 -0400 Received: from zhangjl0200.home.langchao.com (unknown [223.104.194.177]) by smtp2 (Coremail) with SMTP id DMmowAA3QwaGPnZisf0UBQ--.6647S5; Sat, 07 May 2022 17:40:28 +0800 (CST) X-MC-Unique: FR5qWn_-NEa8ELzz2kWk0g-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 9FZ9SvwcMam3mWFhbbWr-w-1 From: zhangjl02 To: libvir-list@redhat.com Subject: [PATCH 3/3] domain_conf: set default emulator into def if it fails to alloc Date: Sat, 7 May 2022 17:40:16 +0800 Message-Id: <20220507094016.1991-4-jx8zjs@126.com> In-Reply-To: <20220507094016.1991-1-jx8zjs@126.com> References: <20220507094016.1991-1-jx8zjs@126.com> MIME-Version: 1.0 X-CM-TRANSID: DMmowAA3QwaGPnZisf0UBQ--.6647S5 X-Coremail-Antispam: 1Uf129KBjvJXoW7ZF1rXFWDuFWDArW7Cw1DGFg_yoW8Jw13pF 4DC3W3Zr48XFs5uwsY9ry2g3yYg34xXr4IqF4fGw4UZFWxWw1DuwsavryfCry3KrykAFy5 ArWfZFnrWFs7ZaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jYdgAUUUUU= X-Originating-IP: [223.104.194.177] X-CM-SenderInfo: dm0y6ybv6rjloofrz/1tbi1wz5SF53YxxEjgAAs2 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shenjiatong@inspur.com, zhangjl02@inspur.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1651918327269100001 Content-Type: text/plain; charset="utf-8"; x-default="true" From: zhangjl02 When emulator is not found on host, domainPostParseDataAlloc will return 1, and the domain will fail to start. Call domainPostParseDataDefEmulator to replace emulator with the default one of guest's arch, and try to alloc aga= in after domainPostParseDataAlloc's failure. This will increase error toleranc= e, if emulator defined in xml is not found on host. Signed-off-by: zhangjl02 --- src/conf/domain_conf.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bd2884088c..485f66357c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6266,7 +6266,15 @@ virDomainDefPostParse(virDomainDef *def, ret =3D xmlopt->config.domainPostParseDataAlloc(def, parseFlags, xmlopt->config.priv, &data.parseOpaque); - + if (ret =3D=3D 1){ + int to_default =3D 0; + to_default =3D xmlopt->config.domainPostParseDataDefEmulator(d= ef); + if (to_default) { + ret =3D xmlopt->config.domainPostParseDataAlloc(def, parse= Flags, + xmlopt->conf= ig.priv, + &data.parseO= paque); + } + } if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0) goto cleanup; localParseOpaque =3D true; --=20 2.35.1.windows.2