You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2019/05/22 08:01:45 UTC

[GitHub] [cloudstack] ustcweizhou commented on a change in pull request #3346: Fix template size for managed storage / refactor cloud-install-sys-tmplt and createtmplt.sh

ustcweizhou commented on a change in pull request #3346: Fix template size for managed storage / refactor cloud-install-sys-tmplt and createtmplt.sh
URL: https://github.com/apache/cloudstack/pull/3346#discussion_r286350608
 
 

 ##########
 File path: scripts/storage/secondary/cloud-install-sys-tmplt
 ##########
 @@ -250,51 +232,49 @@ destcap=$(df -P $destdir | awk '{print $4}' | tail -1 )
 localcap=$(df -P $(dirname $0) | awk '{print $4}' | tail -1 )
 [ $localcap -lt $DISKSPACE ] && echo "Insufficient free disk space for local temporary folder $(dirname $0): avail=${localcap}k req=${DISKSPACE}k" && failed 4
 
-if [ "$uflag" == "1" ]
-then
-  wget -O $tmpfile $url
-  if [ $? -ne 0 ]
-  then
-    echo "Failed to fetch system vm template from $url"
-    failed 5
+if [[ "$uflag" == "1" ]]; then
+  wget -O $tmplfile $url
+  if [[ $? -ne 0 ]]; then
+    failed 2 "Failed to fetch system vm template from $url"
   fi
 fi
 
-
-if [ "$fflag" == "1" ]
-then
-  cp $tmpltimg $tmpfile
-  if [ $? -ne 0 ]
-  then
-    printf "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
-    failed 6
+if [[ "$fflag" == "1" ]]; then
+  cp $tmpltimg $tmplfile
+  if [[ $? -ne 0 ]]; then
+    failed 2 "Failed to create temporary file in directory $(dirname $0) -- is it read-only or full?\n"
   fi
 fi
 
+installrslt=$($(dirname $0)/createtmplt.sh -n $localfile -t $destdir -f $tmplfile)
 
-installrslt=$($(dirname $0)/createtmplt.sh -s 2 -d 'SystemVM Template' -n $localfile -t $destdir/ -f $tmpfile -u -v)
-
-if [ $? -ne 0 ]
-then
-  echo "Failed to install system vm template $tmpltimg to $destdir: $installrslt"
-  failed 7
+if [[ $? -ne 0 ]]; then
+  failed 2 "Failed to install system vm template $tmpltimg to $destdir: $installrslt"
 fi
 
-if [ "$ext" == "ova" ]
-then
-  tar xvf $destdir/$localfile -C $destdir &> /dev/null
+if [[ $(which qemu-img) ]]; then
+  qemuimgcmd=$(which qemu-img)
+else
+  failed 2 "Please install qemu-img command"
 
 Review comment:
   It is nice to return with more details here
   on centos, qemu-img can be installed by "yum install qemu-img"
   on ubuntu/debian, qemu-img can be installed by "apt-get install qemu-utils"
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services