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/3c11ad70 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/3c11ad70 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/3c11ad70 Branch: refs/heads/4.0 Commit: 3c11ad703510e57771f783308e733742c851164c Parents: 74086a0 Author: Edison Su <[email protected]> Authored: Mon Sep 17 11:27:38 2012 -0700 Committer: Edison Su <[email protected]> Committed: Tue Sep 18 15:47:08 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/3c11ad70/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 ]
