]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-volume: create two NVME drives for testing
authorAndrew Schoen <aschoen@redhat.com>
Tue, 27 Nov 2018 23:34:10 +0000 (17:34 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 6 Dec 2018 18:29:46 +0000 (12:29 -0600)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
Resolves: bz#1650306

src/ceph-volume/ceph_volume/tests/functional/batch/playbooks/setup_mixed_type.yml

index af29487fb8128fa6fef32615ef5ecb72207756b8..179267aab3e31f65c4af6e15e0072e2614c51a39 100644 (file)
           modprobe nvme_fabrics
           modprobe loop
           losetup -v /dev/loop0 /opt/loop0_nvme0
+          losetup -v /dev/loop1 /opt/loop1_nvme1
           losetup -l
           nvmetcli restore /opt/loop.json
-          nvme connect -t loop -n testnqn -q hostnqn
+          nvme connect -t loop -n testnqn1 -q hostnqn
+          nvme connect -t loop -n testnqn2 -q hostnqn
           nvme list
         dest: "/opt/ceph-nvme.sh"
 
         - nvme_loop
         - nvme_fabrics
 
-    - name: check if the nvme file is attached to loop0
-      command: losetup -l /dev/loop0
-      register: losetup_list
+    - name: detach nvme files from loop devices
+      command: "losetup -d /dev/{{ item }}"
+      failed_when: false
+      loop:
+        - loop0
+        - loop1
 
-    - name: detach current nvme0 file
-      command: losetup -d /dev/loop0
-      when: '"loop0_nvme0" in losetup_list.stdout'
-
-    - name: remove previous nvme0 file
+    - name: remove previous nvme files
       file:
-        path: /opt/loop0_nvme0
+        path: "{{ item }}"
         state: absent
-
-    - name: create a 15GB sparse file for NVMe
-      command: fallocate -l 15G /opt/loop0_nvme0
-
-    - name: setup loop device with sparse file
-      command: losetup /dev/loop0 /opt/loop0_nvme0
-      when:
-        - '"loop0_nvme0" not in losetup_list.stdout'
+      loop:
+        - /opt/loop0_nvme0
+        - /opt/loop1_nvme1
+
+    - name: create 11GB sparse files for NVMe
+      command: "fallocate -l 11G {{ item }}"
+      loop:
+        - /opt/loop0_nvme0
+        - /opt/loop1_nvme1
+
+    - name: setup loop devices with sparse files
+      command: "losetup /dev/loop{{ item }} /opt/loop{{ item }}_nvme{{ item }}"
+      failed_when: false
+      loop:
+        - 0
+        - 1
 
     - name: create the loop.json file for nvmetcli
       copy:
                   "portid": 1,
                   "referrals": [],
                   "subsystems": [
-                    "testnqn"
+                    "testnqn1",
+                    "testnqn2"
                   ]
                 }
               ],
                       "nsid": 1
                     }
                   ],
-                  "nqn": "testnqn"
+                  "nqn": "testnqn1"
+                },
+                {
+                  "allowed_hosts": [
+                    "hostnqn"
+                  ],
+                  "attr": {
+                    "allow_any_host": "0"
+                  },
+                  "namespaces": [
+                    {
+                      "device": {
+                        "nguid": "ef90689c-6c46-d44c-89c1-4067801309a7",
+                        "path": "/dev/loop1"
+                      },
+                      "enable": 1,
+                      "nsid": 2
+                    }
+                  ],
+                  "nqn": "testnqn2"
                 }
               ]
             }
       command: nvmetcli restore /opt/loop.json
 
     - name: connect the new target as an nvme device
-      command: nvme connect -t loop -n testnqn -q hostnqn
+      command: "nvme connect -t loop -n testnqn{{ item }} -q hostnqn"
+      loop:
+        - 1
+        - 2
 
     - name: debug output for nvme list
       command: nvme list