Seed CloudStack Templates Offline

Not all clouds require or have Internet access. As a security policy, the guest instances could have public Internet access but the CloudStack management network itself has no access. Having basic Internet access would make it a lot easier to populate the built-in SSVM and CentOS templates during the build phase but its not an absolute must.

To seed the System VM templates manually:

  1. Download the appropriate templates for Xen, KVM or VMWare from from a host which has Internet access. See Prepare the System VM Template section from the CloudStack Install guide for the download URLs
  2. scp the templates over to the CloudStack management server under the /tmp/ folder
  3. Ensure that all secondary storage shares are mounted on the management server
  4. Install the template by running the /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt along with the -f option as below:
    /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt \
    -m /mnt/cs-sec1 -f /tmp/acton-systemvm-02062012.vhd.bz2 -h xenserver -F

To seed the default CentOS templates:

  1. Download the appropriate CentOS templates from make it available on a local HTTP server. The local HTTP server has to be reachable from the SSVM instances. The download URLs can be extracted from the the management database cloud using the following SQL query:
    mysql> select url from vm_template;
    | url                                                                                      |
    |                |
    | |
    |              |
    |  |
    |                              |
    |                            |
    |                |
    |                |
    | NULL                                                                                     |
    | NULL                                                                                     |
    10 rows in set (0.00 sec)
  2. Ensure that the network subnet for the local HTTP server is white listed via the CloudStack global setting secstorage.allowed.internal.sites
    cloudmonkey api updateConfiguration name=secstorage.allowed.internal.sites value=
  3. Update the url column in the vm_template table to point to the local HTTP server. Preferably, use IP addresses in case you dont have local DNS resolution.
    mysql> UPDATE vm_template SET url='' where id=5;
    Query OK, 0 rows affected (0.01 sec)
    Rows matched: 1  Changed: 0  Warnings: 0
    mysql> select url from vm_template where id=5;
    | url                                                   |
    | |
    1 row in set (0.00 sec)
  4. Reboot SSVM instances and tail the management server logs for progress. The template should start downloading shortly
    2013-09-01 15:37:57,095 DEBUG [agent.transport.Request] (AgentConnectTaskPool-6:null)
    Seq 3-1176502277: Sending  { Cmd , MgmtId: 178527198316230, via: 3, Ver: v1, Flags: 100011,
    "request":"GET_OR_RESTART","hvm":false,"description":"CentOS 5.6(64-bit) no GUI
    "centos56-x86_64-xen","secUrl":"nfs://","wait":0}}] }
  5. Ensure all management servers are bounced after updating global settings. Reboot the running SSVMs after bouncing the management servers

Things to watch out for:

  1. First update vm_template table and then the global settings. Ensure management servers are bounced. Reboot SSVM after bouncing the management servers
  2. Ensure the SSVM instances can indeed reach the local HTTP server hosting the templates
  3. Do a manual HTTP fetch of the template from the local HTTP server to verify download
  4. /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt seems to be sensitive to the order in which the options are passed.

CentOS 5.6(64-bit) no GUI (XenServer)

Shanker Balan

Shanker Balan is a devops and infrastructure freelancer with over 14 years of industry experience in large scale Internet systems. He is available for both short term and long term projects on contract. Please use the Contact Form for any enquiry.

More Posts - Website

Follow Me:

Leave a Reply