test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
@ 2018-05-15 10:06 Phil Yang
  2018-05-15 10:06 ` [dts] [PATCH 2/2] framework/qemu_kvm: replace nc with socat for vm control by socket Phil Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Phil Yang @ 2018-05-15 10:06 UTC (permalink / raw)
  To: dts; +Cc: nd, phil.yang, yong.liu

For telnet vm control, it will continuously fail to login to vm when
it doesn't read login prompt during first time connection. So extend
the connection time to get more output each time.

For socket vm control, added LOGIN_PROMPT into the login status
check for other platform.
Keep the connection longer to avoid failure and reconnection.

Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 framework/qemu_kvm.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index ec33669..57d16f6 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
         Connect to serial port and return connected session for usage
         if connected failed will return None
         """
-        shell_reg = r"(\s*)\[(.*)\]# "
+        shell_reg = r"(.*)# "
         try:
             if getattr(self, 'control_session', None) is None:
                 self.control_session = self.host_session
@@ -987,7 +987,7 @@ class QEMUKvm(VirtBase):
                 self.control_session.send_command("nc -U %s" % self.serial_path)
 
             # login message not ouput if timeout too small
-            out = self.control_session.send_command("", timeout=5).replace('\r', '').replace('\n', '')
+            out = self.control_session.send_command("", timeout=15).replace('\r', '').replace('\n', '')
 
             if len(out) == 0:
                 raise StartVMFailedException("Can't get output from [%s:%s]" % (self.host_dut.crb['My IP'], self.vm_name))
@@ -1025,7 +1025,7 @@ class QEMUKvm(VirtBase):
         Connect to serial port and return connected session for usage
         if connected failed will return None
         """
-        shell_reg = r"(\s*)\[(.*)\]# "
+        shell_reg = r"(.*)# "
         scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" % self.serial_port
 
         try:
@@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
                 self.control_session = self.host_session
 
                 self.control_session.send_expect("telnet localhost %d" % self.serial_port, "Connected to localhost", timeout=self.OPERATION_TIMEOUT)
+                time.sleep(5)
 
             # output will be empty if timeout too small
-            out = self.control_session.send_command("", timeout=5).replace('\r', '').replace('\n', '')
+            out = self.control_session.send_command("", timeout=10).replace('\r', '').replace('\n', '')
 
             # if no output from serial port, either connection close or system hang
             if len(out) == 0:
@@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
                     return True
 
             # login into Redhat os, not sure can work on all distributions
-            if "x86_64 on an x86_64" not in out:
+            if ("x86_64 on an x86_64" not in out) and (self.LOGIN_PROMPT not in out):
                 print RED("[%s:%s] not ready for login" % (self.host_dut.crb['My IP'], self.vm_name))
                 return False
             else:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dts] [PATCH 2/2] framework/qemu_kvm: replace nc with socat for vm control by socket
  2018-05-15 10:06 [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Phil Yang
@ 2018-05-15 10:06 ` Phil Yang
  2018-05-25  8:37   ` [dts] [PATCH v2] " Phil Yang
  2018-05-16  1:37 ` [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Liu, Yong
  2018-05-17 10:31 ` [dts] [PATCH v2] " Phil Yang
  2 siblings, 1 reply; 12+ messages in thread
From: Phil Yang @ 2018-05-15 10:06 UTC (permalink / raw)
  To: dts; +Cc: nd, phil.yang, yong.liu

The nc process hang while connecting with unix domian socket.

The problem could be resolved by replacing it with socat tool.

Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 framework/qemu_kvm.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index 57d16f6..354cb44 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -984,7 +984,7 @@ class QEMUKvm(VirtBase):
             if getattr(self, 'control_session', None) is None:
                 self.control_session = self.host_session
 
-                self.control_session.send_command("nc -U %s" % self.serial_path)
+                self.control_session.send_command("socat %s STDIO" % self.serial_path)
 
             # login message not ouput if timeout too small
             out = self.control_session.send_command("", timeout=15).replace('\r', '').replace('\n', '')
@@ -1717,7 +1717,7 @@ class QEMUKvm(VirtBase):
         """
         # return control_session to host_session
         if self.control_type == 'socket':
-            scan_cmd = "ps -e -o pid,cmd  |grep 'nc -U %s' |grep -v grep" % self.serial_path
+            scan_cmd = "ps -e -o pid,cmd  |grep 'socat %s STDIO' |grep -v grep" % self.serial_path
             out = self.host_dut.send_expect(scan_cmd, "#")
             proc_info = out.strip().split()
             try:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
  2018-05-15 10:06 [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Phil Yang
  2018-05-15 10:06 ` [dts] [PATCH 2/2] framework/qemu_kvm: replace nc with socat for vm control by socket Phil Yang
@ 2018-05-16  1:37 ` Liu, Yong
  2018-05-16  3:55   ` Phil Yang
  2018-05-17 10:31 ` [dts] [PATCH v2] " Phil Yang
  2 siblings, 1 reply; 12+ messages in thread
From: Liu, Yong @ 2018-05-16  1:37 UTC (permalink / raw)
  To: phil.yang, dts; +Cc: nd

Thanks, Phil. I'm fine with the changes, just one question about the issue you met.
Qemu module should has taken care of the problem that VM maybe can't login for the first time. 
If login action can't be done continuously, I think there may be some kind of issue here.
Could you please check the output of serial session? It may help us to figure out the problem.

Regards,
Marvin

> -----Original Message-----
> From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> Sent: Tuesday, May 15, 2018 6:06 PM
> To: dts@dpdk.org
> Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong <yong.liu@intel.com>
> Subject: [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
> 
> For telnet vm control, it will continuously fail to login to vm when
> it doesn't read login prompt during first time connection. So extend
> the connection time to get more output each time.
> 
> For socket vm control, added LOGIN_PROMPT into the login status
> check for other platform.
> Keep the connection longer to avoid failure and reconnection.
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> ---
>  framework/qemu_kvm.py | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
> index ec33669..57d16f6 100644
> --- a/framework/qemu_kvm.py
> +++ b/framework/qemu_kvm.py
> @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
>          Connect to serial port and return connected session for usage
>          if connected failed will return None
>          """
> -        shell_reg = r"(\s*)\[(.*)\]# "
> +        shell_reg = r"(.*)# "
>          try:
>              if getattr(self, 'control_session', None) is None:
>                  self.control_session = self.host_session
> @@ -987,7 +987,7 @@ class QEMUKvm(VirtBase):
>                  self.control_session.send_command("nc -U %s" %
> self.serial_path)
> 
>              # login message not ouput if timeout too small
> -            out = self.control_session.send_command("",
> timeout=5).replace('\r', '').replace('\n', '')
> +            out = self.control_session.send_command("",
> timeout=15).replace('\r', '').replace('\n', '')
> 
>              if len(out) == 0:
>                  raise StartVMFailedException("Can't get output from
> [%s:%s]" % (self.host_dut.crb['My IP'], self.vm_name))
> @@ -1025,7 +1025,7 @@ class QEMUKvm(VirtBase):
>          Connect to serial port and return connected session for usage
>          if connected failed will return None
>          """
> -        shell_reg = r"(\s*)\[(.*)\]# "
> +        shell_reg = r"(.*)# "
>          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" %
> self.serial_port
> 
>          try:
> @@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
>                  self.control_session = self.host_session
> 
>                  self.control_session.send_expect("telnet localhost %d" %
> self.serial_port, "Connected to localhost", timeout=self.OPERATION_TIMEOUT)
> +                time.sleep(5)
> 
>              # output will be empty if timeout too small
> -            out = self.control_session.send_command("",
> timeout=5).replace('\r', '').replace('\n', '')
> +            out = self.control_session.send_command("",
> timeout=10).replace('\r', '').replace('\n', '')
> 
>              # if no output from serial port, either connection close or
> system hang
>              if len(out) == 0:
> @@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
>                      return True
> 
>              # login into Redhat os, not sure can work on all
> distributions
> -            if "x86_64 on an x86_64" not in out:
> +            if ("x86_64 on an x86_64" not in out) and (self.LOGIN_PROMPT
> not in out):
>                  print RED("[%s:%s] not ready for login" %
> (self.host_dut.crb['My IP'], self.vm_name))
>                  return False
>              else:
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
  2018-05-16  1:37 ` [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Liu, Yong
@ 2018-05-16  3:55   ` Phil Yang
  2018-05-16  5:01     ` Liu, Yong
  0 siblings, 1 reply; 12+ messages in thread
From: Phil Yang @ 2018-05-16  3:55 UTC (permalink / raw)
  To: Liu, Yong, dts; +Cc: nd

Hi Marvin,

For telnet vm control I've encountered serial connection got no repose after first time login failure. Below is the log. Please check it.
=======================================================
m] Started Load/Save Random Seed.[\x1b[0;32m  OK  \x1b[0m] Started Apply Kernel Variables.[\x1b[0;32m  OK  \x1b[0m] Mounted FUSE Control File System.[\x1b[0;32m  OK  \x1b[0m] Mounted Kernel Configuration File System.[\x1b[0;32m  OK  \x1b[0m] Started Create Static Device Nodes in /dev.         Starting udev Kernel Device Manager...[\x1b[0;32m  OK  \x1b[0m] Reached target Local File Systems (Pre).[\x1b[0;32m  OK  \x1b[0m] Started udev Kernel Device Manager.[\x1b[0;32m  OK  \x1b[0m] Started Dispatch Password Requests to Console Directory Watch.[\x1b[0;32m  OK  \x1b[0m] Reached target Local Encrypted Volumes.[\x1b[0;32m  OK  \x1b[0m] Activated swap /swapfile.[\x1b[0;32m  OK  \x1b[0m] Reached target Swap.[\x1b[0;32m  OK  \x1b[0m] Started Flush Journal to Persistent Storage."
(Pdb) c
[10.169.40.174:vm0] not ready for login
             dut.10.169.40.174: Can't login [vm0] on [10.169.40.174], retry 1 times!!!
             dut.10.169.40.174: lsof -i:7002 | grep telnet | awk '{print $2}'
Exception happened in [lsof -i:7002 | grep telnet | awk '{print $2}'] and output is [lsof -i:7002 | grep telnet | awk '{print $2}'
Command not found]
Traceback (most recent call last):
  File "/root/dpdk-dts/framework/virt_base.py", line 284, in start
    self._start_vm()
  File "/root/dpdk-dts/framework/qemu_kvm.py", line 1269, in _start_vm
    self.__wait_vm_ready()
TimeoutException: TIMEOUT on lsof -i:7002 | grep telnet | awk '{print $2}'
Unhandled expection <class 'exception.TimeoutException'>
            TestVhostPmdXstats: Failure for Set up VM ENV failed
============================================================

So I added a delay to flush the useless output. Which can resolve this issue.
BTW, only telnet connection has this defect. This fix is kind of workaround, but It works.

Thanks,
Phil Yang

> -----Original Message-----
> From: Liu, Yong <yong.liu@intel.com>
> Sent: Wednesday, May 16, 2018 9:38 AM
> To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> Cc: nd <nd@arm.com>
> Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
> 
> Thanks, Phil. I'm fine with the changes, just one question about the issue you
> met.
> Qemu module should has taken care of the problem that VM maybe can't login
> for the first time.
> If login action can't be done continuously, I think there may be some kind of
> issue here.
> Could you please check the output of serial session? It may help us to figure out
> the problem.
> 
> Regards,
> Marvin
> 
> > -----Original Message-----
> > From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> > Sent: Tuesday, May 15, 2018 6:06 PM
> > To: dts@dpdk.org
> > Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong <yong.liu@intel.com>
> > Subject: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > failure
> >
> > For telnet vm control, it will continuously fail to login to vm when
> > it doesn't read login prompt during first time connection. So extend
> > the connection time to get more output each time.
> >
> > For socket vm control, added LOGIN_PROMPT into the login status check
> > for other platform.
> > Keep the connection longer to avoid failure and reconnection.
> >
> > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > ---
> >  framework/qemu_kvm.py | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index
> > ec33669..57d16f6 100644
> > --- a/framework/qemu_kvm.py
> > +++ b/framework/qemu_kvm.py
> > @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
> >          Connect to serial port and return connected session for usage
> >          if connected failed will return None
> >          """
> > -        shell_reg = r"(\s*)\[(.*)\]# "
> > +        shell_reg = r"(.*)# "
> >          try:
> >              if getattr(self, 'control_session', None) is None:
> >                  self.control_session = self.host_session @@ -987,7
> > +987,7 @@ class QEMUKvm(VirtBase):
> >                  self.control_session.send_command("nc -U %s" %
> > self.serial_path)
> >
> >              # login message not ouput if timeout too small
> > -            out = self.control_session.send_command("",
> > timeout=5).replace('\r', '').replace('\n', '')
> > +            out = self.control_session.send_command("",
> > timeout=15).replace('\r', '').replace('\n', '')
> >
> >              if len(out) == 0:
> >                  raise StartVMFailedException("Can't get output from
> > [%s:%s]" % (self.host_dut.crb['My IP'], self.vm_name)) @@ -1025,7
> > +1025,7 @@ class QEMUKvm(VirtBase):
> >          Connect to serial port and return connected session for usage
> >          if connected failed will return None
> >          """
> > -        shell_reg = r"(\s*)\[(.*)\]# "
> > +        shell_reg = r"(.*)# "
> >          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" %
> > self.serial_port
> >
> >          try:
> > @@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
> >                  self.control_session = self.host_session
> >
> >                  self.control_session.send_expect("telnet localhost
> > %d" % self.serial_port, "Connected to localhost",
> > timeout=self.OPERATION_TIMEOUT)
> > +                time.sleep(5)
> >
> >              # output will be empty if timeout too small
> > -            out = self.control_session.send_command("",
> > timeout=5).replace('\r', '').replace('\n', '')
> > +            out = self.control_session.send_command("",
> > timeout=10).replace('\r', '').replace('\n', '')
> >
> >              # if no output from serial port, either connection close
> > or system hang
> >              if len(out) == 0:
> > @@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
> >                      return True
> >
> >              # login into Redhat os, not sure can work on all
> > distributions
> > -            if "x86_64 on an x86_64" not in out:
> > +            if ("x86_64 on an x86_64" not in out) and
> > + (self.LOGIN_PROMPT
> > not in out):
> >                  print RED("[%s:%s] not ready for login" %
> > (self.host_dut.crb['My IP'], self.vm_name))
> >                  return False
> >              else:
> > --
> > 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
  2018-05-16  3:55   ` Phil Yang
@ 2018-05-16  5:01     ` Liu, Yong
  2018-05-16  5:22       ` Phil Yang
  0 siblings, 1 reply; 12+ messages in thread
From: Liu, Yong @ 2018-05-16  5:01 UTC (permalink / raw)
  To: Phil.Yang, dts; +Cc: nd

Hi Phil,
>From the error log, issue was caused by lsof command not installed. Qemu module will check whether connection has been established by this tool.
Could you please install it and try again? If that fix the issue, I think only shell regression need to be changed.

Thanks,
Marvin

> -----Original Message-----
> From: Phil.Yang@arm.com [mailto:Phil.Yang@arm.com]
> Sent: Wednesday, May 16, 2018 11:56 AM
> To: Liu, Yong <yong.liu@intel.com>; dts@dpdk.org
> Cc: nd <nd@arm.com>
> Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> failure
> 
> Hi Marvin,
> 
> For telnet vm control I've encountered serial connection got no repose
> after first time login failure. Below is the log. Please check it.
> =======================================================
> m] Started Load/Save Random Seed.[\x1b[0;32m  OK  \x1b[0m] Started Apply
> Kernel Variables.[\x1b[0;32m  OK  \x1b[0m] Mounted FUSE Control File
> System.[\x1b[0;32m  OK  \x1b[0m] Mounted Kernel Configuration File
> System.[\x1b[0;32m  OK  \x1b[0m] Started Create Static Device Nodes in
> /dev.         Starting udev Kernel Device Manager...[\x1b[0;32m  OK
> \x1b[0m] Reached target Local File Systems (Pre).[\x1b[0;32m  OK  \x1b[0m]
> Started udev Kernel Device Manager.[\x1b[0;32m  OK  \x1b[0m] Started
> Dispatch Password Requests to Console Directory Watch.[\x1b[0;32m  OK
> \x1b[0m] Reached target Local Encrypted Volumes.[\x1b[0;32m  OK  \x1b[0m]
> Activated swap /swapfile.[\x1b[0;32m  OK  \x1b[0m] Reached target
> Swap.[\x1b[0;32m  OK  \x1b[0m] Started Flush Journal to Persistent
> Storage."
> (Pdb) c
> [10.169.40.174:vm0] not ready for login
>              dut.10.169.40.174: Can't login [vm0] on [10.169.40.174],
> retry 1 times!!!
>              dut.10.169.40.174: lsof -i:7002 | grep telnet | awk '{print
> $2}'
> Exception happened in [lsof -i:7002 | grep telnet | awk '{print $2}'] and
> output is [lsof -i:7002 | grep telnet | awk '{print $2}'
> Command not found]
> Traceback (most recent call last):
>   File "/root/dpdk-dts/framework/virt_base.py", line 284, in start
>     self._start_vm()
>   File "/root/dpdk-dts/framework/qemu_kvm.py", line 1269, in _start_vm
>     self.__wait_vm_ready()
> TimeoutException: TIMEOUT on lsof -i:7002 | grep telnet | awk '{print $2}'
> Unhandled expection <class 'exception.TimeoutException'>
>             TestVhostPmdXstats: Failure for Set up VM ENV failed
> ============================================================
> 
> So I added a delay to flush the useless output. Which can resolve this
> issue.
> BTW, only telnet connection has this defect. This fix is kind of
> workaround, but It works.
> 
> Thanks,
> Phil Yang
> 
> > -----Original Message-----
> > From: Liu, Yong <yong.liu@intel.com>
> > Sent: Wednesday, May 16, 2018 9:38 AM
> > To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> > Cc: nd <nd@arm.com>
> > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> failure
> >
> > Thanks, Phil. I'm fine with the changes, just one question about the
> issue you
> > met.
> > Qemu module should has taken care of the problem that VM maybe can't
> login
> > for the first time.
> > If login action can't be done continuously, I think there may be some
> kind of
> > issue here.
> > Could you please check the output of serial session? It may help us to
> figure out
> > the problem.
> >
> > Regards,
> > Marvin
> >
> > > -----Original Message-----
> > > From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> > > Sent: Tuesday, May 15, 2018 6:06 PM
> > > To: dts@dpdk.org
> > > Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong <yong.liu@intel.com>
> > > Subject: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > > failure
> > >
> > > For telnet vm control, it will continuously fail to login to vm when
> > > it doesn't read login prompt during first time connection. So extend
> > > the connection time to get more output each time.
> > >
> > > For socket vm control, added LOGIN_PROMPT into the login status check
> > > for other platform.
> > > Keep the connection longer to avoid failure and reconnection.
> > >
> > > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > > ---
> > >  framework/qemu_kvm.py | 11 ++++++-----
> > >  1 file changed, 6 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index
> > > ec33669..57d16f6 100644
> > > --- a/framework/qemu_kvm.py
> > > +++ b/framework/qemu_kvm.py
> > > @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
> > >          Connect to serial port and return connected session for usage
> > >          if connected failed will return None
> > >          """
> > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > +        shell_reg = r"(.*)# "
> > >          try:
> > >              if getattr(self, 'control_session', None) is None:
> > >                  self.control_session = self.host_session @@ -987,7
> > > +987,7 @@ class QEMUKvm(VirtBase):
> > >                  self.control_session.send_command("nc -U %s" %
> > > self.serial_path)
> > >
> > >              # login message not ouput if timeout too small
> > > -            out = self.control_session.send_command("",
> > > timeout=5).replace('\r', '').replace('\n', '')
> > > +            out = self.control_session.send_command("",
> > > timeout=15).replace('\r', '').replace('\n', '')
> > >
> > >              if len(out) == 0:
> > >                  raise StartVMFailedException("Can't get output from
> > > [%s:%s]" % (self.host_dut.crb['My IP'], self.vm_name)) @@ -1025,7
> > > +1025,7 @@ class QEMUKvm(VirtBase):
> > >          Connect to serial port and return connected session for usage
> > >          if connected failed will return None
> > >          """
> > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > +        shell_reg = r"(.*)# "
> > >          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" %
> > > self.serial_port
> > >
> > >          try:
> > > @@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
> > >                  self.control_session = self.host_session
> > >
> > >                  self.control_session.send_expect("telnet localhost
> > > %d" % self.serial_port, "Connected to localhost",
> > > timeout=self.OPERATION_TIMEOUT)
> > > +                time.sleep(5)
> > >
> > >              # output will be empty if timeout too small
> > > -            out = self.control_session.send_command("",
> > > timeout=5).replace('\r', '').replace('\n', '')
> > > +            out = self.control_session.send_command("",
> > > timeout=10).replace('\r', '').replace('\n', '')
> > >
> > >              # if no output from serial port, either connection close
> > > or system hang
> > >              if len(out) == 0:
> > > @@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
> > >                      return True
> > >
> > >              # login into Redhat os, not sure can work on all
> > > distributions
> > > -            if "x86_64 on an x86_64" not in out:
> > > +            if ("x86_64 on an x86_64" not in out) and
> > > + (self.LOGIN_PROMPT
> > > not in out):
> > >                  print RED("[%s:%s] not ready for login" %
> > > (self.host_dut.crb['My IP'], self.vm_name))
> > >                  return False
> > >              else:
> > > --
> > > 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
  2018-05-16  5:01     ` Liu, Yong
@ 2018-05-16  5:22       ` Phil Yang
  2018-05-16  6:37         ` Liu, Yong
  0 siblings, 1 reply; 12+ messages in thread
From: Phil Yang @ 2018-05-16  5:22 UTC (permalink / raw)
  To: Liu, Yong, dts; +Cc: nd

Hi Marvin,

The DUT had installed lsof.

=============
phil@net-arm-c2400_01:~$ sudo lsof -i:7000 | grep telnet 
telnet    24489 root    3u  IPv4 256487      0t0  TCP localhost:58776->localhost:afs3-fileserver (ESTABLISHED)
=============

Thanks,
Phil Yang

> -----Original Message-----
> From: Liu, Yong <yong.liu@intel.com>
> Sent: Wednesday, May 16, 2018 1:01 PM
> To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> Cc: nd <nd@arm.com>
> Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
> 
> Hi Phil,
> From the error log, issue was caused by lsof command not installed. Qemu
> module will check whether connection has been established by this tool.
> Could you please install it and try again? If that fix the issue, I think only shell
> regression need to be changed.
> 
> Thanks,
> Marvin
> 
> > -----Original Message-----
> > From: Phil.Yang@arm.com [mailto:Phil.Yang@arm.com]
> > Sent: Wednesday, May 16, 2018 11:56 AM
> > To: Liu, Yong <yong.liu@intel.com>; dts@dpdk.org
> > Cc: nd <nd@arm.com>
> > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > failure
> >
> > Hi Marvin,
> >
> > For telnet vm control I've encountered serial connection got no repose
> > after first time login failure. Below is the log. Please check it.
> > =======================================================
> > m] Started Load/Save Random Seed.[\x1b[0;32m  OK  \x1b[0m] Started
> > Apply Kernel Variables.[\x1b[0;32m  OK  \x1b[0m] Mounted FUSE Control
> > File System.[\x1b[0;32m  OK  \x1b[0m] Mounted Kernel Configuration
> > File System.[\x1b[0;32m  OK  \x1b[0m] Started Create Static Device Nodes in
> > /dev.         Starting udev Kernel Device Manager...[\x1b[0;32m  OK
> > \x1b[0m] Reached target Local File Systems (Pre).[\x1b[0;32m  OK
> > \x1b[0m] Started udev Kernel Device Manager.[\x1b[0;32m  OK  \x1b[0m]
> > Started Dispatch Password Requests to Console Directory
> > Watch.[\x1b[0;32m  OK \x1b[0m] Reached target Local Encrypted
> > Volumes.[\x1b[0;32m  OK  \x1b[0m] Activated swap /swapfile.[\x1b[0;32m
> > OK  \x1b[0m] Reached target Swap.[\x1b[0;32m  OK  \x1b[0m] Started
> > Flush Journal to Persistent Storage."
> > (Pdb) c
> > [10.169.40.174:vm0] not ready for login
> >              dut.10.169.40.174: Can't login [vm0] on [10.169.40.174],
> > retry 1 times!!!
> >              dut.10.169.40.174: lsof -i:7002 | grep telnet | awk
> > '{print $2}'
> > Exception happened in [lsof -i:7002 | grep telnet | awk '{print $2}']
> > and output is [lsof -i:7002 | grep telnet | awk '{print $2}'
> > Command not found]
> > Traceback (most recent call last):
> >   File "/root/dpdk-dts/framework/virt_base.py", line 284, in start
> >     self._start_vm()
> >   File "/root/dpdk-dts/framework/qemu_kvm.py", line 1269, in _start_vm
> >     self.__wait_vm_ready()
> > TimeoutException: TIMEOUT on lsof -i:7002 | grep telnet | awk '{print $2}'
> > Unhandled expection <class 'exception.TimeoutException'>
> >             TestVhostPmdXstats: Failure for Set up VM ENV failed
> > ============================================================
> >
> > So I added a delay to flush the useless output. Which can resolve this
> > issue.
> > BTW, only telnet connection has this defect. This fix is kind of
> > workaround, but It works.
> >
> > Thanks,
> > Phil Yang
> >
> > > -----Original Message-----
> > > From: Liu, Yong <yong.liu@intel.com>
> > > Sent: Wednesday, May 16, 2018 9:38 AM
> > > To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> > > Cc: nd <nd@arm.com>
> > > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > failure
> > >
> > > Thanks, Phil. I'm fine with the changes, just one question about the
> > issue you
> > > met.
> > > Qemu module should has taken care of the problem that VM maybe can't
> > login
> > > for the first time.
> > > If login action can't be done continuously, I think there may be
> > > some
> > kind of
> > > issue here.
> > > Could you please check the output of serial session? It may help us
> > > to
> > figure out
> > > the problem.
> > >
> > > Regards,
> > > Marvin
> > >
> > > > -----Original Message-----
> > > > From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> > > > Sent: Tuesday, May 15, 2018 6:06 PM
> > > > To: dts@dpdk.org
> > > > Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong <yong.liu@intel.com>
> > > > Subject: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > > > failure
> > > >
> > > > For telnet vm control, it will continuously fail to login to vm
> > > > when it doesn't read login prompt during first time connection. So
> > > > extend the connection time to get more output each time.
> > > >
> > > > For socket vm control, added LOGIN_PROMPT into the login status
> > > > check for other platform.
> > > > Keep the connection longer to avoid failure and reconnection.
> > > >
> > > > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > > > ---
> > > >  framework/qemu_kvm.py | 11 ++++++-----
> > > >  1 file changed, 6 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index
> > > > ec33669..57d16f6 100644
> > > > --- a/framework/qemu_kvm.py
> > > > +++ b/framework/qemu_kvm.py
> > > > @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
> > > >          Connect to serial port and return connected session for usage
> > > >          if connected failed will return None
> > > >          """
> > > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > > +        shell_reg = r"(.*)# "
> > > >          try:
> > > >              if getattr(self, 'control_session', None) is None:
> > > >                  self.control_session = self.host_session @@
> > > > -987,7
> > > > +987,7 @@ class QEMUKvm(VirtBase):
> > > >                  self.control_session.send_command("nc -U %s" %
> > > > self.serial_path)
> > > >
> > > >              # login message not ouput if timeout too small
> > > > -            out = self.control_session.send_command("",
> > > > timeout=5).replace('\r', '').replace('\n', '')
> > > > +            out = self.control_session.send_command("",
> > > > timeout=15).replace('\r', '').replace('\n', '')
> > > >
> > > >              if len(out) == 0:
> > > >                  raise StartVMFailedException("Can't get output
> > > > from [%s:%s]" % (self.host_dut.crb['My IP'], self.vm_name)) @@
> > > > -1025,7
> > > > +1025,7 @@ class QEMUKvm(VirtBase):
> > > >          Connect to serial port and return connected session for usage
> > > >          if connected failed will return None
> > > >          """
> > > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > > +        shell_reg = r"(.*)# "
> > > >          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'"
> > > > % self.serial_port
> > > >
> > > >          try:
> > > > @@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
> > > >                  self.control_session = self.host_session
> > > >
> > > >                  self.control_session.send_expect("telnet
> > > > localhost %d" % self.serial_port, "Connected to localhost",
> > > > timeout=self.OPERATION_TIMEOUT)
> > > > +                time.sleep(5)
> > > >
> > > >              # output will be empty if timeout too small
> > > > -            out = self.control_session.send_command("",
> > > > timeout=5).replace('\r', '').replace('\n', '')
> > > > +            out = self.control_session.send_command("",
> > > > timeout=10).replace('\r', '').replace('\n', '')
> > > >
> > > >              # if no output from serial port, either connection
> > > > close or system hang
> > > >              if len(out) == 0:
> > > > @@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
> > > >                      return True
> > > >
> > > >              # login into Redhat os, not sure can work on all
> > > > distributions
> > > > -            if "x86_64 on an x86_64" not in out:
> > > > +            if ("x86_64 on an x86_64" not in out) and
> > > > + (self.LOGIN_PROMPT
> > > > not in out):
> > > >                  print RED("[%s:%s] not ready for login" %
> > > > (self.host_dut.crb['My IP'], self.vm_name))
> > > >                  return False
> > > >              else:
> > > > --
> > > > 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
  2018-05-16  5:22       ` Phil Yang
@ 2018-05-16  6:37         ` Liu, Yong
  2018-05-17 10:16           ` Phil Yang
  0 siblings, 1 reply; 12+ messages in thread
From: Liu, Yong @ 2018-05-16  6:37 UTC (permalink / raw)
  To: Phil.Yang, dts; +Cc: nd

Phil,
As I known, this command will only send to self.host_dut which should not be possible to occur below error.
Is your dut running some other processes?

[10.169.40.174:vm0] not ready for login
             dut.10.169.40.174: Can't login [vm0] on [10.169.40.174], retry 1 times!!!
             dut.10.169.40.174: lsof -i:7002 | grep telnet | awk '{print $2}'
Exception happened in [lsof -i:7002 | grep telnet | awk '{print $2}'] and output is [lsof -i:7002 | grep telnet | awk '{print $2}'
Command not found]



Thanks,
Marvin

> -----Original Message-----
> From: Phil.Yang@arm.com [mailto:Phil.Yang@arm.com]
> Sent: Wednesday, May 16, 2018 1:23 PM
> To: Liu, Yong <yong.liu@intel.com>; dts@dpdk.org
> Cc: nd <nd@arm.com>
> Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> failure
> 
> Hi Marvin,
> 
> The DUT had installed lsof.
> 
> =============
> phil@net-arm-c2400_01:~$ sudo lsof -i:7000 | grep telnet
> telnet    24489 root    3u  IPv4 256487      0t0  TCP localhost:58776-
> >localhost:afs3-fileserver (ESTABLISHED)
> =============
> 
> Thanks,
> Phil Yang
> 
> > -----Original Message-----
> > From: Liu, Yong <yong.liu@intel.com>
> > Sent: Wednesday, May 16, 2018 1:01 PM
> > To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> > Cc: nd <nd@arm.com>
> > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> failure
> >
> > Hi Phil,
> > From the error log, issue was caused by lsof command not installed. Qemu
> > module will check whether connection has been established by this tool.
> > Could you please install it and try again? If that fix the issue, I
> think only shell
> > regression need to be changed.
> >
> > Thanks,
> > Marvin
> >
> > > -----Original Message-----
> > > From: Phil.Yang@arm.com [mailto:Phil.Yang@arm.com]
> > > Sent: Wednesday, May 16, 2018 11:56 AM
> > > To: Liu, Yong <yong.liu@intel.com>; dts@dpdk.org
> > > Cc: nd <nd@arm.com>
> > > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > > failure
> > >
> > > Hi Marvin,
> > >
> > > For telnet vm control I've encountered serial connection got no repose
> > > after first time login failure. Below is the log. Please check it.
> > > =======================================================
> > > m] Started Load/Save Random Seed.[\x1b[0;32m  OK  \x1b[0m] Started
> > > Apply Kernel Variables.[\x1b[0;32m  OK  \x1b[0m] Mounted FUSE Control
> > > File System.[\x1b[0;32m  OK  \x1b[0m] Mounted Kernel Configuration
> > > File System.[\x1b[0;32m  OK  \x1b[0m] Started Create Static Device
> Nodes in
> > > /dev.         Starting udev Kernel Device Manager...[\x1b[0;32m  OK
> > > \x1b[0m] Reached target Local File Systems (Pre).[\x1b[0;32m  OK
> > > \x1b[0m] Started udev Kernel Device Manager.[\x1b[0;32m  OK  \x1b[0m]
> > > Started Dispatch Password Requests to Console Directory
> > > Watch.[\x1b[0;32m  OK \x1b[0m] Reached target Local Encrypted
> > > Volumes.[\x1b[0;32m  OK  \x1b[0m] Activated swap /swapfile.[\x1b[0;32m
> > > OK  \x1b[0m] Reached target Swap.[\x1b[0;32m  OK  \x1b[0m] Started
> > > Flush Journal to Persistent Storage."
> > > (Pdb) c
> > > [10.169.40.174:vm0] not ready for login
> > >              dut.10.169.40.174: Can't login [vm0] on [10.169.40.174],
> > > retry 1 times!!!
> > >              dut.10.169.40.174: lsof -i:7002 | grep telnet | awk
> > > '{print $2}'
> > > Exception happened in [lsof -i:7002 | grep telnet | awk '{print $2}']
> > > and output is [lsof -i:7002 | grep telnet | awk '{print $2}'
> > > Command not found]
> > > Traceback (most recent call last):
> > >   File "/root/dpdk-dts/framework/virt_base.py", line 284, in start
> > >     self._start_vm()
> > >   File "/root/dpdk-dts/framework/qemu_kvm.py", line 1269, in _start_vm
> > >     self.__wait_vm_ready()
> > > TimeoutException: TIMEOUT on lsof -i:7002 | grep telnet | awk '{print
> $2}'
> > > Unhandled expection <class 'exception.TimeoutException'>
> > >             TestVhostPmdXstats: Failure for Set up VM ENV failed
> > > ============================================================
> > >
> > > So I added a delay to flush the useless output. Which can resolve this
> > > issue.
> > > BTW, only telnet connection has this defect. This fix is kind of
> > > workaround, but It works.
> > >
> > > Thanks,
> > > Phil Yang
> > >
> > > > -----Original Message-----
> > > > From: Liu, Yong <yong.liu@intel.com>
> > > > Sent: Wednesday, May 16, 2018 9:38 AM
> > > > To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> > > > Cc: nd <nd@arm.com>
> > > > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > > failure
> > > >
> > > > Thanks, Phil. I'm fine with the changes, just one question about the
> > > issue you
> > > > met.
> > > > Qemu module should has taken care of the problem that VM maybe can't
> > > login
> > > > for the first time.
> > > > If login action can't be done continuously, I think there may be
> > > > some
> > > kind of
> > > > issue here.
> > > > Could you please check the output of serial session? It may help us
> > > > to
> > > figure out
> > > > the problem.
> > > >
> > > > Regards,
> > > > Marvin
> > > >
> > > > > -----Original Message-----
> > > > > From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> > > > > Sent: Tuesday, May 15, 2018 6:06 PM
> > > > > To: dts@dpdk.org
> > > > > Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong <yong.liu@intel.com>
> > > > > Subject: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > > > > failure
> > > > >
> > > > > For telnet vm control, it will continuously fail to login to vm
> > > > > when it doesn't read login prompt during first time connection. So
> > > > > extend the connection time to get more output each time.
> > > > >
> > > > > For socket vm control, added LOGIN_PROMPT into the login status
> > > > > check for other platform.
> > > > > Keep the connection longer to avoid failure and reconnection.
> > > > >
> > > > > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > > > > ---
> > > > >  framework/qemu_kvm.py | 11 ++++++-----
> > > > >  1 file changed, 6 insertions(+), 5 deletions(-)
> > > > >
> > > > > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py index
> > > > > ec33669..57d16f6 100644
> > > > > --- a/framework/qemu_kvm.py
> > > > > +++ b/framework/qemu_kvm.py
> > > > > @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
> > > > >          Connect to serial port and return connected session for
> usage
> > > > >          if connected failed will return None
> > > > >          """
> > > > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > > > +        shell_reg = r"(.*)# "
> > > > >          try:
> > > > >              if getattr(self, 'control_session', None) is None:
> > > > >                  self.control_session = self.host_session @@
> > > > > -987,7
> > > > > +987,7 @@ class QEMUKvm(VirtBase):
> > > > >                  self.control_session.send_command("nc -U %s" %
> > > > > self.serial_path)
> > > > >
> > > > >              # login message not ouput if timeout too small
> > > > > -            out = self.control_session.send_command("",
> > > > > timeout=5).replace('\r', '').replace('\n', '')
> > > > > +            out = self.control_session.send_command("",
> > > > > timeout=15).replace('\r', '').replace('\n', '')
> > > > >
> > > > >              if len(out) == 0:
> > > > >                  raise StartVMFailedException("Can't get output
> > > > > from [%s:%s]" % (self.host_dut.crb['My IP'], self.vm_name)) @@
> > > > > -1025,7
> > > > > +1025,7 @@ class QEMUKvm(VirtBase):
> > > > >          Connect to serial port and return connected session for
> usage
> > > > >          if connected failed will return None
> > > > >          """
> > > > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > > > +        shell_reg = r"(.*)# "
> > > > >          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'"
> > > > > % self.serial_port
> > > > >
> > > > >          try:
> > > > > @@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
> > > > >                  self.control_session = self.host_session
> > > > >
> > > > >                  self.control_session.send_expect("telnet
> > > > > localhost %d" % self.serial_port, "Connected to localhost",
> > > > > timeout=self.OPERATION_TIMEOUT)
> > > > > +                time.sleep(5)
> > > > >
> > > > >              # output will be empty if timeout too small
> > > > > -            out = self.control_session.send_command("",
> > > > > timeout=5).replace('\r', '').replace('\n', '')
> > > > > +            out = self.control_session.send_command("",
> > > > > timeout=10).replace('\r', '').replace('\n', '')
> > > > >
> > > > >              # if no output from serial port, either connection
> > > > > close or system hang
> > > > >              if len(out) == 0:
> > > > > @@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
> > > > >                      return True
> > > > >
> > > > >              # login into Redhat os, not sure can work on all
> > > > > distributions
> > > > > -            if "x86_64 on an x86_64" not in out:
> > > > > +            if ("x86_64 on an x86_64" not in out) and
> > > > > + (self.LOGIN_PROMPT
> > > > > not in out):
> > > > >                  print RED("[%s:%s] not ready for login" %
> > > > > (self.host_dut.crb['My IP'], self.vm_name))
> > > > >                  return False
> > > > >              else:
> > > > > --
> > > > > 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
  2018-05-16  6:37         ` Liu, Yong
@ 2018-05-17 10:16           ` Phil Yang
  0 siblings, 0 replies; 12+ messages in thread
From: Phil Yang @ 2018-05-17 10:16 UTC (permalink / raw)
  To: Liu, Yong, dts; +Cc: nd

Thanks Marvin. You are right, the delay is unnecessary.

I'll rework the patch.

Thanks,
Phil Yang

> -----Original Message-----
> From: Liu, Yong <yong.liu@intel.com>
> Sent: Wednesday, May 16, 2018 2:37 PM
> To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> Cc: nd <nd@arm.com>
> Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session failure
> 
> Phil,
> As I known, this command will only send to self.host_dut which should not be
> possible to occur below error.
> Is your dut running some other processes?
> 
> [10.169.40.174:vm0] not ready for login
>              dut.10.169.40.174: Can't login [vm0] on [10.169.40.174], retry 1 times!!!
>              dut.10.169.40.174: lsof -i:7002 | grep telnet | awk '{print $2}'
> Exception happened in [lsof -i:7002 | grep telnet | awk '{print $2}'] and output is
> [lsof -i:7002 | grep telnet | awk '{print $2}'
> Command not found]
> 
> 
> 
> Thanks,
> Marvin
> 
> > -----Original Message-----
> > From: Phil.Yang@arm.com [mailto:Phil.Yang@arm.com]
> > Sent: Wednesday, May 16, 2018 1:23 PM
> > To: Liu, Yong <yong.liu@intel.com>; dts@dpdk.org
> > Cc: nd <nd@arm.com>
> > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > failure
> >
> > Hi Marvin,
> >
> > The DUT had installed lsof.
> >
> > =============
> > phil@net-arm-c2400_01:~$ sudo lsof -i:7000 | grep telnet
> > telnet    24489 root    3u  IPv4 256487      0t0  TCP localhost:58776-
> > >localhost:afs3-fileserver (ESTABLISHED)
> > =============
> >
> > Thanks,
> > Phil Yang
> >
> > > -----Original Message-----
> > > From: Liu, Yong <yong.liu@intel.com>
> > > Sent: Wednesday, May 16, 2018 1:01 PM
> > > To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> > > Cc: nd <nd@arm.com>
> > > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control session
> > failure
> > >
> > > Hi Phil,
> > > From the error log, issue was caused by lsof command not installed.
> > > Qemu module will check whether connection has been established by this
> tool.
> > > Could you please install it and try again? If that fix the issue, I
> > think only shell
> > > regression need to be changed.
> > >
> > > Thanks,
> > > Marvin
> > >
> > > > -----Original Message-----
> > > > From: Phil.Yang@arm.com [mailto:Phil.Yang@arm.com]
> > > > Sent: Wednesday, May 16, 2018 11:56 AM
> > > > To: Liu, Yong <yong.liu@intel.com>; dts@dpdk.org
> > > > Cc: nd <nd@arm.com>
> > > > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control
> > > > session failure
> > > >
> > > > Hi Marvin,
> > > >
> > > > For telnet vm control I've encountered serial connection got no
> > > > repose after first time login failure. Below is the log. Please check it.
> > > > =======================================================
> > > > m] Started Load/Save Random Seed.[\x1b[0;32m  OK  \x1b[0m] Started
> > > > Apply Kernel Variables.[\x1b[0;32m  OK  \x1b[0m] Mounted FUSE
> > > > Control File System.[\x1b[0;32m  OK  \x1b[0m] Mounted Kernel
> > > > Configuration File System.[\x1b[0;32m  OK  \x1b[0m] Started Create
> > > > Static Device
> > Nodes in
> > > > /dev.         Starting udev Kernel Device Manager...[\x1b[0;32m  OK
> > > > \x1b[0m] Reached target Local File Systems (Pre).[\x1b[0;32m  OK
> > > > \x1b[0m] Started udev Kernel Device Manager.[\x1b[0;32m  OK
> > > > \x1b[0m] Started Dispatch Password Requests to Console Directory
> > > > Watch.[\x1b[0;32m  OK \x1b[0m] Reached target Local Encrypted
> > > > Volumes.[\x1b[0;32m  OK  \x1b[0m] Activated swap
> > > > /swapfile.[\x1b[0;32m OK  \x1b[0m] Reached target Swap.[\x1b[0;32m
> > > > OK  \x1b[0m] Started Flush Journal to Persistent Storage."
> > > > (Pdb) c
> > > > [10.169.40.174:vm0] not ready for login
> > > >              dut.10.169.40.174: Can't login [vm0] on
> > > > [10.169.40.174], retry 1 times!!!
> > > >              dut.10.169.40.174: lsof -i:7002 | grep telnet | awk
> > > > '{print $2}'
> > > > Exception happened in [lsof -i:7002 | grep telnet | awk '{print
> > > > $2}'] and output is [lsof -i:7002 | grep telnet | awk '{print $2}'
> > > > Command not found]
> > > > Traceback (most recent call last):
> > > >   File "/root/dpdk-dts/framework/virt_base.py", line 284, in start
> > > >     self._start_vm()
> > > >   File "/root/dpdk-dts/framework/qemu_kvm.py", line 1269, in _start_vm
> > > >     self.__wait_vm_ready()
> > > > TimeoutException: TIMEOUT on lsof -i:7002 | grep telnet | awk
> > > > '{print
> > $2}'
> > > > Unhandled expection <class 'exception.TimeoutException'>
> > > >             TestVhostPmdXstats: Failure for Set up VM ENV failed
> > > > ============================================================
> > > >
> > > > So I added a delay to flush the useless output. Which can resolve
> > > > this issue.
> > > > BTW, only telnet connection has this defect. This fix is kind of
> > > > workaround, but It works.
> > > >
> > > > Thanks,
> > > > Phil Yang
> > > >
> > > > > -----Original Message-----
> > > > > From: Liu, Yong <yong.liu@intel.com>
> > > > > Sent: Wednesday, May 16, 2018 9:38 AM
> > > > > To: Phil Yang <Phil.Yang@arm.com>; dts@dpdk.org
> > > > > Cc: nd <nd@arm.com>
> > > > > Subject: RE: [PATCH 1/2] framework/qemu_kvm: fix vm control
> > > > > session
> > > > failure
> > > > >
> > > > > Thanks, Phil. I'm fine with the changes, just one question about
> > > > > the
> > > > issue you
> > > > > met.
> > > > > Qemu module should has taken care of the problem that VM maybe
> > > > > can't
> > > > login
> > > > > for the first time.
> > > > > If login action can't be done continuously, I think there may be
> > > > > some
> > > > kind of
> > > > > issue here.
> > > > > Could you please check the output of serial session? It may help
> > > > > us to
> > > > figure out
> > > > > the problem.
> > > > >
> > > > > Regards,
> > > > > Marvin
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> > > > > > Sent: Tuesday, May 15, 2018 6:06 PM
> > > > > > To: dts@dpdk.org
> > > > > > Cc: nd@arm.com; phil.yang@arm.com; Liu, Yong
> > > > > > <yong.liu@intel.com>
> > > > > > Subject: [PATCH 1/2] framework/qemu_kvm: fix vm control
> > > > > > session failure
> > > > > >
> > > > > > For telnet vm control, it will continuously fail to login to
> > > > > > vm when it doesn't read login prompt during first time
> > > > > > connection. So extend the connection time to get more output each
> time.
> > > > > >
> > > > > > For socket vm control, added LOGIN_PROMPT into the login
> > > > > > status check for other platform.
> > > > > > Keep the connection longer to avoid failure and reconnection.
> > > > > >
> > > > > > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > > > > > ---
> > > > > >  framework/qemu_kvm.py | 11 ++++++-----
> > > > > >  1 file changed, 6 insertions(+), 5 deletions(-)
> > > > > >
> > > > > > diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
> > > > > > index
> > > > > > ec33669..57d16f6 100644
> > > > > > --- a/framework/qemu_kvm.py
> > > > > > +++ b/framework/qemu_kvm.py
> > > > > > @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
> > > > > >          Connect to serial port and return connected session
> > > > > > for
> > usage
> > > > > >          if connected failed will return None
> > > > > >          """
> > > > > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > > > > +        shell_reg = r"(.*)# "
> > > > > >          try:
> > > > > >              if getattr(self, 'control_session', None) is None:
> > > > > >                  self.control_session = self.host_session @@
> > > > > > -987,7
> > > > > > +987,7 @@ class QEMUKvm(VirtBase):
> > > > > >                  self.control_session.send_command("nc -U %s"
> > > > > > %
> > > > > > self.serial_path)
> > > > > >
> > > > > >              # login message not ouput if timeout too small
> > > > > > -            out = self.control_session.send_command("",
> > > > > > timeout=5).replace('\r', '').replace('\n', '')
> > > > > > +            out = self.control_session.send_command("",
> > > > > > timeout=15).replace('\r', '').replace('\n', '')
> > > > > >
> > > > > >              if len(out) == 0:
> > > > > >                  raise StartVMFailedException("Can't get
> > > > > > output from [%s:%s]" % (self.host_dut.crb['My IP'],
> > > > > > self.vm_name)) @@
> > > > > > -1025,7
> > > > > > +1025,7 @@ class QEMUKvm(VirtBase):
> > > > > >          Connect to serial port and return connected session
> > > > > > for
> > usage
> > > > > >          if connected failed will return None
> > > > > >          """
> > > > > > -        shell_reg = r"(\s*)\[(.*)\]# "
> > > > > > +        shell_reg = r"(.*)# "
> > > > > >          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'"
> > > > > > % self.serial_port
> > > > > >
> > > > > >          try:
> > > > > > @@ -1034,9 +1034,10 @@ class QEMUKvm(VirtBase):
> > > > > >                  self.control_session = self.host_session
> > > > > >
> > > > > >                  self.control_session.send_expect("telnet
> > > > > > localhost %d" % self.serial_port, "Connected to localhost",
> > > > > > timeout=self.OPERATION_TIMEOUT)
> > > > > > +                time.sleep(5)
> > > > > >
> > > > > >              # output will be empty if timeout too small
> > > > > > -            out = self.control_session.send_command("",
> > > > > > timeout=5).replace('\r', '').replace('\n', '')
> > > > > > +            out = self.control_session.send_command("",
> > > > > > timeout=10).replace('\r', '').replace('\n', '')
> > > > > >
> > > > > >              # if no output from serial port, either
> > > > > > connection close or system hang
> > > > > >              if len(out) == 0:
> > > > > > @@ -1058,7 +1059,7 @@ class QEMUKvm(VirtBase):
> > > > > >                      return True
> > > > > >
> > > > > >              # login into Redhat os, not sure can work on all
> > > > > > distributions
> > > > > > -            if "x86_64 on an x86_64" not in out:
> > > > > > +            if ("x86_64 on an x86_64" not in out) and
> > > > > > + (self.LOGIN_PROMPT
> > > > > > not in out):
> > > > > >                  print RED("[%s:%s] not ready for login" %
> > > > > > (self.host_dut.crb['My IP'], self.vm_name))
> > > > > >                  return False
> > > > > >              else:
> > > > > > --
> > > > > > 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dts] [PATCH v2] framework/qemu_kvm: fix vm control session failure
  2018-05-15 10:06 [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Phil Yang
  2018-05-15 10:06 ` [dts] [PATCH 2/2] framework/qemu_kvm: replace nc with socat for vm control by socket Phil Yang
  2018-05-16  1:37 ` [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Liu, Yong
@ 2018-05-17 10:31 ` Phil Yang
  2018-05-18  5:11   ` Liu, Yong
  2 siblings, 1 reply; 12+ messages in thread
From: Phil Yang @ 2018-05-17 10:31 UTC (permalink / raw)
  To: dts; +Cc: nd, yong.liu

Fix telnet socket vm control shell_reg mismatch issue.

For socket vm control, added LOGIN_PROMPT into the login status
check for other platform.

Jira: ENTNET-773
Change-Id: I95fbb8b25563b706e6dc06217033d68aa3c76486
Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 framework/qemu_kvm.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index ec33669..89518a7 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
         Connect to serial port and return connected session for usage
         if connected failed will return None
         """
-        shell_reg = r"(\s*)\[(.*)\]# "
+        shell_reg = r"(.*)# "
         try:
             if getattr(self, 'control_session', None) is None:
                 self.control_session = self.host_session
@@ -1025,7 +1025,7 @@ class QEMUKvm(VirtBase):
         Connect to serial port and return connected session for usage
         if connected failed will return None
         """
-        shell_reg = r"(\s*)\[(.*)\]# "
+        shell_reg = r"(.*)# "
         scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" % self.serial_port
 
         try:
@@ -1058,7 +1058,7 @@ class QEMUKvm(VirtBase):
                     return True
 
             # login into Redhat os, not sure can work on all distributions
-            if "x86_64 on an x86_64" not in out:
+            if ("x86_64 on an x86_64" not in out) and (self.LOGIN_PROMPT not in out):
                 print RED("[%s:%s] not ready for login" % (self.host_dut.crb['My IP'], self.vm_name))
                 return False
             else:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH v2] framework/qemu_kvm: fix vm control session failure
  2018-05-17 10:31 ` [dts] [PATCH v2] " Phil Yang
@ 2018-05-18  5:11   ` Liu, Yong
  0 siblings, 0 replies; 12+ messages in thread
From: Liu, Yong @ 2018-05-18  5:11 UTC (permalink / raw)
  To: phil.yang, dts; +Cc: nd

Thanks, Phil. Applied.

> -----Original Message-----
> From: phil.yang@arm.com [mailto:phil.yang@arm.com]
> Sent: Thursday, May 17, 2018 6:31 PM
> To: dts@dpdk.org
> Cc: nd@arm.com; Liu, Yong <yong.liu@intel.com>
> Subject: [PATCH v2] framework/qemu_kvm: fix vm control session failure
> 
> Fix telnet socket vm control shell_reg mismatch issue.
> 
> For socket vm control, added LOGIN_PROMPT into the login status
> check for other platform.
> 
> Jira: ENTNET-773
> Change-Id: I95fbb8b25563b706e6dc06217033d68aa3c76486
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> ---
>  framework/qemu_kvm.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
> index ec33669..89518a7 100644
> --- a/framework/qemu_kvm.py
> +++ b/framework/qemu_kvm.py
> @@ -979,7 +979,7 @@ class QEMUKvm(VirtBase):
>          Connect to serial port and return connected session for usage
>          if connected failed will return None
>          """
> -        shell_reg = r"(\s*)\[(.*)\]# "
> +        shell_reg = r"(.*)# "
>          try:
>              if getattr(self, 'control_session', None) is None:
>                  self.control_session = self.host_session
> @@ -1025,7 +1025,7 @@ class QEMUKvm(VirtBase):
>          Connect to serial port and return connected session for usage
>          if connected failed will return None
>          """
> -        shell_reg = r"(\s*)\[(.*)\]# "
> +        shell_reg = r"(.*)# "
>          scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" %
> self.serial_port
> 
>          try:
> @@ -1058,7 +1058,7 @@ class QEMUKvm(VirtBase):
>                      return True
> 
>              # login into Redhat os, not sure can work on all
> distributions
> -            if "x86_64 on an x86_64" not in out:
> +            if ("x86_64 on an x86_64" not in out) and (self.LOGIN_PROMPT
> not in out):
>                  print RED("[%s:%s] not ready for login" %
> (self.host_dut.crb['My IP'], self.vm_name))
>                  return False
>              else:
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [dts] [PATCH v2] framework/qemu_kvm: replace nc with socat for vm control by socket
  2018-05-15 10:06 ` [dts] [PATCH 2/2] framework/qemu_kvm: replace nc with socat for vm control by socket Phil Yang
@ 2018-05-25  8:37   ` Phil Yang
  2018-05-25 16:31     ` Liu, Yong
  0 siblings, 1 reply; 12+ messages in thread
From: Phil Yang @ 2018-05-25  8:37 UTC (permalink / raw)
  To: dts; +Cc: nd, yong.liu

The nc process hang while connecting with unix domian socket.

The problem could be resolved by replacing it with socat tool.

Change-Id: If78dc387d306d7ad545637a5053cedf5430c806f
Jira: ENTNET-773
Signed-off-by: Phil Yang <phil.yang@arm.com>
---
 framework/qemu_kvm.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index f24947d..37f35ce 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -990,7 +990,7 @@ class QEMUKvm(VirtBase):
             if getattr(self, 'control_session', None) is None:
                 self.control_session = self.host_session
 
-                self.control_session.send_command("nc -U %s" % self.serial_path)
+                self.control_session.send_command("socat %s STDIO" % self.serial_path)
 
             # login message not ouput if timeout too small
             out = self.control_session.send_command("", timeout=5).replace('\r', '').replace('\n', '')
@@ -1722,7 +1722,7 @@ class QEMUKvm(VirtBase):
         """
         # return control_session to host_session
         if self.control_type == 'socket':
-            scan_cmd = "ps -e -o pid,cmd  |grep 'nc -U %s' |grep -v grep" % self.serial_path
+            scan_cmd = "ps -e -o pid,cmd  |grep 'socat %s STDIO' |grep -v grep" % self.serial_path
             out = self.host_dut.send_expect(scan_cmd, "#")
             proc_info = out.strip().split()
             try:
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [dts] [PATCH v2] framework/qemu_kvm: replace nc with socat for vm control by socket
  2018-05-25  8:37   ` [dts] [PATCH v2] " Phil Yang
@ 2018-05-25 16:31     ` Liu, Yong
  0 siblings, 0 replies; 12+ messages in thread
From: Liu, Yong @ 2018-05-25 16:31 UTC (permalink / raw)
  To: phil.yang, dts; +Cc: nd

Thanks Phil, applied.

On 05/25/2018 04:37 PM, phil.yang@arm.com wrote:
> The nc process hang while connecting with unix domian socket.
>
> The problem could be resolved by replacing it with socat tool.
>
> Change-Id: If78dc387d306d7ad545637a5053cedf5430c806f
> Jira: ENTNET-773
> Signed-off-by: Phil Yang<phil.yang@arm.com>
> ---
>   framework/qemu_kvm.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-05-25  8:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15 10:06 [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Phil Yang
2018-05-15 10:06 ` [dts] [PATCH 2/2] framework/qemu_kvm: replace nc with socat for vm control by socket Phil Yang
2018-05-25  8:37   ` [dts] [PATCH v2] " Phil Yang
2018-05-25 16:31     ` Liu, Yong
2018-05-16  1:37 ` [dts] [PATCH 1/2] framework/qemu_kvm: fix vm control session failure Liu, Yong
2018-05-16  3:55   ` Phil Yang
2018-05-16  5:01     ` Liu, Yong
2018-05-16  5:22       ` Phil Yang
2018-05-16  6:37         ` Liu, Yong
2018-05-17 10:16           ` Phil Yang
2018-05-17 10:31 ` [dts] [PATCH v2] " Phil Yang
2018-05-18  5:11   ` Liu, Yong

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).