test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Xie, WeiX" <weix.xie@intel.com>
To: "Ma, LihongX" <lihongx.ma@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [PATCH V1 2/2] framework/qemu_kvm: check the ssh service status before get vm ip
Date: Thu, 4 Jun 2020 09:26:48 +0000	[thread overview]
Message-ID: <6FD6A7610D20924F885A4ECF34E8AC9104619C1A@CDSMSX102.ccr.corp.intel.com> (raw)
In-Reply-To: <1591234700-19815-3-git-send-email-lihongx.ma@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]

Tested-by:  Xie,WeiX < weix.xie@intel.com>

Regards,
Xie Wei

-----Original Message-----
From: Ma, LihongX 
Sent: Thursday, June 4, 2020 9:38 AM
To: dts@dpdk.org; Xie, WeiX <weix.xie@intel.com>
Cc: Ma, LihongX <lihongx.ma@intel.com>
Subject: [dts][PATCH V1 2/2] framework/qemu_kvm: check the ssh service status before get vm ip

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 <lihongx.ma@intel.com>
---
 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


[-- Attachment #2: TestVmHotplug.log --]
[-- Type: application/octet-stream, Size: 7263124 bytes --]

  reply	other threads:[~2020-06-04  9:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04  1:38 [dts] [PATCH V1 0/2] fix issue of ssh vm lihong
2020-06-04  1:38 ` [dts] [PATCH V1 1/2] QMP: optimization file qemu-ga-client and qmp.py lihong
2020-06-05  7:48   ` Xie, WeiX
2020-06-04  1:38 ` [dts] [PATCH V1 2/2] framework/qemu_kvm: check the ssh service status before get vm ip lihong
2020-06-04  9:26   ` Xie, WeiX [this message]
2020-06-11 12:17 ` [dts] [PATCH V1 0/2] fix issue of ssh vm Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6FD6A7610D20924F885A4ECF34E8AC9104619C1A@CDSMSX102.ccr.corp.intel.com \
    --to=weix.xie@intel.com \
    --cc=dts@dpdk.org \
    --cc=lihongx.ma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).