From nobody Tue May 7 19:27:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1493994227406821.5695111509838; Fri, 5 May 2017 07:23:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D19E80F7C; Fri, 5 May 2017 14:23:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 330FC7AF6D; Fri, 5 May 2017 14:23:43 +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 A14C94ED31; Fri, 5 May 2017 14:23:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v45ENZNP018654 for ; Fri, 5 May 2017 10:23:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id C53377800B; Fri, 5 May 2017 14:23:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF7C178008 for ; Fri, 5 May 2017 14:23:34 +0000 (UTC) Received: from mail-qt0-f194.google.com (mail-qt0-f194.google.com [209.85.216.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FBDE8047D for ; Fri, 5 May 2017 14:23:32 +0000 (UTC) Received: by mail-qt0-f194.google.com with SMTP id a46so975700qte.0 for ; Fri, 05 May 2017 07:23:32 -0700 (PDT) Received: from localhost.localdomain ([187.107.181.180]) by smtp.googlemail.com with ESMTPSA id j1sm3798399qkf.57.2017.05.05.07.23.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 May 2017 07:23:30 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4D19E80F7C Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4D19E80F7C Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JuP38qDQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1FBDE8047D Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jcfaracco@gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1FBDE8047D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=qwlWjgLLLx4vVpfNEJ5CiYYLz8/SWoLwWfz4jot1EIE=; b=JuP38qDQCP1cSm0z06M0k5++5BVvg3FgEJIR0vUy+aSMlWaLjFZkt6h+vcNoCvlOiZ B6tt4KCXyYplII1KS/ejignhxNLUZmSiZoinVnBSfsAqFySOJ+yAmId2x0QaJmnIxV0o HIJB4qCgFXajcN9NjFPnSAX+QNdad947Efa56oy0rZ3Q/BQE4b0VuSAqXvwPzlpWJ1Ru g96ShaplQekg4dsReFbpLsZfuH+5C03dzoTrwXAjo1c3E8EMRjkdtSrDE7uLE4JeJQ+r Z7sZ939sC1sSXCxHSMd/drkmmLxxSGOnyh8HfHlhCl+hgk64Ab8uQWPhFl1NnwzPAJ9t FoVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=qwlWjgLLLx4vVpfNEJ5CiYYLz8/SWoLwWfz4jot1EIE=; b=pPV4us7FMq5Z2hZfGi5D03LeBDgFmWIbP8F7jGqqIn5TedZs17rvJQ4BtePivJC8iR 17IuuyozkeDG1eYYk2tAZb0uma4fapeOtmYzy2aPFiblEsrx4DTKuET28YuRK36hSBKR Y2FyzTgDlkV2Qo34iv3KAXkBJq0gzBc/th2G3zr9TXZennS3c4bYAp2sWiByPlM/wfjC NnvPAqWwgqxuCWLXY5WjhVmnTjrAI7xZT5dIlxKB/H43Ke9QvvpuJpeOO0733/93NhrE 7ZbAt2bvFuJs/CyIxdu4TvljLLI5wV0eT9sbf6AY18Ns8RTTFZt6/s+AfT7Z+WP64QuS Pn+Q== X-Gm-Message-State: AN3rC/40gCbEsnb4PK0ye+cJkKfblGkBaEczXdLWSJCKyfYgKOssGmxl NFSU7E7z+oG06Xw7 X-Received: by 10.200.41.182 with SMTP id 51mr47985523qts.127.1493994210940; Fri, 05 May 2017 07:23:30 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Fri, 5 May 2017 11:22:45 -0300 Message-Id: <1493994165-10259-1-git-send-email-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 05 May 2017 14:23:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Fri, 05 May 2017 14:23:32 +0000 (UTC) for IP:'209.85.216.194' DOMAIN:'mail-qt0-f194.google.com' HELO:'mail-qt0-f194.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.17 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.194 mail-qt0-f194.google.com 209.85.216.194 mail-qt0-f194.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] qemu: Adding 'downscript' feature for QEMU network interfaces. 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 05 May 2017 14:23:45 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit adds the support for 'downscript' feature: - For QEMU command line with the option: '-net downscript=3D/etc/qemu-ifdown,...'. - For Domains with a network interface description: ' ... ... ' The options 'script' and 'downscript' accept the argument 'no' to disable the script executions. The way that the code was implemented, the XML file accepts '<[down]script path=3D'no'>' to solve this problem. This commit updates the tests and documentation too. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D825939 Signed-off-by: Julio Faracco --- docs/formatdomain.html.in | 1 + docs/schemas/domaincommon.rng | 8 ++++++++ src/conf/domain_conf.c | 13 ++++++++++= +++ src/conf/domain_conf.h | 1 + src/qemu/qemu_parse_command.c | 4 ++++ tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.args | 2 +- tests/qemuargv2xmldata/qemuargv2xml-net-eth-ifname.xml | 1 + tests/qemuargv2xmldata/qemuargv2xml-net-eth.args | 2 +- tests/qemuargv2xmldata/qemuargv2xml-net-eth.xml | 1 + tests/qemuxml2argvdata/qemuxml2argv-net-eth-ifname.xml | 1 + tests/qemuxml2argvdata/qemuxml2argv-net-eth.xml | 1 + tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-ifname.xml | 1 + tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth.xml | 1 + 13 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 8c884f4..89fe86d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4663,6 +4663,7 @@ <interface type=3D'ethernet'> <target dev=3D'vnet7'/> <script path=3D'/etc/qemu-ifup-mynet'/> + <downscript path=3D'/etc/qemu-ifdown-mynet'/> </interface> </devices> ... diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 281309e..2f88dda 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2609,6 +2609,14 @@ + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0ff216e..32d5720 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1935,6 +1935,7 @@ virDomainNetDefClear(virDomainNetDefPtr def) VIR_FREE(def->backend.vhost); VIR_FREE(def->virtPortProfile); VIR_FREE(def->script); + VIR_FREE(def->downscript); VIR_FREE(def->domain_name); VIR_FREE(def->ifname); VIR_FREE(def->ifname_guest); @@ -9589,6 +9590,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, char *ifname_guest =3D NULL; char *ifname_guest_actual =3D NULL; char *script =3D NULL; + char *downscript =3D NULL; char *address =3D NULL; char *port =3D NULL; char *localaddr =3D NULL; @@ -9761,6 +9763,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, } else if (!script && xmlStrEqual(cur->name, BAD_CAST "script")) { script =3D virXMLPropString(cur, "path"); + } else if (!downscript && + xmlStrEqual(cur->name, BAD_CAST "downscript")) { + downscript =3D virXMLPropString(cur, "path"); } else if (!domain_name && xmlStrEqual(cur->name, BAD_CAST "backenddomain")) { domain_name =3D virXMLPropString(cur, "name"); @@ -10074,6 +10079,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, def->script =3D script; script =3D NULL; } + if (downscript !=3D NULL) { + def->downscript =3D downscript; + downscript =3D NULL; + } if (domain_name !=3D NULL) { def->domain_name =3D domain_name; domain_name =3D NULL; @@ -10356,6 +10365,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, VIR_FREE(dev); virDomainActualNetDefFree(actual); VIR_FREE(script); + VIR_FREE(downscript); VIR_FREE(bridge); VIR_FREE(model); VIR_FREE(backend); @@ -22158,6 +22168,9 @@ virDomainNetDefFormat(virBufferPtr buf, =20 virBufferEscapeString(buf, "