Skip to content

Commit d068a40

Browse files
committed
t-templateid-to-bypass-db-access-during-cloud-instal
1 parent 16c1fd9 commit d068a40

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

scripts/storage/secondary/cloud-install-sys-tmplt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ failed() {
3333
mflag=
3434
fflag=
3535
ext="vhd"
36-
templateId=1
36+
templateId=
3737
hyper=
3838
msKey=password
3939
DISKSPACE=5120000 #free disk space required in kilobytes
@@ -143,21 +143,24 @@ else
143143
fi
144144
fi
145145

146-
if [ "$hyper" == "kvm" ]
146+
if [ "$templateId" == "" ]
147147
then
148-
ext="qcow2"
149-
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"`)
150-
elif [ "$hyper" == "xenserver" ]
151-
then
152-
ext="vhd"
153-
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"`)
154-
elif [ "$hyper" == "vmware" ]
155-
then
156-
ext="ova"
157-
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"`)
158-
else
159-
usage
160-
failed 2
148+
if [ "$hyper" == "kvm" ]
149+
then
150+
ext="qcow2"
151+
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"`)
152+
elif [ "$hyper" == "xenserver" ]
153+
then
154+
ext="vhd"
155+
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"`)
156+
elif [ "$hyper" == "vmware" ]
157+
then
158+
ext="ova"
159+
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"`)
160+
else
161+
usage
162+
failed 2
163+
fi
161164
fi
162165

163166
if [ ! $templateId ]

0 commit comments

Comments
 (0)