]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-volume tests/functional setup playbook for nvme devices
authorAlfredo Deza <adeza@redhat.com>
Thu, 6 Sep 2018 13:38:00 +0000 (09:38 -0400)
committerAlfredo Deza <adeza@redhat.com>
Thu, 6 Sep 2018 18:26:36 +0000 (14:26 -0400)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/mixed-type-dmcrypt/group_vars/all
src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/mixed-type-dmcrypt/test.yml
src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/mixed-type/group_vars/all
src/ceph-volume/ceph_volume/tests/functional/batch/centos7/bluestore/mixed-type/test.yml
src/ceph-volume/ceph_volume/tests/functional/batch/playbooks/setup_mixed_type.yml [new file with mode: 0644]

index 1bd93cff65225f87675d909db6ca7419f3f295ba..c3335fae601e0b48e52e89c825f55f615d5081d5 100644 (file)
@@ -23,3 +23,10 @@ ceph_conf_overrides:
   global:
     osd_pool_default_pg_num: 8
     osd_pool_default_size: 1
+
+# The following is only needed for testing purposes and is not part of
+# ceph-ansible supported variables
+
+osd_ids:
+  - 0
+  - 1
index 165d9da291e2f18841290796dd657e1a8fe8fe0a..aa867bcde1ab729f91f84c87110bef359e4cca66 120000 (symlink)
@@ -1 +1 @@
-../../../playbooks/test_bluestore.yml
\ No newline at end of file
+../../../playbooks/test.yml
\ No newline at end of file
index 59d2875af69eeefdf96b46618473cce70f040dca..06b966be52cdf35c0013e75d8ebf5a4ea7c34266 100644 (file)
@@ -22,3 +22,10 @@ ceph_conf_overrides:
   global:
     osd_pool_default_pg_num: 8
     osd_pool_default_size: 1
+
+# The following is only needed for testing purposes and is not part of
+# ceph-ansible supported variables
+
+osd_ids:
+  - 0
+  - 1
index 165d9da291e2f18841290796dd657e1a8fe8fe0a..aa867bcde1ab729f91f84c87110bef359e4cca66 120000 (symlink)
@@ -1 +1 @@
-../../../playbooks/test_bluestore.yml
\ No newline at end of file
+../../../playbooks/test.yml
\ No newline at end of file
diff --git a/src/ceph-volume/ceph_volume/tests/functional/batch/playbooks/setup_mixed_type.yml b/src/ceph-volume/ceph_volume/tests/functional/batch/playbooks/setup_mixed_type.yml
new file mode 100644 (file)
index 0000000..af29487
--- /dev/null
@@ -0,0 +1,140 @@
+
+- hosts: osds
+  become: yes
+  tasks:
+
+    - name: create the nvme image systemd unit
+      copy:
+        content: |
+          [Unit]
+          Description=NVMe loop device
+          After=local-fs.target
+          Wants=local-fs.target
+
+          [Service]
+          Type=simple
+          ExecStart=/bin/bash /opt/ceph-nvme.sh
+          StandardOutput=journal
+          StandardError=journal
+
+          [Install]
+          WantedBy=multi-user.target
+        dest: "/etc/systemd/system/ceph-nvme.service"
+
+    - name: create the ceph-nvme startup script
+      copy:
+        content: |
+          set -x
+          set -e
+          modprobe nvmet
+          modprobe nvme_loop
+          modprobe nvme_fabrics
+          modprobe loop
+          losetup -v /dev/loop0 /opt/loop0_nvme0
+          losetup -l
+          nvmetcli restore /opt/loop.json
+          nvme connect -t loop -n testnqn -q hostnqn
+          nvme list
+        dest: "/opt/ceph-nvme.sh"
+
+    - name: ensure ceph-nvme is enabled
+      service:
+        name: ceph-nvme
+        state: stopped
+        enabled: yes
+
+    - name: install nvme dependencies
+      package:
+        name: "{{ item }}"
+        state: present
+      with_items:
+        - nvme-cli
+        - nvmetcli
+
+    - name: enable NVME kernel modules
+      modprobe:
+        name: "{{ item }}"
+        state: present
+      with_items:
+        - nvmet
+        - nvme_loop
+        - nvme_fabrics
+
+    - name: check if the nvme file is attached to loop0
+      command: losetup -l /dev/loop0
+      register: losetup_list
+
+    - name: detach current nvme0 file
+      command: losetup -d /dev/loop0
+      when: '"loop0_nvme0" in losetup_list.stdout'
+
+    - name: remove previous nvme0 file
+      file:
+        path: /opt/loop0_nvme0
+        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'
+
+    - name: create the loop.json file for nvmetcli
+      copy:
+        content: |
+            {
+              "hosts": [
+                {
+                  "nqn": "hostnqn"
+                }
+              ],
+              "ports": [
+                {
+                  "addr": {
+                    "adrfam": "",
+                    "traddr": "",
+                    "treq": "not specified",
+                    "trsvcid": "",
+                    "trtype": "loop"
+                  },
+                  "portid": 1,
+                  "referrals": [],
+                  "subsystems": [
+                    "testnqn"
+                  ]
+                }
+              ],
+              "subsystems": [
+                {
+                  "allowed_hosts": [
+                    "hostnqn"
+                  ],
+                  "attr": {
+                    "allow_any_host": "0"
+                  },
+                  "namespaces": [
+                    {
+                      "device": {
+                        "nguid": "ef90689c-6c46-d44c-89c1-4067801309a8",
+                        "path": "/dev/loop0"
+                      },
+                      "enable": 1,
+                      "nsid": 1
+                    }
+                  ],
+                  "nqn": "testnqn"
+                }
+              ]
+            }
+        dest: "/opt/loop.json"
+
+    - name: setup the /dev/loop0 target with nvmetcli
+      command: nvmetcli restore /opt/loop.json
+
+    - name: connect the new target as an nvme device
+      command: nvme connect -t loop -n testnqn -q hostnqn
+
+    - name: debug output for nvme list
+      command: nvme list