From nobody Wed May 1 08:59:39 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 1493611450187798.0520414838305; Sun, 30 Apr 2017 21:04:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C65DF81227; Mon, 1 May 2017 04:04:06 +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 C01EC8D946; Mon, 1 May 2017 04:04:04 +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 774BD18523D1; Mon, 1 May 2017 04:03:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4143w54030489 for ; Mon, 1 May 2017 00:03:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 48DDE7FBBD; Mon, 1 May 2017 04:03:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 40DD4183C5 for ; Mon, 1 May 2017 04:03:56 +0000 (UTC) Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com [209.85.220.178]) (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 DAEE93D942 for ; Mon, 1 May 2017 04:03:54 +0000 (UTC) Received: by mail-qk0-f178.google.com with SMTP id u68so3717547qkd.0 for ; Sun, 30 Apr 2017 21:03:54 -0700 (PDT) Received: from localhost.localdomain ([186.223.99.183]) by smtp.googlemail.com with ESMTPSA id b23sm10646082qkb.31.2017.04.30.21.03.52 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 30 Apr 2017 21:03:53 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C65DF81227 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx01.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 C65DF81227 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lzVs/O/I" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DAEE93D942 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jcfaracco@gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DAEE93D942 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=8CCyGwDQsHxu2sZzK3fgCx1OCiu4ePVUcOh0iOAhGgE=; b=lzVs/O/Il/CDG4BO9JQw+Q4Un7ZalBKgmJwvCV/e9jbGjWNGpGnaP5OI2/dwzEqhhr H2YPsK0flvbE1JBHYlZ9aO4Uw8SgRrFFaSZK6P6x4DB5RS6giABVj8wJNVCldZf0XC0u Ti86xHiBMPOiF3BfvOeRSiXCcKeB4jLeArDFBEWqZ+G+VR9GuTBm/IGfBvgLecQMCflH +1LEF0DoXE/prtw9Wi+xFIYEdSE1vPjB60PlqFmUgSFU2bMceG3MI26MNKRX25meL9ea Jm7cxS8UCO0vXCFrL2eIUuHMEwqhHExAYmzmRi1MvHyeA/ROu2Ogifg5c5ufWFKvQoOv 3l8A== 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=8CCyGwDQsHxu2sZzK3fgCx1OCiu4ePVUcOh0iOAhGgE=; b=VtAXX+gwINz2jzY3fCHPKMhIaY+8LUfwo+dKSnFbHkOocSJMyPQ3/ZqDke9GmJFOoB pK5qUZ+1VQm6RUcPb4tQKnrsGq6oR5f+MnkETIdXh3Uct6En+SP6Cl9NdX8DEQOMJsI4 TzE57PC0hLAlBfJAU8N6VNKQEEQubHkbIbaLFfJkbl+nOwhCgdetkKzfu/c2iFHVxvmE 87AJI/+Jvgos3Z3o0djB7IZlD7C8eaMn0DQEmcTmvOmGbFvmVer0IlshuAAN/vwGYDJ6 qvrZy55BllQrc7XftatKQRH83w1ZiJFJ96tPjkMjfSxQPAiNqtirBmWghRU8sFfCfOzo 8wGA== X-Gm-Message-State: AN3rC/6NeycSOlxOA9Qp9Tqupe/yCEUmMmoDziGCSrbPRYn/L11e5dBT tMO0gy1s5NHbfcbj X-Received: by 10.55.68.84 with SMTP id r81mr16602872qka.250.1493611434011; Sun, 30 Apr 2017 21:03:54 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Mon, 1 May 2017 01:03:38 -0300 Message-Id: <1493611418-4798-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.30]); Mon, 01 May 2017 04:03:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 01 May 2017 04:03:55 +0000 (UTC) for IP:'209.85.220.178' DOMAIN:'mail-qk0-f178.google.com' HELO:'mail-qk0-f178.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: 0.77 (BAYES_50, DCC_REPUT_00_12, 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.220.178 mail-qk0-f178.google.com 209.85.220.178 mail-qk0-f178.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 01 May 2017 04:04:08 +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 too. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D825939 Signed-off-by: Julio Faracco --- 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 + 12 files changed, 34 insertions(+), 2 deletions(-) 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, "