{"id":804248,"url":"http://patchwork.ozlabs.org/api/1.2/patches/804248/?format=json","web_url":"http://patchwork.ozlabs.org/project/petitboot/patch/20170822040414.11485-2-sam@mendozajonas.com/","project":{"id":53,"url":"http://patchwork.ozlabs.org/api/1.2/projects/53/?format=json","name":"Petitboot development","link_name":"petitboot","list_id":"petitboot.lists.ozlabs.org","list_email":"petitboot@lists.ozlabs.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170822040414.11485-2-sam@mendozajonas.com>","list_archive_url":null,"date":"2017-08-22T04:04:14","name":"[2/2] discover: Update env vars at init and suppress LVM warnings","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"e34b45c968c5748c30d4175e6c68c1cf00bfe8f9","submitter":{"id":68013,"url":"http://patchwork.ozlabs.org/api/1.2/people/68013/?format=json","name":"Sam Mendoza-Jonas","email":"sam@mendozajonas.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/petitboot/patch/20170822040414.11485-2-sam@mendozajonas.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/804248/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/804248/checks/","tags":{},"related":[],"headers":{"Return-Path":"<petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","petitboot@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","petitboot@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xbxld6Bdqz9sRq\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 22 Aug 2017 14:04:45 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xbxld57BvzDrJQ\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 22 Aug 2017 14:04:45 +1000 (AEST)","from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com\n\t[66.111.4.25])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xbxlN10Z1zDqY9\n\tfor <petitboot@lists.ozlabs.org>;\n\tTue, 22 Aug 2017 14:04:32 +1000 (AEST)","from compute2.internal (compute2.nyi.internal [10.202.2.42])\n\tby mailout.nyi.internal (Postfix) with ESMTP id 53D1020D5A;\n\tTue, 22 Aug 2017 00:04:29 -0400 (EDT)","from frontend2 ([10.202.2.161])\n\tby compute2.internal (MEProxy); Tue, 22 Aug 2017 00:04:29 -0400","from v4.ozlabs.ibm.com (unknown [122.99.82.10])\n\tby mail.messagingengine.com (Postfix) with ESMTPA id 172DD2418B;\n\tTue, 22 Aug 2017 00:04:27 -0400 (EDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=\"S9A/M/es\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"O02Sftmf\"; \n\tdkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=\"S9A/M/es\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com header.b=\"O02Sftmf\"; \n\tdkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=mendozajonas.com header.i=@mendozajonas.com\n\theader.b=\"S9A/M/es\"; dkim=pass (2048-bit key;\n\tunprotected) header.d=messagingengine.com\n\theader.i=@messagingengine.com\n\theader.b=\"O02Sftmf\"; dkim-atps=neutral"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmendozajonas.com; h=cc:date:from:in-reply-to:message-id\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=bodhIJFdWBUNMOuDC7lxKRdX2Hgkt21SrR9Alsh76\n\tJk=; b=S9A/M/es4AAchUnpMArKL4EILlaG413wEhMsnd9EKUJHiIRa0Qm1Lbzaf\n\tl0kQFr2dbB5fP5KJx6FOE9J9y/4yXzd1lhUGnmXB5nuYGNnj6gpgU5aTt1sJDmTj\n\tuZrTiib0BymF5+TIDFXi8DEsy0DLEdMvzYSUhterrBTsydmuU5mh4WFPJvKdyNba\n\t+IgyNTwo5wKtRA25OXJv5xkeDgZo90m0lUyhq9L6EhSLtpGgx8zHO3yC5Sb5qMRm\n\tYAye9rUkfuktOZMDn/sKXj/eTduc+KaszksZ2vfr4EWDulcENx6gANDfNWkqDrT1\n\t1kIrMVd77RWKniKs/Syg8rOy+jcHw==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n\tmessagingengine.com; h=cc:date:from:in-reply-to:message-id\n\t:references:subject:to:x-me-sender:x-me-sender:x-sasl-enc\n\t:x-sasl-enc; s=fm1; bh=bodhIJFdWBUNMOuDC7lxKRdX2Hgkt21SrR9Alsh76\n\tJk=; b=O02SftmfS130X89EcMHFxboUOPrdD1Vnlvz0dMvLm/AtZI8YQQQWwW4cg\n\tjxCHvzCiJ7wpO3qGbtRukeRyjKHw4lxIkmBCcPKhNHpc2If70cLud2If6MyTD0f4\n\tZo9x4/JHi3SpJW9C6yDEz8rLW6E3WN3gRMO9ncTfWuy5gwIDxMAkzsNXFRCIZ5g5\n\t7c/exO7bRaINncRrkDk97PimjoBImNjQSIy3n+0KncamkOCzEhCxINXp/dlTJy1F\n\tvnn9JbTVTFVJHzHsV+0D7yy6J5Si7swfSQCT1Ls37jGdrr1EFzSQ0jY1i7dXUf3A\n\txY++tG6sZYW99P1cuyB9tMj9lfthA=="],"X-ME-Sender":"<xms:Ta2bWTRX9k2YPKfMxpwaim9KfOQTPvSxkWWiWnc7WTLvde7k_tMNxQ>","X-Sasl-enc":"Jp2pnnUouTf8q3JN3ns/A4y/a0MPxTa5nYKcxluQEkDL 1503374668","From":"Samuel Mendoza-Jonas <sam@mendozajonas.com>","To":"petitboot@lists.ozlabs.org","Subject":"[PATCH 2/2] discover: Update env vars at init and suppress LVM\n\twarnings","Date":"Tue, 22 Aug 2017 14:04:14 +1000","Message-Id":"<20170822040414.11485-2-sam@mendozajonas.com>","X-Mailer":"git-send-email 2.14.0","In-Reply-To":"<20170822040414.11485-1-sam@mendozajonas.com>","References":"<20170822040414.11485-1-sam@mendozajonas.com>","X-BeenThere":"petitboot@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Petitboot bootloader development <petitboot.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/petitboot>,\n\t<mailto:petitboot-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/petitboot/>","List-Post":"<mailto:petitboot@lists.ozlabs.org>","List-Help":"<mailto:petitboot-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/petitboot>,\n\t<mailto:petitboot-request@lists.ozlabs.org?subject=subscribe>","Cc":"Samuel Mendoza-Jonas <sam@mendozajonas.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org","Sender":"\"Petitboot\"\n\t<petitboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org>"},"content":"Environment variables are not platform-specific so move\nset_proxy_variables to device-handler and call it at handler init.\n\nAt the same time set LVM_SUPPRESS_FD_WARNINGS to ignore the \"file\ndescriptor leaked\" warnings when calling LVM-utilities, since we must\nkeep some file descriptors open in lib/process.\n\nSigned-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>\n---\n discover/device-handler.c   | 20 ++++++++++++++++++++\n discover/platform-powerpc.c | 15 ---------------\n 2 files changed, 20 insertions(+), 15 deletions(-)","diff":"diff --git a/discover/device-handler.c b/discover/device-handler.c\nindex ec4a6f6..c9878cc 100644\n--- a/discover/device-handler.c\n+++ b/discover/device-handler.c\n@@ -312,6 +312,22 @@ const char *discover_device_get_param(struct discover_device *device,\n \treturn NULL;\n }\n \n+static void set_env_variables(struct config *config)\n+{\n+\tif (config->http_proxy)\n+\t\tsetenv(\"http_proxy\", config->http_proxy, 1);\n+\telse\n+\t\tunsetenv(\"http_proxy\");\n+\n+\tif (config->https_proxy)\n+\t\tsetenv(\"https_proxy\", config->https_proxy, 1);\n+\telse\n+\t\tunsetenv(\"https_proxy\");\n+\n+\t/* Reduce noise in the log from LVM listing open file descriptors */\n+\tsetenv(\"LVM_SUPPRESS_FD_WARNINGS\", \"1\", 1);\n+}\n+\n struct device_handler *device_handler_init(struct discover_server *server,\n \t\tstruct waitset *waitset, int dry_run)\n {\n@@ -336,6 +352,8 @@ struct device_handler *device_handler_init(struct discover_server *server,\n \tif (config_get()->safe_mode)\n \t\treturn handler;\n \n+\tset_env_variables(config_get());\n+\n \trc = device_handler_init_sources(handler);\n \tif (rc) {\n \t\ttalloc_free(handler);\n@@ -385,6 +403,8 @@ void device_handler_reinit(struct device_handler *handler)\n \thandler->ramdisks = NULL;\n \thandler->n_ramdisks = 0;\n \n+\tset_env_variables(config_get());\n+\n \tdevice_handler_reinit_sources(handler);\n }\n \ndiff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c\nindex a4b955e..02d9a20 100644\n--- a/discover/platform-powerpc.c\n+++ b/discover/platform-powerpc.c\n@@ -492,19 +492,6 @@ static void populate_bootdev_config(struct platform_powerpc *platform,\n \tconfig->n_autoboot_opts = n_new;\n }\n \n-static void set_proxy_variables(struct config *config)\n-{\n-\tif (config->http_proxy)\n-\t\tsetenv(\"http_proxy\", config->http_proxy, 1);\n-\telse\n-\t\tunsetenv(\"http_proxy\");\n-\n-\tif (config->https_proxy)\n-\t\tsetenv(\"https_proxy\", config->https_proxy, 1);\n-\telse\n-\t\tunsetenv(\"https_proxy\");\n-}\n-\n static void populate_config(struct platform_powerpc *platform,\n \t\tstruct config *config)\n {\n@@ -560,7 +547,6 @@ static void populate_config(struct platform_powerpc *platform,\n \tval = get_param(platform, \"petitboot,https_proxy\");\n \tif (val)\n \t\tconfig->https_proxy = talloc_strdup(config, val);\n-\tset_proxy_variables(config);\n }\n \n static char *iface_config_str(void *ctx, struct interface_config *config)\n@@ -740,7 +726,6 @@ static int update_config(struct platform_powerpc *platform,\n \tupdate_string_config(platform, \"petitboot,http_proxy\", val);\n \tval = config->https_proxy ?: \"\";\n \tupdate_string_config(platform, \"petitboot,https_proxy\", val);\n-\tset_proxy_variables(config);\n \n \tupdate_network_config(platform, config);\n \n","prefixes":["2/2"]}