From patchwork Thu Sep 19 17:10:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 174083 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1324058ill; Thu, 19 Sep 2019 10:47:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqycbtQumJYajReHxr9SJXOl1suf4f6V2iBTFPNQdHwboy+bCn7pusBud14LW9qG7Z1yh1JV X-Received: by 2002:a50:95c1:: with SMTP id x1mr17068340eda.180.1568915233056; Thu, 19 Sep 2019 10:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568915233; cv=none; d=google.com; s=arc-20160816; b=dZLJ4kaxG1YseVpCmcMcNmzz5+bk2gBYUxrjqQHroHOV8uLzUra3Xtd0GLdBWrUK6l 1+dBMVDx0sq/J8Ct98YaiZ4eKEueHDfu64JnRbUBdhJGEfmT2Td3n1sYN59tGtNrvAoy czHN4Uvpsbpz7S66PvjrvX4c6wihGrJIJTK0UOqAXcWYyQKvDUnWD5lB+honNUcvNenc R/x4/vEL4tDccI8WJmOhtZKL9JbNKkFC0r2N6cILdeo/qpm9FdtQhsUZrSXV+s6z4IIt PW5V8Gtyf8cECQRbfu+uFKz+3INq9rZNNOuPxrqDiMYwWKZOljdZ0PrPd2XjOiTi1kSr s5oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CCrWZlrAxxrJZBUu+oP477w2n13YI50PJV59anpksr4=; b=n8nGW6X5ldDD6P5fRKoLyjQ0NPyg3utdxYzdyIMy3vqyvoB3YuzhMQ35jAAs2AE/uU I8IaVKYK0/XM9q282zByQ0uwdxQyjjIWjEFhJc6aaqVYyhK/1a2Xcbt768paLxHOJUTU Q79J1KatGi7Hl7PiKNKXhiQM2JKMvQRDSKm7kW958IKrtcjPpynZmn9EBj1O3gIbTu8y 5nuuv9bHOfZEvaziwP0B+atF0nrzlAZTXmBKJ1WGofUYCMIAa0HVpuDjFol+xTCOOwf5 9AxOVhQdQBr3wY2uYoV84IoOjPMAOcWc+oeRAKCQ9l9nWQxtvSsM3pV/hzW3R708a4J8 Cc+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BaG9Db08; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y19si4865113ejp.196.2019.09.19.10.47.12 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Sep 2019 10:47:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BaG9Db08; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB0WN-0000po-Qi for patch@linaro.org; Thu, 19 Sep 2019 13:47:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50363) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iB07O-0000JK-OV for qemu-devel@nongnu.org; Thu, 19 Sep 2019 13:21:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iAzwj-0004Lz-6F for qemu-devel@nongnu.org; Thu, 19 Sep 2019 13:10:22 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:34213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iAzwi-0004LT-Ve for qemu-devel@nongnu.org; Thu, 19 Sep 2019 13:10:21 -0400 Received: by mail-wm1-x344.google.com with SMTP id y135so7642637wmc.1 for ; Thu, 19 Sep 2019 10:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CCrWZlrAxxrJZBUu+oP477w2n13YI50PJV59anpksr4=; b=BaG9Db08x1Qa/PxygQOVTvtkIyBibdb4t7y+ICQkop/gZxUNWgXowJ6BPvEHIql7qW ybvH4Rh1sqDpEKWa2kl7qS1RyldNiI3d+yro9farCA2x/qGJEJ33BV/F7OqFa1ja8xFh BMKvMP7wKV0YVtTp7Tu0bwudYc2f1GoAG1M2bV0pJHYS3ZtPqNQTneLao72V2z4KyrVC VlKtmjtcxvIuFCdKw2MFLc6we8tnCuYEO9Iu2bJT0NtAEIqlbtifq0plMYB7VfroSTg7 +eKmHjDO7CnVtHp2SXAecjXr1Wk+ieJ1Rn5HPfreacQ34Xne/8XzAX8l57H8pRuDI6y0 s7mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CCrWZlrAxxrJZBUu+oP477w2n13YI50PJV59anpksr4=; b=eanuwZwasSziQvXQEJttpeIaUIytuc6Z6daGNr+MxvryOpxBNgc1Qz4hroGwZ8KhL5 LoTuwXEmbw2tn2x+uPc3eEOFQ1wl5NTI6pkn8I/pe0ExCPGEqFF5RIubZqLNbBy5xFCd dGswOmjrq9KK88tACXji4Owdc9DbfmslFfLsrBavHlVj9yCqReRrAes3CoKCJJA527Q2 NhNs1z5V2kL0cF1RDVJulf6eLAJSXoIUMy9zy93Nb3tTFcjPdH3n7yNRJU1vhNVaSrIH +gdIDzWDdFsg6BsVS3Jd15+OH2IDmk2upZe+w13j4B4hlSzIGadvJAP+A3b+1RTHtYRd +Tpw== X-Gm-Message-State: APjAAAW2wTKJNL984nsg2/o7+30Z8+UQGFbPR2dfSzEUUH+wyu3uCUVw TALXolxnHbFEjGGE3ZUXSSifTA== X-Received: by 2002:a1c:1f08:: with SMTP id f8mr3874144wmf.46.1568913019810; Thu, 19 Sep 2019 10:10:19 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id a13sm19762180wrf.73.2019.09.19.10.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 10:10:17 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 090F31FF91; Thu, 19 Sep 2019 18:10:16 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 04/16] tests/docker: reduce scary warnings from failed inspect Date: Thu, 19 Sep 2019 18:10:03 +0100 Message-Id: <20190919171015.12681-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190919171015.12681-1-alex.bennee@linaro.org> References: <20190919171015.12681-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org, qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" There is a race here in the clean-up code so lets just accept that sometimes the active task we just looked up might have finished before we got to inspect it. Signed-off-by: Alex Bennée --- tests/docker/docker.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) -- 2.20.1 diff --git a/tests/docker/docker.py b/tests/docker/docker.py index 29613afd489..4dca6006d2f 100755 --- a/tests/docker/docker.py +++ b/tests/docker/docker.py @@ -235,20 +235,24 @@ class Docker(object): if not only_active: cmd.append("-a") for i in self._output(cmd).split(): - resp = self._output(["inspect", i]) - labels = json.loads(resp)[0]["Config"]["Labels"] - active = json.loads(resp)[0]["State"]["Running"] - if not labels: - continue - instance_uuid = labels.get("com.qemu.instance.uuid", None) - if not instance_uuid: - continue - if only_known and instance_uuid not in self._instances: - continue - print("Terminating", i) - if active: - self._do(["kill", i]) - self._do(["rm", i]) + try: + resp = self._output(["inspect", i]) + labels = json.loads(resp)[0]["Config"]["Labels"] + active = json.loads(resp)[0]["State"]["Running"] + if not labels: + continue + instance_uuid = labels.get("com.qemu.instance.uuid", None) + if not instance_uuid: + continue + if only_known and instance_uuid not in self._instances: + continue + print("Terminating", i) + if active: + self._do(["kill", i]) + self._do(["rm", i]) + except subprocess.CalledProcessError: + # i likely finished running before we got here + pass def clean(self): self._do_kill_instances(False, False)