From nobody Sat Feb 7 04:40:19 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=1671891725; cv=none; d=zohomail.com; s=zohoarc; b=ADxN6m/imYRh4rOOF1OeIbsCjCV5p3DN3oYBC0PQ3PIVyfe8XAMUk4m5W1K3H0AOoIQxqxMxDdF9CYa03nDp0NKXc6yXEahs9TTnICHhzBufwNdv4lfsfeMizn6cRVR15eFNr96Nk6Tg6XqyKQ6OSWBRQioWmehRKh0Cq+AVhrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671891725; 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=4Y2dP2Qz0b2h5icB5JFwAONHz17A1ZKFHO9/hwujLbU=; b=eO6uOvw+rguyUCEUsIWiDmZY/qlPt7nF9KXwSW0K1oI/pCSLjVUFmEW6aR2LZf2LuqQsrCUX3wp2T0YBDQRh6hgnMc5OUv0Oyv7//P+N1OyUv3DZllWnptDQ7v30jGCv92aWDOO9ZDAHqkhyVm/2sqsjM/afNA3GFqOzor/vvBg= 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 1671891725232833.2403630650657; Sat, 24 Dec 2022 06:22:05 -0800 (PST) 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-537-qR6uGdJfPEmzaGUgeHVdyA-1; Sat, 24 Dec 2022 09:21:52 -0500 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 525973C0E214; Sat, 24 Dec 2022 14:21:49 +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 37C06111F3BB; Sat, 24 Dec 2022 14:21:49 +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 6F9441947059; Sat, 24 Dec 2022 14:21:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AC23B1946A40 for ; Sat, 24 Dec 2022 14:21:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9CF6C1400E6D; Sat, 24 Dec 2022 14:21:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95C41140E949 for ; Sat, 24 Dec 2022 14:21:45 +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 7BE7E3C02523 for ; Sat, 24 Dec 2022 14:21:45 +0000 (UTC) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-348-lcpRuhS1NmKXlVt1CTQYsw-1; Sat, 24 Dec 2022 09:21:42 -0500 Received: from dggpeml500022.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4NfR323LY6zJpGp for ; Sat, 24 Dec 2022 22:17:50 +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.34; Sat, 24 Dec 2022 22:21:38 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671891724; 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=4Y2dP2Qz0b2h5icB5JFwAONHz17A1ZKFHO9/hwujLbU=; b=NfzG39saAJarYXKU3PEGnM/F28EbdnSqaccsnlUEN/AFXmkcuEybY5CEQGpsN8U06wlBkl kI3bU/Yb0RHTo6WqKDE7oDodD51Gc/nldU51TqMHlXPfs420EVGwGukvfLqRYVGjbVStPl h89vJhdvVodKBat6huj/ZA13ix5AYxc= X-MC-Unique: qR6uGdJfPEmzaGUgeHVdyA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: lcpRuhS1NmKXlVt1CTQYsw-1 From: Jiang Jiacheng To: Subject: [PATCH V3 5/7] qemu: Support update net's bootindex Date: Sat, 24 Dec 2022 22:09:22 +0800 Message-ID: <20221224140924.581972-6-jiangjiacheng@huawei.com> In-Reply-To: <20221224140924.581972-1-jiangjiacheng@huawei.com> References: <20221224140924.581972-1-jiangjiacheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) 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.7 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.3 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: 1671891726853100005 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 d5fa9c022c..633abdcbca 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7596,6 +7596,10 @@ qemuDomainUpdateDeviceConfig(virDomainDef *vmdef, false) < 0) return -1; =20 + if (qemuCheckBootIndex(&vmdef->nets[pos]->info, + net->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 6e300f547c..af0cec3c46 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3468,6 +3468,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; @@ -3633,11 +3634,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, + newdev->info.bootIndex)) < 0= ) { goto cleanup; } =20 @@ -3918,6 +3916,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