[OE-core] [PATCH 1/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-11-06 Thread Stephano Cetola
From: Erik Botö 

On systemd systems calling reboot over an ssh connection doesn't
return as expected causing an exception, therefore wrap the call
to reboot in order to avoid this issue.

Also sync the filesystems before rebooting cause otherwise, it will be
done as part of the reboot and could take a very long time and testimage
will fail to access the machine. This issue was observed consistently with
one of our rootfs at Pelagicore.

[YOCTO #11524]

Signed-off-by: Erik Botö 
Signed-off-by: Stephano Cetola 
---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index 07418fcda1..fe90967923 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -108,7 +108,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
 time.sleep(10)
 self.power_ctl("cycle")
 else:
-status, output = conn.run("reboot")
+status, output = conn.run("sync; { sleep 1; reboot; } > /dev/null 
&")
 if status != 0:
 bb.error("Failed rebooting target and no power control command 
defined. You need to manually reset the device.\n%s" % output)
 
-- 
2.14.2

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-05-26 Thread Leonardo Sandoval
On Fri, 2017-05-26 at 11:01 +0200, Erik Botö wrote:
> I guess an introduction should have been added to this patchset, so here 
> it comes a bit late:
> 

no problem, in that case, you may need to tag the commit(s) with the
bugzilla ID


> These patches are what I needed to do in order to get automated runtime 
> tests on target using the systemd-boot target working. There is an open 
> bug in the bugzilla for this as well: 
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=11524.
> 
> Cheers,
> Erik
> 
> 
> On 05/19/2017 04:20 PM, Erik Botö wrote:
> > On systemd systems calling reboot over an ssh connection doesn't
> > return as expected causing an exception, therefore wrap the call
> > to reboot in order to avoid this issue.
> >
> > Signed-off-by: Erik Botö 
> > ---
> >   meta/lib/oeqa/controllers/masterimage.py | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/meta/lib/oeqa/controllers/masterimage.py 
> > b/meta/lib/oeqa/controllers/masterimage.py
> > index 07418fcda1..6cdcfa3068 100644
> > --- a/meta/lib/oeqa/controllers/masterimage.py
> > +++ b/meta/lib/oeqa/controllers/masterimage.py
> > @@ -108,7 +108,7 @@ class 
> > MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
> >   time.sleep(10)
> >   self.power_ctl("cycle")
> >   else:
> > -status, output = conn.run("reboot")
> > +status, output = conn.run("{ sleep 1; reboot; } > /dev/null &")
> >   if status != 0:
> >   bb.error("Failed rebooting target and no power control 
> > command defined. You need to manually reset the device.\n%s" % output)
> >   
> 


-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-05-26 Thread Erik Botö
I guess an introduction should have been added to this patchset, so here 
it comes a bit late:


These patches are what I needed to do in order to get automated runtime 
tests on target using the systemd-boot target working. There is an open 
bug in the bugzilla for this as well: 
https://bugzilla.yoctoproject.org/show_bug.cgi?id=11524.


Cheers,
Erik


On 05/19/2017 04:20 PM, Erik Botö wrote:

On systemd systems calling reboot over an ssh connection doesn't
return as expected causing an exception, therefore wrap the call
to reboot in order to avoid this issue.

Signed-off-by: Erik Botö 
---
  meta/lib/oeqa/controllers/masterimage.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index 07418fcda1..6cdcfa3068 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -108,7 +108,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
  time.sleep(10)
  self.power_ctl("cycle")
  else:
-status, output = conn.run("reboot")
+status, output = conn.run("{ sleep 1; reboot; } > /dev/null &")
  if status != 0:
  bb.error("Failed rebooting target and no power control command 
defined. You need to manually reset the device.\n%s" % output)
  


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-05-19 Thread Erik Botö

On 2017-05-19 16:59, Leonardo Sandoval wrote:


On Fri, 2017-05-19 at 16:20 +0200, Erik Botö wrote:

On systemd systems calling reboot over an ssh connection doesn't
return as expected causing an exception, therefore wrap the call
to reboot in order to avoid this issue.

Signed-off-by: Erik Botö 
---
  meta/lib/oeqa/controllers/masterimage.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index 07418fcda1..6cdcfa3068 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -108,7 +108,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
  time.sleep(10)
  self.power_ctl("cycle")
  else:
-status, output = conn.run("reboot")
+status, output = conn.run("{ sleep 1; reboot; } > /dev/null &")

what would make the difference having the sleep before reboot?


It's an extra safety measure to make sure that reboot hasn't had time to 
do anything before the command returns. Inspired by: 
https://unix.stackexchange.com/questions/58271/closing-connection-after-executing-reboot-using-ssh-command





  if status != 0:
  bb.error("Failed rebooting target and no power control command 
defined. You need to manually reset the device.\n%s" % output)
  
--

2.11.0





--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-05-19 Thread Leonardo Sandoval
On Fri, 2017-05-19 at 16:20 +0200, Erik Botö wrote:
> On systemd systems calling reboot over an ssh connection doesn't
> return as expected causing an exception, therefore wrap the call
> to reboot in order to avoid this issue.
> 
> Signed-off-by: Erik Botö 
> ---
>  meta/lib/oeqa/controllers/masterimage.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oeqa/controllers/masterimage.py 
> b/meta/lib/oeqa/controllers/masterimage.py
> index 07418fcda1..6cdcfa3068 100644
> --- a/meta/lib/oeqa/controllers/masterimage.py
> +++ b/meta/lib/oeqa/controllers/masterimage.py
> @@ -108,7 +108,7 @@ class 
> MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
>  time.sleep(10)
>  self.power_ctl("cycle")
>  else:
> -status, output = conn.run("reboot")
> +status, output = conn.run("{ sleep 1; reboot; } > /dev/null &")

what would make the difference having the sleep before reboot?


>  if status != 0:
>  bb.error("Failed rebooting target and no power control 
> command defined. You need to manually reset the device.\n%s" % output)
>  
> -- 
> 2.11.0
> 


-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH 1/4] masterimage.py: fix issue with calling reboot on masterimage/DUT

2017-05-19 Thread Erik Botö
On systemd systems calling reboot over an ssh connection doesn't
return as expected causing an exception, therefore wrap the call
to reboot in order to avoid this issue.

Signed-off-by: Erik Botö 
---
 meta/lib/oeqa/controllers/masterimage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py 
b/meta/lib/oeqa/controllers/masterimage.py
index 07418fcda1..6cdcfa3068 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -108,7 +108,7 @@ class 
MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta
 time.sleep(10)
 self.power_ctl("cycle")
 else:
-status, output = conn.run("reboot")
+status, output = conn.run("{ sleep 1; reboot; } > /dev/null &")
 if status != 0:
 bb.error("Failed rebooting target and no power control command 
defined. You need to manually reset the device.\n%s" % output)
 
-- 
2.11.0

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core