]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: add REST API method support for ceph-iscsi 38715/head
authorXiubo Li <xiubli@redhat.com>
Fri, 25 Dec 2020 01:08:04 +0000 (09:08 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 2 Feb 2021 03:06:07 +0000 (11:06 +0800)
Fixes: https://tracker.ceph.com/issues/48529
Signed-off-by: Xiubo Li <xiubli@redhat.com>
qa/suites/rbd/iscsi/workloads/ceph_iscsi.yaml
src/test/cli-integration/rbd/rest_api_create.t [new file with mode: 0644]
src/test/cli-integration/rbd/rest_api_delete.t [new file with mode: 0644]

index 5d00e800903e9ae2af62db261c61449a1ea4d13e..f91a35eafd22e659762c00d7b1e7aa6da0947254 100644 (file)
@@ -11,3 +11,12 @@ tasks:
       - src/test/cli-integration/rbd/iscsi_client.t
       c_gateway.1:
       - src/test/cli-integration/rbd/gwcli_delete.t
+- cram:
+    parallel: False
+    clients:
+      a_gateway.0:
+      - src/test/cli-integration/rbd/rest_api_create.t
+      b_client.0:
+      - src/test/cli-integration/rbd/iscsi_client.t
+      c_gateway.1:
+      - src/test/cli-integration/rbd/rest_api_delete.t
diff --git a/src/test/cli-integration/rbd/rest_api_create.t b/src/test/cli-integration/rbd/rest_api_create.t
new file mode 100644 (file)
index 0000000..0006626
--- /dev/null
@@ -0,0 +1,58 @@
+Create a datapool/block1 disk
+=============================
+  $ sudo curl --user admin:admin -d mode=create -d size=300M -X PUT http://127.0.0.1:5000/api/disk/datapool/block1 -s
+  {
+    "message": "disk create/update successful"
+  }
+
+Create the target IQN
+=====================
+  $ sudo curl --user admin:admin -X PUT http://127.0.0.1:5000/api/target/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw -s
+  {
+    "message": "Target defined successfully"
+  }
+
+Create the first gateway
+========================
+  $ HOST=`python3 -c "import socket; print(socket.getfqdn())"`
+  > IP=`hostname -i | awk '{print $1}'`
+  > sudo curl --user admin:admin -d ip_address=$IP -X PUT http://127.0.0.1:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/$HOST -s
+  {
+    "message": "Gateway creation successful"
+  }
+
+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'))"`
+  >   sudo curl --user admin:admin -d ip_address=$IP -X PUT http://127.0.0.1:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/$HOST -s
+  > else
+  >   IP=`cat /etc/ceph/iscsi-gateway.cfg |grep 'trusted_ip_list' | awk -F'[, ]' '{print $4}'`
+  >   HOST=`python3 -c "import socket; print(socket.getfqdn('$IP'))"`
+  >   sudo curl --user admin:admin -d ip_address=$IP -X PUT http://127.0.0.1:5000/api/gateway/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/$HOST -s
+  > fi
+  {
+    "message": "Gateway creation successful"
+  }
+
+Attach the disk
+===============
+  $ sudo curl --user admin:admin -d disk=datapool/block1 -X PUT http://127.0.0.1:5000/api/targetlun/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw -s
+  {
+    "message": "Target LUN mapping updated successfully"
+  }
+
+Create a host
+=============
+  $ sudo curl --user admin:admin -X PUT http://127.0.0.1:5000/api/client/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/iqn.1994-05.com.redhat:client -s
+  {
+    "message": "client create/update successful"
+  }
+
+Map the LUN
+===========
+  $ sudo curl --user admin:admin -d disk=datapool/block1 -X PUT http://127.0.0.1:5000/api/clientlun/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/iqn.1994-05.com.redhat:client -s
+  {
+    "message": "client masking update successful"
+  }
diff --git a/src/test/cli-integration/rbd/rest_api_delete.t b/src/test/cli-integration/rbd/rest_api_delete.t
new file mode 100644 (file)
index 0000000..f840644
--- /dev/null
@@ -0,0 +1,27 @@
+Delete the host
+===============
+  $ sudo curl --user admin:admin -X DELETE http://127.0.0.1:5000/api/client/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw/iqn.1994-05.com.redhat:client -s
+  {
+    "message": "client delete successful"
+  }
+
+Delete the iscsi-targets disk
+=============================
+  $ sudo curl --user admin:admin -d disk=datapool/block1 -X DELETE http://127.0.0.1:5000/api/targetlun/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw -s
+  {
+    "message": "Target LUN mapping updated successfully"
+  }
+
+Delete the target IQN
+=====================
+  $ sudo curl --user admin:admin -X DELETE http://127.0.0.1:5000/api/target/iqn.2003-01.com.redhat.iscsi-gw:ceph-gw -s
+  {
+    "message": "Target deleted."
+  }
+
+Delete the disks
+================
+  $ sudo curl --user admin:admin -X DELETE http://127.0.0.1:5000/api/disk/datapool/block1 -s
+  {
+    "message": "disk map deletion successful"
+  }