From nobody Tue Feb 10 09:24:49 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=1665495942; cv=none; d=zohomail.com; s=zohoarc; b=NtXih471CnrKQ42IFCBkyqUj6ROkUB+SPLMJlYK2W2ie7apem2Cmanr+8lKzDqXKA1/RS87wkCR5OS3BSweOhlFNWoZmaGBg+MV1gQyGcFJxnn7VEJ7XJ4If2OaGKNyPYEJAoGG39sCgXh61LvyENVSEAyRdjhGZpD1iSyq6I2Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1665495942; 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=OgAATGHCuaYjPv3waKaEEr50Z1kB9IehcVMzZ+sRgHU=; b=jGv10ggzbOZPdYdxcR4+hwQ3rdJvMrei1KNTclavZgvb5MwizLP5V/zudl9ouoY8Yr2vVPjZyyQlZ7tJLPiKpPzSTFt5zj5BLcBWV4N1+QIGSpgRHhp+DDCcZj5TF6z+lTDZwCEZ5Yd1Ad5flUOHURgc6JUDJ4nkixI65bS6sOE= 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 166549594258913.140077990066175; Tue, 11 Oct 2022 06:45:42 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-349-3z1t7THGPrWymOxmx-tWHQ-1; Tue, 11 Oct 2022 09:45:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9211B86EB20; Tue, 11 Oct 2022 13:45:21 +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 7F90ACF635; Tue, 11 Oct 2022 13:45:21 +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 6246819465A3; Tue, 11 Oct 2022 13:45:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5F86E1946A4F for ; Tue, 11 Oct 2022 13:45:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3FC3AE2039; Tue, 11 Oct 2022 13:45:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E9F4CF637 for ; Tue, 11 Oct 2022 13:45:14 +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 6D8FF83B9F3 for ; Tue, 11 Oct 2022 13:45:14 +0000 (UTC) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-467-5e87_VAzMQqGaRfrEWdg6Q-1; Tue, 11 Oct 2022 09:45:12 -0400 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4MmxkC4SvLz1M8y6 for ; Tue, 11 Oct 2022 21:40:35 +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:08 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665495941; 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=OgAATGHCuaYjPv3waKaEEr50Z1kB9IehcVMzZ+sRgHU=; b=b8y7oSv2fIuyKD7ERrukcLUzrMrY9a1pBBXV/hQ7bnRowTwImhpUPPWapaqCs0KH2QwpSx CclBOKgPD24hxzbPdVzrnFz6iPkzFBrqOohtdHHWcZNhV7pr8QQagdI+BKdELR2S6UcWDU MrZedq0jgdrNEdlfdtMPpipZwNU8V1g= X-MC-Unique: 3z1t7THGPrWymOxmx-tWHQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 5e87_VAzMQqGaRfrEWdg6Q-1 From: Jiang Jiacheng To: Subject: [PATCH 4/7] qemu: Support update net's bootindex Date: Tue, 11 Oct 2022 21:38:30 +0800 Message-ID: <20221011133834.384749-5-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.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.5 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: 1665495944107100001 Content-Type: text/plain; charset="utf-8" Support to update the net's bootindex using 'virsh update-device'. Using flag --config or --persistent to change the boot index and the change will be affected after reboot. With --persistent, we can get the result of change immediently, but it still takes effect after reboot. Signed-off-by: Jiang Jiacheng --- src/qemu/qemu_driver.c | 4 ++++ src/qemu/qemu_hotplug.c | 17 ++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 38cc5d0229..7d32b3bc50 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7827,6 +7827,10 @@ qemuDomainUpdateDeviceConfig(virDomainDef *vmdef, false) < 0) return -1; =20 + if (qemuCheckBootIndex(net->info.bootIndex, + vmdef->nets[pos]->info.bootIndex) < 0) + return -1; + if (virDomainNetUpdate(vmdef, pos, net)) return -1; =20 diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9b508dc8f0..370a272715 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3469,6 +3469,7 @@ qemuDomainChangeNet(virQEMUDriver *driver, bool needCoalesceChange =3D false; bool needVlanUpdate =3D false; bool needIsolatedPortChange =3D false; + int needChangeIndex =3D 0; int ret =3D -1; int changeidx =3D -1; g_autoptr(virConnect) conn =3D NULL; @@ -3634,11 +3635,8 @@ qemuDomainChangeNet(virQEMUDriver *driver, goto cleanup; } =20 - if (newdev->info.bootIndex =3D=3D 0) - newdev->info.bootIndex =3D olddev->info.bootIndex; - if (olddev->info.bootIndex !=3D newdev->info.bootIndex) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("cannot modify network device boot index setting"= )); + if ((needChangeIndex =3D qemuCheckBootIndex(olddev->info.bootIndex, + newdev->info.bootIndex))= < 0) { goto cleanup; } =20 @@ -3919,6 +3917,15 @@ qemuDomainChangeNet(virQEMUDriver *driver, needReplaceDevDef =3D true; } =20 + if (needChangeIndex) { + if (qemuDomainChangeBootIndex(vm, &olddev->info, newdev->info.boot= Index) < 0) + goto cleanup; + /* we successfully switched to the new boot index, and we've + * determined that the rest of newdev is equivalent to olddev, + * so move newdev into place */ + needReplaceDevDef =3D true; + } + if (needReplaceDevDef) { /* the changes above warrant replacing olddev with newdev in * the domain's nets list. --=20 2.33.0