From nobody Mon Feb 9 08:28:12 2026 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=fail(p=none dis=none) header.from=126.com ARC-Seal: i=1; a=rsa-sha256; t=1590423486; cv=none; d=zohomail.com; s=zohoarc; b=bOTEcq3FE9gL282D2+eyXMKf6e7LMFfdiG5iU6Nia2WNVxMnazHFGktTEikIr6Fs623qplj4aUWynE4ckmbkaTZu7j+cpeR7P29tij6JyZiZ2zRs/PmPEBwzaEgpoXcNBpMpbdTuFnflDu/jmUkZvdo82cpZLD7tvuASuw2V2tY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590423486; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Zuyi3rPJyq9cDX8IhD+EQRcK0vJVockt8tJaEg5/Qew=; b=du8WzDJfWux5uwwsN1nB+DO6QgMdJlhUU9aikm2Lek2UBmnNlG6Ule+mi3TziAEc49YOFaXuI3PiQerVdWe63rC80PKNPMOoqf/5FAgeD0y4hGTfilry4VKUbheL8g2khTCj9BNJCBZvaytHSnZ00j6436jRaWKB0B9x460ZCSU= 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=fail 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 1590423486439555.3281568982316; Mon, 25 May 2020 09:18:06 -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-408-cTfEChtIP2SglpAkaZGwYg-1; Mon, 25 May 2020 12:18:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 822AF107ACF6; Mon, 25 May 2020 16:17:57 +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 604B619D81; Mon, 25 May 2020 16:17:57 +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 302121809557; Mon, 25 May 2020 16:17:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04PGH9v1024070 for ; Mon, 25 May 2020 12:17:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78F9C2166BA4; Mon, 25 May 2020 16:17:09 +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 74B9F2156A2D for ; Mon, 25 May 2020 16:17:07 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2DCF4804025 for ; Mon, 25 May 2020 16:17:07 +0000 (UTC) Received: from mail-m965.mail.126.com (mail-m965.mail.126.com [123.126.96.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-w6sokwMVPKuFGz1f-n_eLw-1; Mon, 25 May 2020 12:17:04 -0400 Received: from bogon.localdomain (unknown [112.80.215.163]) by smtp10 (Coremail) with SMTP id NuRpCgBHMzxy78teBw_KPQ--.643S4; Tue, 26 May 2020 00:16:59 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590423485; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:content-type:content-type: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Zuyi3rPJyq9cDX8IhD+EQRcK0vJVockt8tJaEg5/Qew=; b=Qao7etfEco1rZjIt14zZGMh+OZb6PCfuUsmorkyUqp+3DHCybtD19GInkDezscLtr4LBDn KG1HlDiGUL+gH2nLXSu7fPyrs9Tq5+HGU9TkkjUItN2SWnUt7zBeCImwmUECQ5LmSe5o9a J0EqWhsyudwttfrU/DCQflga/mPaBwA= X-MC-Unique: cTfEChtIP2SglpAkaZGwYg-1 X-MC-Unique: w6sokwMVPKuFGz1f-n_eLw-1 From: Chen Hanxiao To: libvir-list@redhat.com Subject: [PATCH v2 2/3] downscript: add support for booting and hotplug interface Date: Mon, 25 May 2020 12:16:48 -0400 Message-Id: <1590423409-1851-3-git-send-email-chen_han_xiao@126.com> In-Reply-To: <1590423409-1851-1-git-send-email-chen_han_xiao@126.com> References: <1590423409-1851-1-git-send-email-chen_han_xiao@126.com> X-CM-TRANSID: NuRpCgBHMzxy78teBw_KPQ--.643S4 X-Coremail-Antispam: 1Uf129KBjvJXoW3XFW7Ar48Jr1rWrW3Cr18uFg_yoW3Aw1xp3 WDA3Z5KF40qr47ZanY9a1UZFyfGFWv9rnrWa1IvryYg3W7t3W8Wr13Kry5tFyUArWrA34S ya4kArWYkrnrCaUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jreOLUUUUU= X-Originating-IP: [112.80.215.163] X-CM-SenderInfo: xfkh0spkdqs5xldrqiyswou0bp/1tbikRAvrlpD+hqAHwAAsm X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.23 X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Support downscript for booting vm, and hotunplug interface device. Signed-off-by: Chen Hanxiao --- src/qemu/qemu_extdevice.c | 4 ++ src/qemu/qemu_hotplug.c | 3 ++ tests/qemuxml2argvdata/downscript.xml | 60 +++++++++++++++++++++++++ tests/qemuxml2xmloutdata/downscript.xml | 60 +++++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 5 files changed, 128 insertions(+) create mode 100644 tests/qemuxml2argvdata/downscript.xml create mode 100644 tests/qemuxml2xmloutdata/downscript.xml diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c index 2096272761..4962521de4 100644 --- a/src/qemu/qemu_extdevice.c +++ b/src/qemu/qemu_extdevice.c @@ -213,6 +213,7 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, virDomainObjPtr vm) { virDomainDefPtr def =3D vm->def; + virDomainNetType actualType; size_t i; =20 if (qemuExtDevicesInitPaths(driver, def) < 0) @@ -230,10 +231,13 @@ qemuExtDevicesStop(virQEMUDriverPtr driver, =20 for (i =3D 0; i < def->nnets; i++) { virDomainNetDefPtr net =3D def->nets[i]; + actualType =3D virDomainNetGetActualType(net); qemuSlirpPtr slirp =3D QEMU_DOMAIN_NETWORK_PRIVATE(net)->slirp; =20 if (slirp) qemuSlirpStop(slirp, vm, driver, net); + if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET && net->downscr= ipt) + virNetDevRunEthernetScript(net->ifname, net->downscript); } =20 for (i =3D 0; i < def->nfss; i++) { diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 5608566d69..f94f518f4d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4663,6 +4663,9 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver, virDomainNetReleaseActualDevice(conn, vm->def, net); else VIR_WARN("Unable to release network device '%s'", NULLSTR(net-= >ifname)); + } else if (net->type =3D=3D VIR_DOMAIN_NET_TYPE_ETHERNET) { + if (net->script) + virNetDevRunEthernetScript(net->ifname, net->downscript); } virDomainNetDefFree(net); return 0; diff --git a/tests/qemuxml2argvdata/downscript.xml b/tests/qemuxml2argvdata= /downscript.xml new file mode 100644 index 0000000000..4d0fb1beab --- /dev/null +++ b/tests/qemuxml2argvdata/downscript.xml @@ -0,0 +1,60 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + +
+ + +
+ + + +
+ + + + +
+ + + + + +
+ + + +