CLOUDSTACK-6360: Fix JDK paths in ubuntu packaging init scripts, don't use 1.6

Since we've agreed to use JDK/JRE 1.7, this enforces that for Ubuntu builds
- this fix remove usage of 1.6 paths in JDK_DIR for cloud-{agent, management, usage}.
- adds oracle jdk 1.7 path (in case a user is using that)
- adds mysql-connector-java path to CLASSPATH for usage server
- adds libmysql-java pkg dependency (tested and available for precise and trusty)

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 96d6a2a03734ebbb9f41196d56c409d544a268ea)

Conflicts:
	packaging/debian/init/cloud-usage
Adds pessimistic logic to try the hard coded paths if Rajani's logic fails
ListStorageTagsCmd: Seif forgot to add license in 67ca255

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
CLOUDSTACK-7292: Fixed issue in test_deploy_vm_root_resize.py

Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
appliance: change the way we find git branch in build.sh

(cherry picked from commit 493c0a68d2332cb9275902128c28f926a909f4ed)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	tools/appliance/build.sh
git: don't let db-police hook fail for no changes in setup/db

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
CLOUDSTACK-7264:NPE while creating scheduled/recurring snapshots for the
removed account with cleanup_needed=1.
appliance: use the right way to get git branch name

Taken from Junio C Hamano's blog [1], git's maintainer, he must not be wrong :)

[1] http://git-blame.blogspot.ch/2013/06/checking-current-branch-programatically.html

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit e16414e56d8f398f8ddbbde89d3ee833582b8bb2)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
CLOUDSTACK-6695: Added support to the UI for uploading a chain of certificates

In the "SSL Certificate" dialog we added:
- new field for the root certificate;
- a button to add intermediate certificates if necessary; when this is pressed, a new field, called "Intermediate certificate 1" is added; pressed again, "Intermediate certificate 2" field is added, and so on.

We upload the certificates in order: first the root certificate (with id=1), then the intermediate certificates (with id=2,3,..) and finally the server certificate.
When uploading a certificate, we wait for the upload to be completed successfully and only then we proceed to uploading the next one. If one fails, we report failure and don't continue with the remaining.

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
appliance: fix branch finding method from e16414e even Junio can be wrong

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit bbaefb8e5def610a654fba907c8ec3f868416bdf)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
appliance: box commands for dumb bash in cleaning branch name, in build.sh

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit edb5650c737d582595e134aab286e7304f299983)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
UI > Infrastructure > Add Primary Storage > use custom function if it's available.
CLOUDSTACK-6486: Guest network guru - when add network, validate isolation method in case insensitive manner
Fixed few coverity issues
Fixed few coverity reported issues around concurrency, null checks
Fixed few coverity issues reported
    Fixed CLOUDSTACK-7303 [LDAP] while importing ldap users, update the user info if it already exists in cloudstack
CLOUDSTACK-7283: listUsers - for regular user, only return the caller info. If there are more users under the same account, their information should never be returned
CLOUDSTACK-7295: VMs is Stopped state have no host ID, resulting in NPE
CLOUDSTACK-7312:ISOs cannot be downloaded from URLs without matching
file extensions.
CLOUDSTACK: Test script to verify fix for CS-5332

Signed-off-by: sanjeev <sanjeev@apache.org>
Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>