Repository: incubator-stratos
Updated Branches:
  refs/heads/master c9423db5d -> 9e3cf62ca


format the volume if it does not contain a file system + some log formating


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/be04ad16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/be04ad16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/be04ad16

Branch: refs/heads/master
Commit: be04ad1660b42a6cf2893ddf15fc0b207e178205
Parents: 5c2b5a0
Author: Udara Liyanage <[email protected]>
Authored: Wed Feb 19 01:22:49 2014 -0500
Committer: Udara Liyanage <[email protected]>
Committed: Wed Feb 19 01:24:50 2014 -0500

----------------------------------------------------------------------
 .../controller/topology/TopologyBuilder.java    |  2 +-
 .../src/main/extensions/mount_volumes.sh        | 31 +++++++++++++++-----
 2 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/be04ad16/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
index 0bc0b6c..5869800 100644
--- 
a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
+++ 
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java
@@ -325,7 +325,7 @@ public class TopologyBuilder {
         try {
             TopologyManager.acquireWriteLock();
             member.setStatus(MemberStatus.ReadyToShutDown);
-            log.info("member started event adding status started");
+            log.info("Member started event adding status started");
 
             TopologyManager.updateTopology(topology);
         } finally {

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/be04ad16/products/cartridge-agent/modules/distribution/src/main/extensions/mount_volumes.sh
----------------------------------------------------------------------
diff --git 
a/products/cartridge-agent/modules/distribution/src/main/extensions/mount_volumes.sh
 
b/products/cartridge-agent/modules/distribution/src/main/extensions/mount_volumes.sh
index 9f91a6b..db1ffc0 100755
--- 
a/products/cartridge-agent/modules/distribution/src/main/extensions/mount_volumes.sh
+++ 
b/products/cartridge-agent/modules/distribution/src/main/extensions/mount_volumes.sh
@@ -30,16 +30,33 @@ echo -e "Starting mounting volumes" | tee -a $log
 source $1
 
 function mount_volume(){
-       echo -e "Formating the device $1 \n"
-       sudo mkfs -t ext4 $1
 
-       echo "Mounting  the device $1 to the mount point $2 \n"
-       if [ -d "$DIRECTORY" ]; then
-               echo "creating the directory $2 since it does not exist."
-               mkdir $2        
+       device=$1;
+       mount_point=$2;
+
+       # check if the volume has a file system
+       output=`sudo file -s $device`;
+       echo $output | tee -a $log
+
+       # this is the pattern of the output of file -s if the volume does not 
have a file system
+       # refer to 
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
+       pattern="$device: data"
+
+       if [[ $output ==  $pattern ]]
+       then
+               echo -e "Volume is not formatted. So formating the device 
$device \n" | tee -a $log
+               sudo mkfs -t ext4 $device
+       fi
+
+
+
+       echo "Mounting  the device $device to the mount point $mount_point \n" 
| tee -a $log
+       if [ ! -d "$DIRECTORY" ]; then
+               echo "creating the directory $mount_point since it does not 
exist." | tee -a $log
+               mkdir $mount_point
        fi
 
-       sudo mount $1 $2
+       sudo mount $device $mount_point
 }
 
 IFS='|' read -ra ADDR <<< "$PERSISTANCE_MAPPING"

Reply via email to