[dts] [PATCH V1] framework ssh_pexpect: add timeout to avoid file uncomplete during scp file from host to VM
yong.liu at intel.com
Mon Dec 19 04:50:28 CET 2016
Lei, please try again. We need to know the difference between normal connection and vm connection.
> -----Original Message-----
> From: Yao, Lei A
> Sent: Monday, December 19, 2016 11:30 AM
> To: Liu, Yong; dts at dpdk.org
> Subject: RE: [dts] [PATCH V1] framework ssh_pexpect: add timeout to avoid
> file uncomplete during scp file from host to VM
> > -----Original Message-----
> > From: Liu, Yong
> > Sent: Monday, December 19, 2016 11:25 AM
> > To: Yao, Lei A <lei.a.yao at intel.com>; dts at dpdk.org
> > Subject: RE: [dts] [PATCH V1] framework ssh_pexpect: add timeout to
> > file uncomplete during scp file from host to VM
> > > > > diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
> > > > > index d5b6616..09095a1 100644
> > > > > --- a/framework/ssh_pexpect.py
> > > > > +++ b/framework/ssh_pexpect.py
> > > > > @@ -185,6 +185,7 @@ class SSHPexpect(object):
> > > > > if i == 1:
> > > > > time.sleep(0.5)
> > > > > p.sendline(password)
> > > > > + time.sleep(10)
> > > > > p.expect("100%", 60)
> > > > Expect function has been already wait for about one minute, look
> > > there's
> > > > no need to add more time.
> > > This timeout is used before sending the ssh cmd. Not waiting time.
> > > virtualization test, we find the file will always be corrupted when
> > > dpdk.tar.gz from host to vm. Wait 10s after ssh connection set up ,
> > > send scp cmd will resolve this failure.
> > The sleep command is after "password" message, so I think connection
> > between VM and host machine has been created and worked.
> > What I wonder is that why file is corrupted after "100%" hint. Either
> > worked abnormally or some issues we haven't figured out.
> I can't find out the root cause at my side. This issue can't reproduced
> manually because human will always wait 2~3 seconds after ssh connection
> set up , then send scp cmd. Also can't reproduced by pdb. This patch is
> just the practice experience which can avoid this error.
You can try with pdb the function expect_loop which can find in /usr/lib/python2.7/dist-packages/pexpect/__init__.py.
When "index >= 0" happened, file should transferred normally. If file not transferred as expected, we need to know why.
> > Thanks,
> > Marvin
More information about the dts