t-templateid-to-bypass-db-access-during-cloud-instal

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

Branch: refs/heads/javelin
Commit: d068a40fe82515c3051d4eabe7d1b2facd517abe
Parents: 16c1fd9
Author: Edison Su <sudi...@gmail.com>
Authored: Mon Sep 17 11:27:38 2012 -0700
Committer: Edison Su <sudi...@gmail.com>
Committed: Mon Sep 17 11:27:38 2012 -0700

----------------------------------------------------------------------
 scripts/storage/secondary/cloud-install-sys-tmplt |   33 ++++++++-------
 1 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d068a40f/scripts/storage/secondary/cloud-install-sys-tmplt
----------------------------------------------------------------------
diff --git a/scripts/storage/secondary/cloud-install-sys-tmplt 
b/scripts/storage/secondary/cloud-install-sys-tmplt
index 188896e..63a04d8 100755
--- a/scripts/storage/secondary/cloud-install-sys-tmplt
+++ b/scripts/storage/secondary/cloud-install-sys-tmplt
@@ -33,7 +33,7 @@ failed() {
 mflag=
 fflag=
 ext="vhd"
-templateId=1
+templateId=
 hyper=
 msKey=password
 DISKSPACE=5120000  #free disk space required in kilobytes
@@ -143,21 +143,24 @@ else
     fi
 fi
 
-if [ "$hyper" == "kvm" ]
+if [ "$templateId" == "" ]
 then
-   ext="qcow2"
-   templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword 
--skip-column-names -U cloud -e "select max(id) from cloud.vm_template where 
type = \"SYSTEM\" and hypervisor_type = \"KVM\" and removed is null"`)
-elif [ "$hyper" == "xenserver" ]
-then
-   ext="vhd"
-   templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword 
--skip-column-names -U cloud -e "select max(id) from cloud.vm_template where 
type = \"SYSTEM\" and hypervisor_type = \"XenServer\" and removed is null"`)
-elif [ "$hyper" == "vmware" ]
-then
-   ext="ova"
-   templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword 
--skip-column-names -U cloud -e "select max(id) from cloud.vm_template where 
type = \"SYSTEM\" and hypervisor_type = \"VMware\" and removed is null"`)
-else
-   usage
-   failed 2
+   if [ "$hyper" == "kvm" ]
+   then
+      ext="qcow2"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword 
--skip-column-names -U cloud -e "select max(id) from cloud.vm_template where 
type = \"SYSTEM\" and hypervisor_type = \"KVM\" and removed is null"`)
+   elif [ "$hyper" == "xenserver" ]
+   then
+      ext="vhd"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword 
--skip-column-names -U cloud -e "select max(id) from cloud.vm_template where 
type = \"SYSTEM\" and hypervisor_type = \"XenServer\" and removed is null"`)
+   elif [ "$hyper" == "vmware" ]
+   then
+      ext="ova"
+      templateId=(`mysql -h $dbHost --user=$dbUser --password=$dbPassword 
--skip-column-names -U cloud -e "select max(id) from cloud.vm_template where 
type = \"SYSTEM\" and hypervisor_type = \"VMware\" and removed is null"`)
+   else
+      usage
+      failed 2
+   fi
 fi
 
 if [ ! $templateId ]

Reply via email to