Bug 1062896

Summary: harness doesn't work if ipv6 is not available
Product: [Retired] Beaker Reporter: Jan Stancek <jstancek>
Component: beahAssignee: Dan Callaghan <dcallagh>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 0.15CC: aigao, asaha, bpeck, dcallagh, dspurek, jburke, ksrot, llim, pbunyan, qwan, rmancy, xjia
Target Milestone: 0.15.4Keywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-18 01:36:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Stancek 2014-02-08 11:40:22 UTC
Description of problem:
If I try to use distro RHEL-7.0-20140206.0 with ipv6.disable=1 harness doesn't work and beah-beaker-backend fails to start with:

# systemctl status beah-beaker-backend
beah-beaker-backend.service - The Beaker backend server.
   Loaded: loaded (/usr/lib/systemd/system/beah-beaker-backend.service; enabled)
   Active: failed (Result: exit-code) since Sat 2014-02-08 05:30:07 EST; 1h 6min ago
  Process: 7776 ExecStart=/usr/bin/beah-beaker-backend (code=exited, status=1/FAILURE)
 Main PID: 7776 (code=exited, status=1/FAILURE)
   CGroup: /system.slice/beah-beaker-backend.service

Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: proxy = make_proxy(conf, verbose)
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: File "/usr/lib/python2.7/site-packages/beah/backends/bea...roxy
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: lc_ipv6 = has_ipv6(url)
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: File "/usr/lib/python2.7/site-packages/beah/backends/bea...ipv6
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: s = socket.socket(socket.AF_INET6)
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: File "/usr/lib64/python2.7/socket.py", line 187, in __init__
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: _sock = _realsocket(family, type, proto)
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com beah-beaker-backend[7776]: socket.error: [Errno 97] Address family not supported by...ocol
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com systemd[1]: beah-beaker-backend.service: main process exited, code=exited, status=...ILURE
Feb 08 05:30:07 hp-ml370g6-01.rhts.eng.bos.redhat.com systemd[1]: Unit beah-beaker-backend.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.


Version-Release number of selected component (if applicable):
0.15.3

How reproducible:
100%

Steps to Reproduce:
1. run job with ipv6.disable=1 in kernel_options_post

Actual results:
harness doesn't work

Expected results:
harness works if IPv6 is not available

Additional info:

Comment 3 Amit Saha 2014-02-09 11:44:05 UTC
During testing, we didn't test this use case. The culprit is this line:

   # can we connect?
   s = socket.socket(socket.AF_INET6)
(in beah/backends/beakerlc.py: has_ipv6())

I think this can just be moved in the ensuing try..except block:

diff --git a/beah/backends/beakerlc.py b/beah/backends/beakerlc.py
index 0bb6a6c..84ab668 100644
--- a/beah/backends/beakerlc.py
+++ b/beah/backends/beakerlc.py
@@ -1874,8 +1874,8 @@ def has_ipv6(url):
         return None
 
     # can we connect?
-    s = socket.socket(socket.AF_INET6)
     try:
+        s = socket.socket(socket.AF_INET6)
         s.connect((lc_ipv6, url.port))
     except (socket.gaierror, socket.error):
         log.exception('Failed to connect to LC over IPv6.')

Comment 4 Jan Stancek 2014-02-09 11:55:32 UTC
(In reply to Amit Saha from comment #3)
> During testing, we didn't test this use case.

Is there some ks_meta or other option to force harness to use IPv4? I used it only to try work around Bug 1062867.

Comment 5 Amit Saha 2014-02-09 12:10:55 UTC
(In reply to Jan Stancek from comment #4)
> (In reply to Amit Saha from comment #3)
> > During testing, we didn't test this use case.
> 
> Is there some ks_meta or other option to force harness to use IPv4? I used
> it only to try work around Bug 1062867.

If you mean that it should use IPv4 even when IPv6 communication is possible locally as well as with the LC? No, it's not supported. BZ#1062867 looks interesting, we will have to look into it further.

Comment 7 Amit Saha 2014-02-09 12:21:26 UTC
http://gerrit.beaker-project.org/#/c/2792/1

Comment 8 Nick Coghlan 2014-02-10 00:57:29 UTC
In addition to attempting to fix this directly, we will also add the ability to opt in to using older versions of the harness (see #1063090)

Comment 9 Dan Callaghan 2014-02-11 22:32:05 UTC
*** Bug 1063945 has been marked as a duplicate of this bug. ***

Comment 10 Dan Callaghan 2014-02-12 05:44:57 UTC
This bug fix is included in beah 0.7.2 which is available from the harness-testing yum repos:

http://beaker-project.org/yum/harness-testing/

Comment 14 Dan Callaghan 2014-02-17 00:44:15 UTC
(In reply to Karel Srot from comment #13)
> Is the harness able to deal with a situation when the ipv6 is disabled
> during the test run?

No, this case is still broken. The reason is that at the start of the task IPv6 is working, so the harness exports RESULT_SERVER=[::1]:7090 which is the address which the rhts-* commands (such as rhts-report-result) use to talk back to the harness. But once IPv6 is disabled that address is no longer reachable so the task gets stuck trying to report a result, and eventually just times out.

Comment 15 Karel Srot 2014-02-17 08:25:57 UTC
I see. At how many places of the code this is actually required? I am thinking how difficult would be to add some IPv4 fallback in that case.

Comment 16 Dan Callaghan 2014-02-17 22:44:58 UTC
Karel, please see bug 1065811 for the remaining issues with IPv6 being disabled at runtime. I think the only practical solution for beah is an option to force it to use IPv4 only.

Comment 17 Dan Callaghan 2014-02-18 01:36:28 UTC
Beah 0.7.2 has been released.