Skip to content

Commit 469d9eb

Browse files
PinkOrangutanabhinandanprateek
authored andcommitted
CLOUDSTACK-8624: Added the support for mysql db port and lowered the requiremnts for available disk capacity to 2.1GB VS original 5GB as it was too excessive.
1 parent b0136c5 commit 469d9eb

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
usage() {
23-
printf "Usage: %s: -m <secondary storage mount point> -f <system vm template file> [-h <hypervisor name: kvm|vmware|xenserver|hyperv|ovm3> ] [ -s <mgmt server secret key, if you specified any when running cloudstack-setup-database, default is password>][-u <Url to system vm template>] [-F <clean up system templates of specified hypervisor>] [-e <Template suffix, e.g vhd, ova, qcow2>] [-o <Database server hostname or ip, e.g localhost>] [-r <Database user name, e.g root>] [-d <Database password. Fllowed by nothing if the password is empty>]\n" $(basename $0) >&2
23+
printf "Usage: %s: -m <secondary storage mount point> -f <system vm template file> [-h <hypervisor name: kvm|vmware|xenserver|hyperv|ovm3> ] [ -s <mgmt server secret key, if you specified any when running cloudstack-setup-database, default is password>][-u <Url to system vm template>] [-F <clean up system templates of specified hypervisor>] [-e <Template suffix, e.g vhd, ova, qcow2>] [-o <Database server hostname or ip, e.g localhost>] [-r <Database user name, e.g root>] [-p <mysql database port>] [-d <Database password. Fllowed by nothing if the password is empty>]\n" $(basename $0) >&2
2424
printf "or\n" >&2
2525
printf "%s: -m <secondary storage mount point> -u <http url for system vm template> [-h <hypervisor name: kvm|vmware|xenserver|hyperv|ovm3> ] [ -s <mgmt server secret key>]\n" $(basename $0) >&2
2626
}
@@ -36,12 +36,13 @@ ext="vhd"
3636
templateId=
3737
hyper=
3838
msKey=password
39-
DISKSPACE=5120000 #free disk space required in kilobytes
39+
DISKSPACE=2120000 #free disk space required in kilobytes
4040
dbHost=
4141
dbUser=
4242
dbPassword=
43+
dbPort=
4344
jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.2.jar'
44-
while getopts 'm:h:f:u:Ft:e:s:o:r:d:' OPTION
45+
while getopts 'm:h:f:u:Ft:e:s:o:r:d:p:'# OPTION
4546
do
4647
case $OPTION in
4748
m) mflag=1
@@ -72,6 +73,9 @@ do
7273
d) dflag=1
7374
dbPassword="$OPTARG"
7475
;;
76+
p) pflag=1
77+
dbPort="$OPTARG"
78+
;;
7579
?) usage
7680
failed 2
7781
;;
@@ -102,6 +106,9 @@ then
102106
failed 3
103107
fi
104108

109+
if [ "$pflag" != 1 ]; then
110+
dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
111+
fi
105112

106113
if [ "$oflag" != 1 ]; then
107114
dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
@@ -148,27 +155,27 @@ then
148155
if [ "$hyper" == "kvm" ]
149156
then
150157
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"`)
158+
templateId=(`mysql -P $dbPort -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"`)
152159
elif [ "$hyper" == "xenserver" ]
153160
then
154161
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"`)
162+
templateId=(`mysql -P $dbPort -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"`)
156163
elif [ "$hyper" == "vmware" ]
157164
then
158165
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"`)
166+
templateId=(`mysql -P $dbPort -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"`)
160167
elif [ "$hyper" == "lxc" ]
161168
then
162169
ext="qcow2"
163-
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 = \"LXC\" and removed is null"`)
170+
templateId=(`mysql -P $dbPort -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 = \"LXC\" and removed is null"`)
164171
elif [ "$hyper" == "hyperv" ]
165172
then
166173
ext="vhd"
167-
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 = \"Hyperv\" and removed is null"`)
174+
templateId=(`mysql -P $dbPort -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 = \"Hyperv\" and removed is null"`)
168175
elif [ "$hyper" == "ovm3" ]
169176
then
170177
ext="raw"
171-
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 = \"Ovm3\" and removed is null"`)
178+
templateId=(`mysql -P $dbPort -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 = \"Ovm3\" and removed is null"`)
172179
else
173180
usage
174181
failed 2

0 commit comments

Comments
 (0)