From 1f5b951c1de5bad93c505995ed77686ea3a8e57f Mon Sep 17 00:00:00 2001 From: Dheeraj Gautam Date: Thu, 12 Feb 2015 06:52:15 -0800 Subject: [PATCH] SM-Storage: Added support for one provisioning of storage via puppet Closes-bug: #1420901 1. Exit when compute has not been computed and storage is started 2. Exit when mount failed for livemnfs 3. Added support for storage status of start/completion. Change-Id: I933d21d818c73814e78f368f05d50ec46086fcd2 --- .../files/config-storage-lm-compute.sh | 9 ++++++++ .../contrail/manifests/lib/storage_common.pp | 6 +++++- .../modules/contrail/manifests/storage.pp | 21 +++++++++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/contrail/environment/modules/contrail/files/config-storage-lm-compute.sh b/contrail/environment/modules/contrail/files/config-storage-lm-compute.sh index e556c7a0..83db29f9 100644 --- a/contrail/environment/modules/contrail/files/config-storage-lm-compute.sh +++ b/contrail/environment/modules/contrail/files/config-storage-lm-compute.sh @@ -183,4 +183,13 @@ if [ $RETVAL -eq 0 ] then echo "ping done" mount 192.168.101.3:/livemnfsvol /var/lib/nova/instances/global + RETVAL=$? + if [ ${RETVAL} -ne 0 ] + then + echo "mount to livemnfsvol failed" + exit ${RETVAL} + fi +else + echo "ping to livemnfs failed" + exit 1 fi diff --git a/contrail/environment/modules/contrail/manifests/lib/storage_common.pp b/contrail/environment/modules/contrail/manifests/lib/storage_common.pp index 8260906f..06f0e0ec 100755 --- a/contrail/environment/modules/contrail/manifests/lib/storage_common.pp +++ b/contrail/environment/modules/contrail/manifests/lib/storage_common.pp @@ -16,6 +16,8 @@ $contrail_storage_cluster_network ) { + contrail::lib::report_status { "storage_started": state => "storage_started" } + -> package { 'contrail-storage-packages' : ensure => present, } -> package { 'contrail-storage' : ensure => present, } @@ -125,6 +127,7 @@ pg_num => $contrail_ceph_pg_num, pgp_num => $contrail_ceph_pg_num, } + Ceph::Pool['images'] -> Contrail::Lib::Report_status['storage_completed'] } if 'openstack' in $contrail_host_roles { #notify { "role openstack":} @@ -263,5 +266,6 @@ hasstatus => 'true', require => Exec['ceph-virsh-secret'], subscribe => File['/etc/ceph/virsh.conf'], - } + } -> + contrail::lib::report_status { "storage_completed": state => "storage_completed" } } diff --git a/contrail/environment/modules/contrail/manifests/storage.pp b/contrail/environment/modules/contrail/manifests/storage.pp index 4eb4e80e..f0945b7b 100644 --- a/contrail/environment/modules/contrail/manifests/storage.pp +++ b/contrail/environment/modules/contrail/manifests/storage.pp @@ -20,7 +20,7 @@ # Main resource declarations for the class #notify { "disk-names => $contrail_storage_osd_disks" :;} if 'compute' in $contrail_host_roles { - if $contrail_interface_rename_done == 2 { + if ($contrail_interface_rename_done == 2) { contrail::lib::storage_common { 'storage-compute': contrail_storage_fsid => $contrail_storage_fsid, contrail_openstack_ip => $contrail_openstack_ip, @@ -36,9 +36,22 @@ contrail_storage_hostname => $contrail_storage_hostname, contrail_live_migration_host => $contrail_live_migration_host, contrail_lm_storage_scope => $contrail_lm_storage_scope, - contrail_storage_cluster_network => $contrail_storage_cluster_network - } - } + contrail_storage_cluster_network => $contrail_storage_cluster_network } + } else { + file { "contrail-storage-exit-file": + path => "/etc/contrail/contrail_setup_utils/config-storage-exit.sh", + ensure => present, + mode => 0755, + owner => root, + group => root, + content => "exit 1", + } + -> + exec { "contrail-storage-exit" : + command => "/etc/contrail/contrail_setup_utils/config-storage-exit.sh", + provider => shell, + } + } } else { contrail::lib::storage_common { 'storage-master': contrail_storage_fsid => $contrail_storage_fsid,