From d068a40fe82515c3051d4eabe7d1b2facd517abe Mon Sep 17 00:00:00 2001 From: Edison Su Date: Mon, 17 Sep 2012 11:27:38 -0700 Subject: [PATCH] t-templateid-to-bypass-db-access-during-cloud-instal --- .../storage/secondary/cloud-install-sys-tmplt | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/scripts/storage/secondary/cloud-install-sys-tmplt b/scripts/storage/secondary/cloud-install-sys-tmplt index 188896e28f9..63a04d8cb07 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 ]