From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C19F6A034E; Thu, 4 Jun 2020 11:09:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A5D4A1D5E6; Thu, 4 Jun 2020 11:09:47 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 24D581D5DA for ; Thu, 4 Jun 2020 11:09:45 +0200 (CEST) IronPort-SDR: epo6P2dblfHt0vNxG9NiuKvnd8B9O1HrWY9pi84ZCTcaPhrzCUg2XtASx00FbiJ0ewsTV+9adg uuGaxu6y/sCw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2020 02:09:45 -0700 IronPort-SDR: AO+DBcbZWpcsAtNf0pavyt5ftjAN48tSDtgW2MMS+3y/5icLxLVbqikbnMHtZlaZt8UN4YDeOe yw1+gTgMR+5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,471,1583222400"; d="scan'208";a="416847635" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.118.174]) by orsmga004.jf.intel.com with ESMTP; 04 Jun 2020 02:09:44 -0700 From: lihong To: dts@dpdk.org, weix.xie@intel.com Cc: lihong Date: Thu, 4 Jun 2020 09:38:20 +0800 Message-Id: <1591234700-19815-3-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1591234700-19815-1-git-send-email-lihongx.ma@intel.com> References: <1591234700-19815-1-git-send-email-lihongx.ma@intel.com> Subject: [dts] [PATCH V1 2/2] framework/qemu_kvm: check the ssh service status before get vm ip X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" If the vm os version is relatively new, the ip allocation may be before the ssh service start. So add the action of check the ssh service status before get vm ip. Signed-off-by: lihong --- framework/qemu_kvm.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index 757737e..421ee3e 100644 --- a/framework/qemu_kvm.py +++ b/framework/qemu_kvm.py @@ -1829,6 +1829,11 @@ class QEMUKvm(VirtBase): if self.control_type == "qga": # wait few seconds for network ready time.sleep(5) + # before get the ip, check the ssh service is ok + # if the ssh service if ready, the file /run/sshd.pid will store the pid + out = self.control_session.send_expect(self.qga_cmd_head + "cat /run/sshd.pid" , "#", timeout=self.OPERATION_TIMEOUT) + if out == '': + return "Failed" out = self.control_session.send_expect(self.qga_cmd_head + "ifconfig" , "#", timeout=self.OPERATION_TIMEOUT) else: pci = "00:1f.0" @@ -1838,6 +1843,10 @@ class QEMUKvm(VirtBase): if self.nic_model == "virtio": pci += "/virtio*/" + # before get the ip, check the ssh service is ok + out = self.control_session.send_expect("ls /run/sshd.pid", "# ", timeout=self.OPERATION_TIMEOUT, verify=True) + if isinstance(out, int): + return "Failed" intf = self.control_session.send_expect("ls -1 /sys/bus/pci/devices/0000:%s/net" %pci, "#", timeout=self.OPERATION_TIMEOUT) out = self.control_session.send_expect("ifconfig %s" % intf, "#", timeout=self.OPERATION_TIMEOUT) if "10.0.2" not in out: -- 2.7.4