From patchwork Mon Jul 27 12:23:57 2020 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: 247180 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp4763152ilg; Mon, 27 Jul 2020 05:37:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJdbFc5hGOg3bW0RKy2QFIvJQNuQOn54ffzLSFGOqVye8rYPu8GvBgVeH8wc9tIWvcbci1 X-Received: by 2002:a25:7344:: with SMTP id o65mr14819052ybc.417.1595853473696; Mon, 27 Jul 2020 05:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595853473; cv=none; d=google.com; s=arc-20160816; b=i71RM4K+j/q1fE1W1Gp8jD0Egv3yZwQx9/9DhsbGNeMLmmUPM0sKjgDYnHHManacg4 iGlbf4UZi+weJCRUfktKNH54qtdBthtODF8THszbpMnhIUn7mzjYHR7EZ4U1CRuM4/ZM tzjFDcb2oWezXT7zeTMnafxdZTIwlanj4F1aZluzz6lR0tSFM8KeQrNq9/Wn87si4rwp BdFzLhnpqCYM0OcXe6T6vFTUWsTKemNnDM07k1VoR/LycRR+nzi26hIycO+IBWqiloos LkrItk1q7nVSauwSNx/jwQkqLCNV6Sa2VsN1w2Sezq6W+zgIzO3jp456uCwkvejd3cuK FKCQ== 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=tOI4eNCeOvJeLfp6drp84GLtLjEuFDD1qv2L6pFrH6Y=; b=BoEy44JnV1sRCyyBw4dxn0Qyxty+Mwst3W9YInTjujWyOAgUs+MU+PODuUPbPdPJz9 Bwdmg+xI4/RV14z8fOlW1ZtspymA52mKStQPdANZGrl4hF4Xu+H/rM8JIlS9HlHrOY8L DVXqC83wqT27btAHyp/JLtQqTt3CbeyyoVF7qFgKb7n1lD8SKEO0ntqapVBDLekqJi52 q8vaSUiBfjW4CTtTZkJqQinDoisJDUo+WNh29mUp7Jn+BICpWHnnPXBB/i3Mo6uCtSwV UwaLz24HLQzWQOI41KJ6jRzORh7SAlHcB81OZkkioDpXHFxeMsAAVrpgOzfe0J0T468o umKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=LwSJmrv6; 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 p6si9351650ybm.376.2020.07.27.05.37.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jul 2020 05:37:53 -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=LwSJmrv6; 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]:56334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k02O9-0008RD-5z for patch@linaro.org; Mon, 27 Jul 2020 08:37:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k02JC-0002o5-B4 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 08:32:46 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:50642) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k02J7-0007T4-Qt for qemu-devel@nongnu.org; Mon, 27 Jul 2020 08:32:46 -0400 Received: by mail-wm1-x344.google.com with SMTP id c80so14006873wme.0 for ; Mon, 27 Jul 2020 05:32:39 -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=tOI4eNCeOvJeLfp6drp84GLtLjEuFDD1qv2L6pFrH6Y=; b=LwSJmrv6jhy4JDNIv539CsKeG1Avbu7HIGfZ/lW15nBAg/Xn/jDeQKPyaFk4P7kbBK GGncrHjB4qRy4uilpxoYhUnXm4dyRG/xZLegHQPNxn2aPAOo5GiBymMp7/KJbsUJS9/C 3ejlbixcMX9vfP/kgtorWPkCPCLiRFVteRfTFtxY7wT/wTddHlZfJ1hUKpsBrGBIrVNU 9IZm/5yVWBU5lN8lHevGDTa3R0ySsFbrv6NRpfBFtQo7ZIfVcGErOgtdtULmeEC+jvW2 Sf9rJrDkh1HyVgmbUNrbrAyho5xugXoaEiy5N+gmSje9tSuj729oeT72gPeJsP+EgCzL ebLg== 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=tOI4eNCeOvJeLfp6drp84GLtLjEuFDD1qv2L6pFrH6Y=; b=V1aXOWqSnohobd5tUtiYCH5Azw6s64yF+3WxaSQ1LqJWG5mbR1rSCBVsmNG+LPC7wS 3NtHI9CtbIctCtbw/WV0qk009wLO2qHcFxrYP0/ux9rDNHGJHrqmi0Dri2ymPpLMOJeW ZBpm26s49YYvtwM3R6e/Z1bv532eGWyC+WoGUI0BynCF5g78+HrBoAHsKpGLE0cBiG1g rpTwRCUeiSJT844WbQi8wThGPp0Sjbai5ITebhLSg8WbzdkaPO7CbCBPIsxjGBGppXDn JDRkMyCdzonyv2VUjc03QFNfdq3fmCafeOzKVQFSV9Wv4tbigueHtd8289gpxbNCYhp6 zWbw== X-Gm-Message-State: AOAM533Mq8BJ1Kbycxbayk5zX2O5jcypXQNrUBwa8eFtPKs9TGPvE/QI bGRPZHcoSkOvmOakkD9KTKEmQQ== X-Received: by 2002:a1c:e382:: with SMTP id a124mr20435395wmh.11.1595853158389; Mon, 27 Jul 2020 05:32:38 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o126sm6776581wma.20.2020.07.27.05.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 05:32:35 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D7CC61FF9F; Mon, 27 Jul 2020 13:23:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 16/16] tests/vm: add shutdown timeout in basevm.py Date: Mon, 27 Jul 2020 13:23:57 +0100 Message-Id: <20200727122357.31263-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200727122357.31263-1-alex.bennee@linaro.org> References: <20200727122357.31263-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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 , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, Robert Foley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Robert Foley We are adding the shutdown timeout to solve an issue we now see where the aarch64 VMs timeout on shutdown under TCG. There is a new 3 second timeout in machine.py, which we override in basevm.py when shutting down. Signed-off-by: Robert Foley Signed-off-by: Alex Bennée Message-Id: <20200717203041.9867-4-robert.foley@linaro.org> Message-Id: <20200724064509.331-17-alex.bennee@linaro.org> -- 2.20.1 diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 7acb48b8761..3fac20e929a 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -80,6 +80,8 @@ class BaseVM(object): arch = "#arch" # command to halt the guest, can be overridden by subclasses poweroff = "poweroff" + # Time to wait for shutdown to finish. + shutdown_timeout_default = 30 # enable IPv6 networking ipv6 = True # This is the timeout on the wait for console bytes. @@ -87,7 +89,7 @@ class BaseVM(object): # Scale up some timeouts under TCG. # 4 is arbitrary, but greater than 2, # since we found we need to wait more than twice as long. - tcg_ssh_timeout_multiplier = 4 + tcg_timeout_multiplier = 4 def __init__(self, args, config=None): self._guest = None self._genisoimage = args.genisoimage @@ -141,9 +143,12 @@ class BaseVM(object): if args.jobs and args.jobs > 1: self._args += ["-smp", "%d" % args.jobs] if kvm_available(self.arch): + self._shutdown_timeout = self.shutdown_timeout_default self._args += ["-enable-kvm"] else: logging.info("KVM not available, not using -enable-kvm") + self._shutdown_timeout = \ + self.shutdown_timeout_default * self.tcg_timeout_multiplier self._data_args = [] if self._config['qemu_args'] != None: @@ -423,7 +428,7 @@ class BaseVM(object): def wait_ssh(self, wait_root=False, seconds=300, cmd="exit 0"): # Allow more time for VM to boot under TCG. if not kvm_available(self.arch): - seconds *= self.tcg_ssh_timeout_multiplier + seconds *= self.tcg_timeout_multiplier starttime = datetime.datetime.now() endtime = starttime + datetime.timedelta(seconds=seconds) cmd_success = False @@ -441,14 +446,14 @@ class BaseVM(object): raise Exception("Timeout while waiting for guest ssh") def shutdown(self): - self._guest.shutdown() + self._guest.shutdown(timeout=self._shutdown_timeout) def wait(self): - self._guest.wait() + self._guest.wait(timeout=self._shutdown_timeout) def graceful_shutdown(self): self.ssh_root(self.poweroff) - self._guest.wait() + self._guest.wait(timeout=self._shutdown_timeout) def qmp(self, *args, **kwargs): return self._guest.qmp(*args, **kwargs)