You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2014/06/05 16:01:09 UTC

[1/2] git commit: enhancing mount_volume.sh script to pick the correct device when volumes are mapped to other devices

Repository: stratos
Updated Branches:
  refs/heads/master eb8e0363e -> 3a767ef56


enhancing mount_volume.sh script to pick the correct device when volumes are mapped to other devices


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

Branch: refs/heads/master
Commit: d9921963d68ee820bffa0032b0f20c93dead4107
Parents: 4339b62
Author: Udara Liyanage <ud...@wso2.com>
Authored: Thu Jun 5 18:20:08 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Thu Jun 5 18:20:08 2014 +0530

----------------------------------------------------------------------
 .../src/main/extensions/mount_volumes.sh        | 55 +++++++++++++++++---
 1 file changed, 49 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d9921963/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 3974910..63e303f 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
@@ -37,28 +37,28 @@ mount_volume(){
 
         device=$1;
         mount_point=$2;
-	echo -e "device $device" | tee -a $log
+    echo -e "device $device" | tee -a $log
         echo -e "mount point  $mount_point"| tee -a $log
 
 
         if [  "$mount_point" = "null" ]
         then
               echo -e "[ERROR] Mount point can not be null" | tee -a $log
-	      return
+          return
         fi
 
         if [  "$device" = "null" ]
         then
               echo -e "[ERROR] Device can not be null" | tee -a $log
-	      return
+          return
         fi
 
         device_exist=`sudo fdisk -l $device`;
         if [ "$device_exist" = "" ]
         then
               echo -e "[ERROR] Device $device does not exist in this instance." | tee -a $log
-	      return
-	fi
+          return
+    fi
 
         # check if the volume has a file system
         output=`sudo file -s $device`;
@@ -102,14 +102,57 @@ echo -e "\n$output\n" | tee -a $log
 output=`/sbin/blkid`
 echo -e "\n$output\n" | tee -a $log
 
+totalcount=0
 for i in "${!ADDR[@]}"; do
         # expected PERSISTANCE_MAPPING format is device1|volumeID1|mountPoint1|device2|volumeID2|mountpoint2...
         if (( $i  % 3 == 0 ))
         then
-           mount_volume ${ADDR[$i]} ${ADDR[$i + 2]}
+           devicelist[$totalcount]=${ADDR[$i]}
+           mountpathlist[$totalcount]=${ADDR[$i + 2]}
+           totalcount=$((totalcount+1))
+           lastdevice=${ADDR[$i]}
         fi
 done
 
+
+device_exist=`sudo fdisk -l $lastdevice`;
+if [ "$device_exist" = "" ]
+then
+# Last device doesn't exist, which means devices are not attached as per the order given in the payload
+# So start mounting from the last available device and come down
+    devlist=`sudo lsblk -n | cut -f 1 -d " "`
+    devcount=`echo ${devlist} | awk '{print NF}'`
+    totalcount=$((totalcount-1))
+        counter=0
+    for ((i=${devcount}-1; totalcount>=0; i--)); do
+        devnum=`expr ${devcount} - ${counter}`
+        currdevice=`echo ${devlist} | cut -d " " -f ${devnum}`
+        fileout=`sudo file -s /dev/${currdevice}`
+        if [[ $fileout == *ROM* ]] || [[ $fileout == *boot* ]] || [[ $fileout == *cloud* ]] || [[ $fileout == *not-regular* ]] || [[ $fileout == *empty* ]] || [[ $fileout == *swap* ]]
+        then
+            # Ignore special files as checked above...
+            counter=`expr ${counter} + 1`
+            continue
+        fi
+        mountpath=${mountpathlist[$totalcount]}
+        totalcount=$((totalcount-1))
+        echo "device is $currdevice"
+        echo "mount path is $mountpath"
+        counter=`expr ${counter} + 1`
+        mount_volume "/dev/${currdevice}" ${mountpath}
+    done
+else
+# Last device exists, which means the volumes are created or few might have been skipped in the first part since the device is already present
+# Mount of rest of the volumes will be fine and contine
+    for i in "${!ADDR[@]}"; do
+        # expected PERSISTANCE_MAPPING format is device1|volumeID1|mountPoint1|device2|volumeID2|mountpoint2...
+        if (( $i  % 3 == 0 ))
+        then
+           mount_volume ${ADDR[$i]} ${ADDR[$i + 2]}
+        fi
+    done
+fi
+
 echo -e "\n Volumes after mounting...." | tee -a $log
 output=`/bin/lsblk`
 echo -e "\n$output\n" | tee -a $log


[2/2] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/stratos

Posted by ud...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/stratos


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

Branch: refs/heads/master
Commit: 3a767ef5655ba19a751358e65030239893341a13
Parents: d992196 eb8e036
Author: Udara Liyanage <ud...@wso2.com>
Authored: Thu Jun 5 19:30:45 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Thu Jun 5 19:30:45 2014 +0530

----------------------------------------------------------------------
 .../cloud/controller/iaases/DockerIaas.java     | 152 ++++++
 .../validate/DockerPartitionValidator.java      |  49 ++
 .../jclouds/apis/docker/1.7.1-stratos/README.md |  52 +++
 .../jclouds/apis/docker/1.7.1-stratos/pom.xml   | 145 ++++++
 .../main/java/org/jclouds/docker/DockerApi.java |  38 ++
 .../org/jclouds/docker/DockerApiMetadata.java   | 100 ++++
 .../binders/BindInputStreamToRequest.java       |  74 +++
 .../DockerComputeServiceContextModule.java      |  73 +++
 .../extensions/DockerImageExtension.java        | 120 +++++
 .../docker/compute/features/RemoteApi.java      | 275 +++++++++++
 .../compute/features/internal/Archives.java     |  96 ++++
 .../functions/ContainerToNodeMetadata.java      | 131 ++++++
 .../docker/compute/functions/ImageToImage.java  | 104 +++++
 .../docker/compute/functions/StateToStatus.java |  40 ++
 .../compute/options/DockerTemplateOptions.java  | 365 +++++++++++++++
 .../strategy/DockerComputeServiceAdapter.java   | 223 +++++++++
 .../docker/config/DockerHttpApiModule.java      |  42 ++
 .../docker/config/DockerParserModule.java       | 101 ++++
 .../jclouds/docker/config/DockerProperties.java |  29 ++
 .../java/org/jclouds/docker/domain/Config.java  | 460 +++++++++++++++++++
 .../org/jclouds/docker/domain/Container.java    | 372 +++++++++++++++
 .../org/jclouds/docker/domain/ExposedPorts.java | 105 +++++
 .../org/jclouds/docker/domain/HostConfig.java   | 180 ++++++++
 .../java/org/jclouds/docker/domain/Image.java   | 240 ++++++++++
 .../jclouds/docker/domain/NetworkSettings.java  | 176 +++++++
 .../java/org/jclouds/docker/domain/Port.java    |  91 ++++
 .../java/org/jclouds/docker/domain/State.java   | 169 +++++++
 .../java/org/jclouds/docker/domain/Version.java | 169 +++++++
 .../docker/handlers/DockerErrorHandler.java     | 108 +++++
 .../jclouds/docker/options/BuildOptions.java    |  73 +++
 .../jclouds/docker/options/CommitOptions.java   | 111 +++++
 .../docker/options/CreateImageOptions.java      | 129 ++++++
 .../docker/options/DeleteImageOptions.java      |  46 ++
 .../docker/options/ListContainerOptions.java    |  97 ++++
 .../docker/options/ListImageOptions.java        |  43 ++
 .../docker/options/RemoveContainerOptions.java  |  57 +++
 .../services/org.jclouds.apis.ApiMetadata       |   1 +
 .../src/main/resources/centos/Dockerfile        |  29 ++
 .../src/main/resources/ubuntu/Dockerfile        |  30 ++
 .../jclouds/docker/DockerApiMetadataTest.java   |  49 ++
 .../docker/compute/BaseDockerApiLiveTest.java   |  96 ++++
 .../DockerComputeServiceAdapterLiveTest.java    | 138 ++++++
 .../compute/DockerExperimentLiveTest.java       | 144 ++++++
 .../compute/features/RemoteApiLiveTest.java     | 136 ++++++
 .../compute/features/RemoteApiMockTest.java     | 358 +++++++++++++++
 .../functions/ContainerToNodeMetadataTest.java  | 162 +++++++
 .../compute/functions/ImageToImageTest.java     |  75 +++
 .../compute/functions/StateToStatusTest.java    |  83 ++++
 .../docker/config/DockerParserModuleTest.java   | 102 ++++
 .../docker/internal/BaseDockerMockTest.java     | 119 +++++
 .../1.7.1-stratos/src/test/resources/Dockerfile |  29 ++
 .../src/test/resources/container-creation.json  |   1 +
 .../src/test/resources/container.json           |  87 ++++
 .../src/test/resources/containers.json          |  20 +
 .../src/test/resources/logback.xml              |  34 ++
 dependencies/pom.xml                            |   1 +
 .../pom.xml                                     |  13 +-
 .../main/resources/conf/cloud-controller.xml    |  10 +-
 .../distribution/src/main/conf/autoscaler.xml   |   6 +-
 .../src/main/conf/cartridge-config.properties   |   4 +-
 60 files changed, 6554 insertions(+), 8 deletions(-)
----------------------------------------------------------------------