Merge "zuul: new LVM/nvmet job (relevant scenario)"
diff --git a/.zuul.yaml b/.zuul.yaml
index 6bdce9e..a445230 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -15,6 +15,7 @@
             voting: false
         - cinder-tempest-plugin-lvm-lio-barbican-fips:
             voting: false
+        - cinder-tempest-plugin-lvm-nvmet-barbican
         - nova-ceph-multistore:
             voting: false
         - cinder-tempest-plugin-cbak-ceph
@@ -31,6 +32,7 @@
     gate:
       jobs:
         - cinder-tempest-plugin-lvm-lio-barbican
+        - cinder-tempest-plugin-lvm-nvmet-barbican
         # FIXME: no sense running a non-voting gate job.  See comment above.
         # - cinder-tempest-plugin-lvm-tgt-barbican
         - cinder-tempest-plugin-cbak-ceph
@@ -325,6 +327,40 @@
       tempest_exclude_regex: 'test_encrypted_cinder_volumes_cryptsetup'
 
 - job:
+    name: cinder-tempest-plugin-lvm-nvmet-barbican
+    description: |
+      This jobs configures Cinder with LVM, nvmet, barbican and
+      runs tempest tests and cinderlib tests.  nvmet is
+      configured to use the new connection information format,
+      NVMe-oF native multipathing, and sharing the NVMe-oF
+      namespace for all the connections to the same node.
+    # TODO: switch to cinder-tempest-plugin-lvm-barbican-base
+    # when cinderlib support for NVMe is fixed
+    parent: cinder-tempest-plugin-lvm-barbican-base-abstract
+    pre-run: playbooks/install-multipath.yaml
+    vars:
+      devstack_localrc:
+        CINDER_TARGET_HELPER: nvmet
+        CINDER_TARGET_PROTOCOL: nvmet_tcp
+        TEMPEST_STORAGE_PROTOCOL: nvmeof
+      devstack_local_conf:
+        test-config:
+          $TEMPEST_CONFIG:
+            volume-feature-enabled:
+              # NotImplementedError: Revert volume to snapshot not implemented for thin LVM.
+              volume_revert: False
+        post-config:
+          $NOVA_CONF:
+            libvirt:
+              volume_use_multipath: true
+          $CINDER_CONF:
+            lvmdriver-1:
+              nvmeof_conn_info_version: 2
+              lvm_share_target: true
+              target_secondary_ip_addresses: 127.0.0.1
+              use_multipath_for_image_xfer: true
+
+- job:
     name: cinder-tempest-plugin-lvm-tgt-barbican
     description: |
       This jobs configures Cinder with LVM, tgt, barbican and
diff --git a/playbooks/install-multipath.yaml b/playbooks/install-multipath.yaml
new file mode 100644
index 0000000..bc51810
--- /dev/null
+++ b/playbooks/install-multipath.yaml
@@ -0,0 +1,22 @@
+- hosts: tempest
+  vars:
+    mpath_package: "{{ 'device-mapper-multipath' if ansible_os_family == 'RedHat' else 'multipath-tools' }}"
+  tasks:
+    - name: Install multipath package on RedHat systems
+      package:
+        name: "{{ mpath_package }}"
+        state: present
+      become: yes
+
+    - name: Create configuration
+      command: mpathconf --enable --with_multipathd y --user_friendly_names n --find_multipaths y
+      args:
+        creates: /etc/multipath.conf
+      become: yes
+
+    - name: Start and enable on boot the multipath daemon
+      service:
+        name: multipathd
+        state: started
+        enabled: yes
+      become: yes