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.

This commit is contained in:
Ilya Musayev 2015-07-10 06:57:53 +05:30 committed by Abhinandan Prateek
parent b0136c56e7
commit 469d9ebed4

View File

@ -20,7 +20,7 @@
usage() { usage() {
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 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
printf "or\n" >&2 printf "or\n" >&2
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 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
} }
@ -36,12 +36,13 @@ ext="vhd"
templateId= templateId=
hyper= hyper=
msKey=password msKey=password
DISKSPACE=5120000 #free disk space required in kilobytes DISKSPACE=2120000 #free disk space required in kilobytes
dbHost= dbHost=
dbUser= dbUser=
dbPassword= dbPassword=
dbPort=
jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.2.jar' jasypt='/usr/share/cloudstack-common/lib/jasypt-1.9.2.jar'
while getopts 'm:h:f:u:Ft:e:s:o:r:d:' OPTION while getopts 'm:h:f:u:Ft:e:s:o:r:d:p:'# OPTION
do do
case $OPTION in case $OPTION in
m) mflag=1 m) mflag=1
@ -72,6 +73,9 @@ do
d) dflag=1 d) dflag=1
dbPassword="$OPTARG" dbPassword="$OPTARG"
;; ;;
p) pflag=1
dbPort="$OPTARG"
;;
?) usage ?) usage
failed 2 failed 2
;; ;;
@ -102,6 +106,9 @@ then
failed 3 failed 3
fi fi
if [ "$pflag" != 1 ]; then
dbPort=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.port' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
fi
if [ "$oflag" != 1 ]; then if [ "$oflag" != 1 ]; then
dbHost=$(sed '/^\#/d' /etc/cloudstack/management/db.properties | grep 'db.cloud.host' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//') 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
if [ "$hyper" == "kvm" ] if [ "$hyper" == "kvm" ]
then then
ext="qcow2" 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"`) 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"`)
elif [ "$hyper" == "xenserver" ] elif [ "$hyper" == "xenserver" ]
then then
ext="vhd" 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"`) 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"`)
elif [ "$hyper" == "vmware" ] elif [ "$hyper" == "vmware" ]
then then
ext="ova" 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"`) 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"`)
elif [ "$hyper" == "lxc" ] elif [ "$hyper" == "lxc" ]
then then
ext="qcow2" 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 = \"LXC\" and removed is null"`) 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"`)
elif [ "$hyper" == "hyperv" ] elif [ "$hyper" == "hyperv" ]
then then
ext="vhd" 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 = \"Hyperv\" and removed is null"`) 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"`)
elif [ "$hyper" == "ovm3" ] elif [ "$hyper" == "ovm3" ]
then then
ext="raw" ext="raw"
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"`) 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"`)
else else
usage usage
failed 2 failed 2