From nobody Mon Feb 9 19:07:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=huawei.com ARC-Seal: i=1; a=rsa-sha256; t=1665495937; cv=none; d=zohomail.com; s=zohoarc; b=G6Y3VuUh/B1SiAi8y9KUUbh+OmuyoG+axHevjUzuk/B81Ysil63RkOZZc+6iXc5TcohIegNsky3D/eOpwo1DFa48e717q7zZFkJowhanKaQPOLD0kHneZLM0gD+/Xl7tWJkFLT/3TGUlGq+ZNKsql1JBrM3zNx9sDnOWioH8XB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665495937; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BTwRobuyvyqjD0mc/b7lh/PwE/SedaDLnpXcnjVzu1s=; b=QVk1fbihTkfc9An7HU8TZdbVa3aBMXu8yYLMdx+p/rHwVHY8cK6VG1siTt8n/smn8uPwdFGrlOhszIw/cEEPY576dW4pb+9gqXMesAcwoPOzrjGSsO0fnyKdn4F17f/wdIOwqDDzx/RXhjAdYT0j+P2YMRQfgLwsNP/vmXOs3+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1665495937692118.96331191369211; Tue, 11 Oct 2022 06:45:37 -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-615-JK60iqutOEKinDAhk_9fLA-1; Tue, 11 Oct 2022 09:45:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 04AD01C06ECD; Tue, 11 Oct 2022 13:45:20 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1C06414A815; Tue, 11 Oct 2022 13:45:19 +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 525A71946A52; Tue, 11 Oct 2022 13:45:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BC77E19465A0 for ; Tue, 11 Oct 2022 13:45:16 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A10F04B4017; Tue, 11 Oct 2022 13:45:16 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 991514B4016 for ; Tue, 11 Oct 2022 13:45:16 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7FAAE2999B28 for ; Tue, 11 Oct 2022 13:45:16 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-14-FvmAx1tzPauaOsKRM0UVUg-1; Tue, 11 Oct 2022 09:45:14 -0400 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MmxkD44QgzlVvL for ; Tue, 11 Oct 2022 21:40:36 +0800 (CST) Received: from localhost.localdomain (10.175.124.27) by dggpeml500022.china.huawei.com (7.185.36.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 11 Oct 2022 21:45:09 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665495936; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BTwRobuyvyqjD0mc/b7lh/PwE/SedaDLnpXcnjVzu1s=; b=fMkIA9s7raJGwEBfRZu33WPtOG8NwFe8TB6eGFrZJrJhPP5h+4lqleXQz7sUre3jHqjR4O NImjZbYKGN8yMNdctSrDXo0Bq+iOrK+vf0O6oKJ3SrtQA2wIh7/eQN2QLGnR2Aawc+ojg+ dFqewgSlR5LVOOeO6mucN7vMSMwkAvY= X-MC-Unique: JK60iqutOEKinDAhk_9fLA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: FvmAx1tzPauaOsKRM0UVUg-1 From: Jiang Jiacheng To: Subject: [PATCH 7/7] qemu: Reserve bootindex = -1 in virDomainDeviceDefCopy Date: Tue, 11 Oct 2022 21:38:33 +0800 Message-ID: <20221011133834.384749-8-jiangjiacheng@huawei.com> In-Reply-To: <20221011133834.384749-1-jiangjiacheng@huawei.com> References: <20221011133834.384749-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500022.china.huawei.com (7.185.36.66) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: yubihong@huawei.com, zhengchuan@huawei.com, linyilu@huawei.com, jiangjiacheng@huawei.com, xiexiangyou@huawei.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1665495940085100004 Content-Type: text/plain; charset="utf-8" Since we don't format bootindex's xml when it is -1, we will lost bootindex if it is set to -1. So we should reserve bootindex =3D -1 in virDomainDevic= eDefCopy to save the message that we cancel a bootindex set. Signed-off-by: Jiang Jiacheng --- src/conf/domain_conf.c | 23 ++++++++++++++++++++--- src/conf/domain_conf.h | 4 ++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fe7e5f9116..d35fd995e4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28651,6 +28651,7 @@ virDomainDeviceDefCopy(virDomainDeviceDef *src, virDomainXMLOption *xmlopt, void *parseOpaque) { + virDomainDeviceDef* ret; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; int flags =3D VIR_DOMAIN_DEF_FORMAT_INACTIVE | VIR_DOMAIN_DEF_FORMAT_S= ECURE; int rc =3D -1; @@ -28746,9 +28747,13 @@ virDomainDeviceDefCopy(virDomainDeviceDef *src, return NULL; =20 xmlStr =3D virBufferContentAndReset(&buf); - return virDomainDeviceDefParse(xmlStr, def, xmlopt, parseOpaque, - VIR_DOMAIN_DEF_PARSE_INACTIVE | - VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); + ret =3D virDomainDeviceDefParse(xmlStr, def, xmlopt, parseOpaque, + VIR_DOMAIN_DEF_PARSE_INACTIVE | + VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE); + if (ret) + virDomainDeviceDefCopyBootIndex(ret, src); + =20 + return ret; } =20 =20 @@ -30669,3 +30674,15 @@ virDomainDefHasSpiceGraphics(const virDomainDef *d= ef) =20 return false; } + +void +virDomainDeviceDefCopyBootIndex(virDomainDeviceDef *dest, virDomainDeviceD= ef *src) +{ + if (src->type =3D=3D VIR_DOMAIN_DEVICE_DISK && + src->data.disk->info.bootIndex =3D=3D -1) + dest->data.disk->info.bootIndex =3D src->data.disk->info.bootIndex; + + if (src->type =3D=3D VIR_DOMAIN_DEVICE_NET && + src->data.net->info.bootIndex =3D=3D -1) + dest->data.net->info.bootIndex =3D src->data.net->info.bootIndex; +} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2b1497d78d..8a152df692 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4330,3 +4330,7 @@ virDomainObjGetMessages(virDomainObj *vm, =20 bool virDomainDefHasSpiceGraphics(const virDomainDef *def); + +void=20 +virDomainDeviceDefCopyBootIndex(virDomainDeviceDef *dest, + virDomainDeviceDef *src); --=20 2.33.0