Configure dedicated VG for Cinder

* change flafor to mosk specific for wrk5-cmp3 context

Related-Prod: PRODX-3456
Change-Id: I93f067d8a99bbf74157cc2626aa7907f318a6564
diff --git a/de/heat-templates/env/mstr1-wrkr5-cmp3-gtw0.yaml b/de/heat-templates/env/mstr1-wrkr5-cmp3-gtw0.yaml
index 89e1156..e490442 100644
--- a/de/heat-templates/env/mstr1-wrkr5-cmp3-gtw0.yaml
+++ b/de/heat-templates/env/mstr1-wrkr5-cmp3-gtw0.yaml
@@ -25,10 +25,12 @@
   worker_metadata: {"labels": {"openstack-control-plane":"enabled","openvswitch":"enabled","openstack-gateway":"enabled","role":"ceph-osd-node","local-volume-provisioner": "enabled"}}
   cmp_metadata: {"labels": {"openstack-compute-node":"enabled","openvswitch":"enabled", "role":"ceph-osd-node"}}
   gtw_metadata: {"labels": {"openvswitch":"enabled"}}
-  workers_flavor: 'system.compact.openstack.control.ephemeral'
-  cmps_flavor: 'system.compact.openstack.compute.ephemeral'
+  workers_flavor: 'mosk.s.control.ephemeral'
+  cmps_flavor: 'mosk.s.compute.ephemeral'
   storage_frontend_network_cidr: '10.12.1.0/24'
   storage_backend_network_cidr: '10.12.0.0/24'
+  cmp_lvm_loop_device_size: 50
+  cmp_cinder_lvm_loop_device_size: 50
   hardware_metadata: |
     '00:00:00:00:00:00':
       write_files:
diff --git a/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml b/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
index 622f611..a862bdd 100644
--- a/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
+++ b/de/heat-templates/fragments/SrvInstancesVMCephOSD.yaml
@@ -106,6 +106,9 @@
   lvm_loop_device_size:
     type: number
     default: 0
+  cinder_lvm_loop_device_size:
+    type: number
+    default: 0
 
 resources:
 
@@ -145,6 +148,7 @@
             $tungstenfabric_enabled: { get_param: tungstenfabric_enabled }
             $frr_bgp_neighbors: { get_param: frr_bgp_neighbors }
             $lvm_loop_device_size: { get_param: lvm_loop_device_size }
+            $cinder_lvm_loop_device_size: { get_param: cinder_lvm_loop_device_size }
 
   inject_files:
     type: "OS::Heat::CloudConfig"
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index a26b289..1464109 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -56,6 +56,7 @@
 SINGLE_NODE=${SINGLE_NODE:-$single_node}
 DOCKER_DEFAULT_ADDRESS_POOL=${DOCKER_DEFAULT_ADDRESS_POOL:-$docker_default_address_pool}
 LVM_LOOP_DEVICE_SIZE=${LVM_LOOP_DEVICE_SIZE:-$lvm_loop_device_size}
+CINDER_LVM_LOOP_DEVICE_SIZE=${CINDER_LVM_LOOP_DEVICE_SIZE:-$cinder_lvm_loop_device_size}
 #
 # End of block
 #
@@ -132,6 +133,7 @@
 FRR_EVPN_VXLAN_DST_PORT=${FRR_EVPN_VXLAN_DST_PORT:-4790}
 
 LVM_LOOP_DEVICE_SIZE=${LVM_LOOP_DEVICE_SIZE:-0}
+CINDER_LVM_LOOP_DEVICE_SIZE=${CINDER_LVM_LOOP_DEVICE_SIZE:-0}
 
 function retry {
     local retries=$1
@@ -212,32 +214,46 @@
 }
 
 function configure_lvm {
-    #configure lvm only on compute nodes
-    if [[ ${NODE_METADATA} == *"openstack-compute-node"* ]]; then
-        truncate --size ${LVM_LOOP_DEVICE_SIZE}G /srv/disk0
-        cat <<EOF > /etc/systemd/system/setup-loopback-loop0.service
+    function _setup_lvm {
+        local device_num=$1
+        local device_size=$2
+        local vg_name=$3
+
+        #configure lvm only on compute nodes
+        if [[ ${NODE_METADATA} == *"openstack-compute-node"* ]]; then
+            truncate --size ${device_size}G /srv/disk${device_num}
+            cat <<EOF > /etc/systemd/system/setup-loopback-loop${device_num}.service
 [Unit]
-Description=Setup loop0 device
+Description=Setup loop${device_num} device
 DefaultDependencies=no
 After=systemd-udev-settle.service
 Before=lvm2-activation-early.service
 Wants=systemd-udev-settle.service
 
 [Service]
-ExecStart=-/sbin/losetup /dev/loop0 /srv/disk0
+ExecStart=-/sbin/losetup /dev/loop${device_num} /srv/disk${device_num}
 RemainAfterExit=true
 Type=oneshot
 
 [Install]
 WantedBy=local-fs.target
 EOF
-        systemctl enable setup-loopback-loop0
-        systemctl start setup-loopback-loop0
-        #adding short sleep to give time for service to start
-        sleep 3
-        pvcreate /dev/loop0
-        vgcreate nova-vol /dev/loop0
+            systemctl enable setup-loopback-loop${device_num}
+            systemctl start setup-loopback-loop${device_num}
+            #adding short sleep to give time for service to start
+            sleep 3
+            pvcreate /dev/loop${device_num}
+            vgcreate ${vg_name} /dev/loop${device_num}
+        fi
+    }
+
+    if [[ "${LVM_LOOP_DEVICE_SIZE}" -gt 0 ]]; then
+        _setup_lvm 0 ${LVM_LOOP_DEVICE_SIZE} nova-vol
     fi
+    if [[ "${CINDER_LVM_LOOP_DEVICE_SIZE}" -gt 0 ]]; then
+        _setup_lvm 1 ${CINDER_LVM_LOOP_DEVICE_SIZE} cinder-vol
+    fi
+
 }
 
 function install_docker {
@@ -947,9 +963,7 @@
             configure_contrack
             disable_iptables_for_bridges
             collect_interfaces_metadata
-            if [[ "${LVM_LOOP_DEVICE_SIZE}" -gt 0 ]]; then
-                configure_lvm
-            fi
+            configure_lvm
             ;;
         spare)
             prepare_metadata_files
diff --git a/de/heat-templates/top.yaml b/de/heat-templates/top.yaml
index ccf3407..99e8d5d 100644
--- a/de/heat-templates/top.yaml
+++ b/de/heat-templates/top.yaml
@@ -298,11 +298,21 @@
       The size of loop device for computes to configure LVM on, in gigabytes
     type: number
     default: 50
+  cmp_cinder_lvm_loop_device_size:
+    description: >
+      The size of loop device for computes to configure LVM on, in gigabytes
+    type: number
+    default: 0
   acmp_lvm_loop_device_size:
     description: >
       The size of loop device for advanced computes to configure LVM on, in gigabytes
     type: number
     default: 0
+  acmp_cinder_lvm_loop_device_size:
+    description: >
+      The size of loop device for advanced computes to configure LVM on, in gigabytes
+    type: number
+    default: 0
 
 conditions:
   aio_deploy:
@@ -470,6 +480,7 @@
           tun_subnet_id: { get_attr: [tun_network, tun_subnet_id] }
           hardware_metadata: { get_param: hardware_metadata}
           lvm_loop_device_size: { get_param: cmp_lvm_loop_device_size }
+          cinder_lvm_loop_device_size: { get_param: cmp_cinder_lvm_loop_device_size }
 
   cmps:
     type: OS::Heat::ResourceGroup
@@ -517,6 +528,7 @@
           tun_subnet_id: { get_attr: [tun_network, tun_subnet_id] }
           hardware_metadata: { get_param: hardware_metadata}
           lvm_loop_device_size: { get_param: cmp_lvm_loop_device_size }
+          cinder_lvm_loop_device_size: { get_param: cmp_cinder_lvm_loop_device_size }
 
   acmps:
     type: OS::Heat::ResourceGroup
@@ -565,6 +577,7 @@
           hardware_metadata: { get_param: hardware_metadata}
           huge_pages: { get_param: huge_pages }
           lvm_loop_device_size: { get_param: acmp_lvm_loop_device_size }
+          cinder_lvm_loop_device_size: { get_param: acmp_cinder_lvm_loop_device_size }
 
   gtws:
     type: OS::Heat::ResourceGroup