Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
This project is now read‑only. Starting Monday, February 2, please use https://ibm-ceph.atlassian.net/ for all bug tracking management.

Bug 1979449

Summary: iSCSI: Getting the error "The first gateway defined must be the local machine" while adding gateways
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Gopi <gpatta>
Component: CephadmAssignee: Sebastian Wagner <sewagner>
Status: CLOSED ERRATA QA Contact: Gopi <gpatta>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.0CC: adking, bniver, ceph-eng-bugs, ceph-qe-bugs, dsavinea, idryomov, mmurthy, sewagner, sostapov, tserlin, vereddy, xiubli
Target Milestone: ---Keywords: Regression
Target Release: 5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ceph-16.2.0-108.el8cp Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-08-30 08:31:32 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 Gopi 2021-07-06 05:43:54 UTC
Description of problem:
Unable to create gateways and giving the error"The first gateway defined must be the local machine"

Version-Release number of selected component (if applicable):
ceph version 16.2.0-88.el8cp (39884f5728635903be37a5fa873e4ef9d8a0b04a) pacific (stable)

How reproducible:
100%

Steps to Reproduce:
1. Deploy cluster using cephadm
2. Deploy iscsi services using iscsi.yml file
[ceph: root@magna007 ~]# cat iscsi.yml 
service_type: iscsi
service_id: iscsi
placement:
  hosts:
  - magna108
  - magna113
spec:
  pool: iscsi_pool
  trusted_ip_list: "10.8.128.108,10.8.128.113"
  api_user: admin
  api_password: admin

3. Login to container using "podman exec -it 12e38d148b25 /bin/sh" then do gwcli
4. Create target and gateways


Actual results:
/iscsi-target...-igw/gateways> create magna108 10.8.128.108
The first gateway defined must be the local machine

Expected results:
Gateway should be added without any errors.

Additional info:

I changed /etc/hosts file then I can see the below progress but this is not solving my problem.
/iscsi-target...-igw/gateways> create magna108 10.8.128.108
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
ok
/iscsi-target...-igw/gateways> ls
o- gateways .................................................................................................. [Up: 0/1, Portals: 1]
  o- ceph-3ce40d5c-dd5a-11eb-8a7a-002590fc2538-iscsi.iscsi.magna108.kkxugr ................................ [10.8.128.108 (UNKNOWN)]
/iscsi-target...-igw/gateways> ls
o- gateways .................................................................................................. [Up: 0/1, Portals: 1]
  o- ceph-3ce40d5c-dd5a-11eb-8a7a-002590fc2538-iscsi.iscsi.magna108.kkxugr ................................ [10.8.128.108 (UNKNOWN)]
/iscsi-target...-igw/gateways> create magna113 10.8.128.113
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
Failed : Gateway creation failed, gateway(s) unavailable:magna113(UNKNOWN state)

Comment 1 Gopi 2021-07-06 06:45:09 UTC
I have tried same scenario on VMs which were deployed from ceph-ci and facing same issue.

[root@ceph-tier0-amar-1625543163452-node5-osd-mds ~]# podman ps
CONTAINER ID  IMAGE                                                                                                                         COMMAND               CREATED         STATUS             PORTS   NAMES
ac00780dae18  registry-proxy.engineering.redhat.com/rh-osbs/rhceph@sha256:3a6c7a67b12fdf6df99754409983f580ed6436a6feb9f0af9b74bfb75cd2810e  -n mds.cephfs.cep...  2 hours ago     Up 2 hours ago             ceph-89ba48ec-de10-11eb-911d-fa163e74e674-mds.cephfs.ceph-tier0-amar-1625543163452-node5-osd-mds.ntpofh
69a09a2264c9  registry-proxy.engineering.redhat.com/rh-osbs/rhceph@sha256:3a6c7a67b12fdf6df99754409983f580ed6436a6feb9f0af9b74bfb75cd2810e                        25 seconds ago  Up 25 seconds ago          ceph-89ba48ec-de10-11eb-911d-fa163e74e674-iscsi.iscsi.ceph-tier0-amar-1625543163452-node5-osd-mds.uynepq-tcmu
1e39e69b4d32  registry-proxy.engineering.redhat.com/rh-osbs/rhceph@sha256:3a6c7a67b12fdf6df99754409983f580ed6436a6feb9f0af9b74bfb75cd2810e                        25 seconds ago  Up 25 seconds ago          ceph-89ba48ec-de10-11eb-911d-fa163e74e674-iscsi.iscsi.ceph-tier0-amar-1625543163452-node5-osd-mds.uynepq
[root@ceph-tier0-amar-1625543163452-node5-osd-mds ~]# podman exec -it 69a09a2264c9 sh

sh-4.4# gwcli
Warning: Could not load preferences file /root/.gwcli/prefs.bin.
/> cd iscsi-targets 

/iscsi-targets> create iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
ok
/iscsi-targets> goto gateways
/iscsi-target...-igw/gateways> create ceph-tier0-amar-1625543163452-node5-osd-mds 10.0.209.135
The first gateway defined must be the local machine
/iscsi-target...-igw/gateways> ls
o- gateways .................................................................................................. [Up: 0/0, Portals: 0]
/iscsi-target...-igw/gateways>

Comment 2 Gopi 2021-07-06 14:10:43 UTC
This is a regression as this worked in previous builds.

Comment 6 Gopi 2021-07-07 14:13:06 UTC
Hi Brett,

we are not creating/changing them and we are getting after deploy from cephadm tool and we filed a bz for it https://bugzilla.redhat.com/show_bug.cgi?id=1979445. 
This was working in the previous builds. Maybe someone from cephadm team can look into the /etc/hosts issue https://bugzilla.redhat.com/show_bug.cgi?id=1958236 ?

Comment 7 Sebastian Wagner 2021-07-07 15:57:41 UTC
This sounds like an FQDN issue to me.

ceph-iscsi uses the FQDN to verify the host name matches. Particularly, ceph-iscsi runs:


> python -c 'import socket; print(socket.getfqdn())'

to verify the host name. If this returns an FQDN, you also have to insert the gateway as an FQDN. See Ricardo's answer here: https://www.spinics.net/lists/ceph-users/msg61572.html

Comment 13 Sebastian Wagner 2021-07-08 10:11:58 UTC
Ilya, It's unfortunately not that simply. Passing --no-hosts will make it impossible for users to use the /etc/hosts to do internal name resolution, thus we had to remove that argument it again. In addition, there are a number of subtle and non-trivial differences between docker vs podman, FQDNs vs bare names, $(hostname) vs python -c 'socket.getfqdn()' and there is unfortunately no easy solution. 

Maybe https://github.com/ceph/ceph/pull/42242 is a possible mitigation. We're going to discuss this in today's cephadm standup.

Comment 17 Gopi 2021-07-14 10:51:28 UTC
Hi Xiubo,

Any updates on this bug as we are blocked with iscsi testing? Can we continue with non-tcmu container by modifying /etc/hosts file in case we don't see any further issues with it?

Thanks,
Gopi

Comment 20 Scott Ostapovicz 2021-07-14 16:16:56 UTC
Yes, please move this to POST

Comment 26 Gopi 2021-07-27 07:21:13 UTC
Working as expected. So moving this bug to verified state.

sh-4.4# cat /etc/hosts
10.8.128.83 magna083 magna083
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.1.1 magna083 magna083 ceph-f9faa6b2-ee9e-11eb-9821-002590fc2536-iscsi-iscsi-magna083-zainbl-tcmu
sh-4.4# gwcli
Warning: Could not load preferences file /root/.gwcli/prefs.bin.
/> cd iscsi-targets 
/iscsi-targets> create iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
ok
/iscsi-targets> goto gateways
/iscsi-target...-igw/gateways> create magna083 10.8.128.83
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
ok
/iscsi-target...-igw/gateways> delete confirm=true gateway_name=magna083
Deleting gateway, magna083 
/iscsi-target...-igw/gateways> ls
o- gateways .................................................................................................. [Up: 0/0, Portals: 0]
/iscsi-target...-igw/gateways> create magna083.ceph.redhat.com 10.8.128.83
The first gateway defined must be the local machine
/iscsi-target...-igw/gateways> create ceph-f9faa6b2-ee9e-11eb-9821-002590fc2536-iscsi-iscsi-magna083-zainbl-tcmu 10.8.128.83
The first gateway defined must be the local machine 
 
/iscsi-target...-igw/gateways> create magna083 10.8.128.83
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
ok
/iscsi-target...-igw/gateways> create magna084 10.8.128.84
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
ok
/iscsi-target...-igw/gateways> ls
o- gateways .................................................................................................. [Up: 2/2, Portals: 2]
  o- magna083 ................................................................................................... [10.8.128.83 (UP)]
  o- magna084 ................................................................................................... [10.8.128.84 (UP)]
/iscsi-target...-igw/gateways> cd /disks
/disks> create iscsi_pool image=iscsi_image size=50g
ok
/disks> goto hosts
/iscsi-target...eph-igw/hosts> create iqn.1994-05.com.redhat:rh7-client
ok
/iscsi-target...at:rh7-client> disk add iscsi_pool/iscsi_image
ok
/iscsi-target...at:rh7-client> cd
/iscsi-targets> ls
o- iscsi-targets ................................................................................. [DiscoveryAuth: None, Targets: 1]
  o- iqn.2003-01.com.redhat.iscsi-gw:ceph-igw ............................................................ [Auth: None, Gateways: 2]
    o- disks ............................................................................................................ [Disks: 1]
    | o- iscsi_pool/iscsi_image .......................................................................... [Owner: magna083, Lun: 0]
    o- gateways .............................................................................................. [Up: 2/2, Portals: 2]
    | o- magna083 ............................................................................................... [10.8.128.83 (UP)]
    | o- magna084 ............................................................................................... [10.8.128.84 (UP)]
    o- host-groups .................................................................................................... [Groups : 0]
    o- hosts ......................................................................................... [Auth: ACL_ENABLED, Hosts: 1]
      o- iqn.1994-05.com.redhat:rh7-client ............................................................. [Auth: None, Disks: 1(50G)]
        o- lun 0 .................................................................... [iscsi_pool/iscsi_image(50G), Owner: magna083]
/iscsi-targets>

Tested with non-tcmu container and working fine with that as well.
[root@magna083 ubuntu]# podman exec -it 728acb34e85d sh
sh-4.4# gwcli
Warning: Could not load preferences file /root/.gwcli/prefs.bin.
/> cd iscsi-targets 
/iscsi-targets> create target_iqn=iqn.2003-01.com.redhat.iscsi-gw:ceph-igw
ok
/iscsi-targets> goto gateways
/iscsi-target...-igw/gateways> create magna083 10.8.128.83
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
ok
/iscsi-target...-igw/gateways> create magna084 10.8.128.84
Adding gateway, sync'ing 0 disk(s) and 0 client(s)
ok
/iscsi-target...-igw/gateways> ls
o- gateways .................................................................................................. [Up: 2/2, Portals: 2]
  o- magna083 ................................................................................................... [10.8.128.83 (UP)]
  o- magna084 ................................................................................................... [10.8.128.84 (UP)]
/iscsi-target...-igw/gateways>

Comment 27 Sebastian Wagner 2021-08-05 08:57:46 UTC
*** Bug 1980808 has been marked as a duplicate of this bug. ***

Comment 29 errata-xmlrpc 2021-08-30 08:31:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat Ceph Storage 5.0 bug fix and enhancement), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:3294