Migration away from download.cloud.com to download.cloudstack.org may cause problems in exisiting cloudstack installations and versions

,

Background

Cloudstack relies on a fixed download site when it fetches the built-in guest VM templates.
That download site has historically been download.cloud.com and is being replaced by download.cloudstack.org.

Download.cloudstack.org is now fully functional. The retirement date of download.cloud.com is unknown but expected to be imminent

The issue & behaviour

After the retirement of download.cloud.com, the following issues may be experienced:

  • When installing CloudStack for the first time, failures will occur when downloading the built-in templates
  • For existing installations of CloudStack, if administrators or users attempt to re-download a template (for example when creating a new zone) failures will occur.

Versions affected

This issue affects Apache CloudStack version 4.9.2 and ALL PRIOR VERSIONS

CloudStack 4.10, due for release imminently, is NOT affected by this issue. Future versions should not be affected by this issue.

Resolution

The following steps will update an existing CloudStack installation to use the new download site. This process should also be followed (in advance of installation) when attempting to install a new instance of CloudStack for affected versions.

1. List the URLs to update
Locate the ‘cloud’ database and run this SQL command against it, replacing <user-id> and <your password>
NOTE: this requires having the MySQL client installed on the location that you are running the command from.

$ echo "SELECT id,url FROM vm_template WHERE url LIKE '%download.cloud.com%' AND NOT removed IS NULL\g" | mysql -h <cloud db server ip or hostname> -u <user-id> -p<your password> cloud

This will return all URLs that CloudStack uses for downloads that are pointing to download.cloud.com

A number of rows should be returned. The following is a sample output

id  url

11  http://download.cloud.com/templates/builtin/centos-7-x86_64.tar.gz

13  http://download.cloud.com/templates/4.2/systemvmtemplate-4.2-vh7.ova

If no rows are  returned you are not affected by this issue; you need to do nothing further. If rows are returned, proceed to step 2

2. Check that ALL templates are present on the new download site.

All templates that were previously located at download.cloud.com should be in an identical location at download.cloudstack.org. However, we advise that you confirm this  by to attempting to manually  download all of  the templates from the same directory at downloads.cloudstack.org

To do this, take every result returned at step 1 and attempt to manually  download them from the same location at downloads.cloudstack.org

Taking the above examples check that you are able to  download:
http://download.cloudstack.org/templates/builtin/centos-7-x86_64.tar.gz

http://download.cloudstack.org/templates/4.2/systemvmtemplate-4.2-vh7.ova

(the files don’t actually need to be downloaded at this stage, you are just checking for their existence)

If all templates are present, then continue to step 3. If any are missing (you will receive a 404 error), then contact users@cloudstack.org or your support provider

3. Update the URLs in the vm_template table

WARNING – Extreme care must always be taken when directly manipulating the database.  Ensure that you have a very recent backup.
Update any URL’s that point to download.cloud.com. This can be performed by running:

$ echo "UPDATE vm_template SET url = REPLACE(url, 'http://download.cloud.com', 'http://download.cloudstack.org') WHERE INSTR(url, "http://download.cloud.com") > 0 AND removed IS NULL;" | mysql -h <cloud db server ip or hostname> -u <user-id> -p<your password> cloud

4. Double check the update

Running the following command should return the same IDs as before, but with the new download location

$ echo "SELECT id,url FROM vm_template WHERE url LIKE '%download.cloudstack.org%' AND NOT removed IS NULL\g" | mysql -h <cloud db server ip or hostname> -u <user-id> -p<your password> cloud