]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/test/cli-integration: correct hostname for iscsi gateway 42760/head
authorDeepika Upadhyay <dupadhya@redhat.com>
Thu, 14 Oct 2021 07:10:14 +0000 (12:40 +0530)
committerDeepika Upadhyay <dupadhya@redhat.com>
Mon, 18 Oct 2021 07:51:50 +0000 (13:21 +0530)
iscsi accepts first word of hostname as local hostname[0] instead of
smithi061.front.sepia.ceph.com we use: smithi061 otherwise gateway
creation will error out with:
```The first gateway defined must be the local machine```

[0] https://github.com/ceph/ceph-iscsi-cli/blob/ff3e430b70a62257a560b8988bd54bf845c01fb7/gwcli/utils.py#L36

Signed-off-by: Deepika Upadhyay <dupadhya@redhat.com>
src/test/cli-integration/rbd/gwcli_create.t

index 63d3b305244e0972149886eb796ac3518fd6bd87..67fdceb8855c7155cda9ca8c13324a1ab03faac6 100644 (file)
@@ -34,7 +34,7 @@ Create the target IQN
 
 Create the first gateway
 ========================
-  $ HOST=`python3 -c "import socket; print(socket.getfqdn())"`
+  $ HOST=$(python3 -c "import socket; print(socket.getfqdn())" | cut -d. -f1)
   > IP=`hostname -i | awk '{print $1}'`
   > sudo podman exec $ISCSI_CONTAINER gwcli iscsi-targets/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/gateways create ip_addresses=$IP gateway_name=$HOST
   $ sudo podman exec $ISCSI_CONTAINER gwcli ls iscsi-targets/ | grep 'o- gateways' | awk -F'[' '{print $2}'
@@ -44,12 +44,12 @@ Create the second gateway
 ========================
   $ IP=`cat /etc/ceph/iscsi-gateway.cfg |grep 'trusted_ip_list' | awk -F'[, ]' '{print $3}'`
   > if [ "$IP" != `hostname -i | awk '{print $1}'` ]; then
-  >   HOST=$(python3 -c "import socket; print(socket.getfqdn('$IP'))")
+  >   HOST=$(python3 -c "import socket; print(socket.getfqdn('$IP'))" | cut -d. -f1)
   >   sudo podman exec $ISCSI_CONTAINER gwcli iscsi-targets/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/gateways create ip_addresses=$IP gateway_name=$HOST
   > fi
   $ IP=`cat /etc/ceph/iscsi-gateway.cfg |grep 'trusted_ip_list' | awk -F'[, ]' '{print $4}'`
   > if [ "$IP" != `hostname -i | awk '{print $1}'` ]; then
-  >   HOST=`python3 -c "import socket; print(socket.getfqdn('$IP'))"`
+  >   HOST=$(python3 -c "import socket; print(socket.getfqdn('$IP'))" | cut -d. -f1)
   >   sudo podman exec $ISCSI_CONTAINER gwcli iscsi-targets/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/gateways create ip_addresses=$IP gateway_name=$HOST
   > fi
   $ sudo podman exec $ISCSI_CONTAINER gwcli ls iscsi-targets/ | grep 'o- gateways' | awk -F'[' '{print $2}'