Skip to content

Instantly share code, notes, and snippets.

@eriweb
Last active August 17, 2017 17:47
Show Gist options
  • Save eriweb/102ae8edd1cda192561c to your computer and use it in GitHub Desktop.
Save eriweb/102ae8edd1cda192561c to your computer and use it in GitHub Desktop.
Apache CloudStack 4.4 manually upgrading system vm template after upgrading or installing with 4.3 templates

If your system vm is not currently working you have to make it work. On XenServer you can do this by SSH'ing to it and upgrade java.

apt-get update && apt-get -y install openjdk-7-jre-headless openjdk-7-jre-lib && apt-get -y remove openjdk-6-jre-headless

and it should now work. In some rare cases you have to restart the cloud service

service cloud stop && sleep 3 && service cloud start

and in some even rarer cases you have to restart the ssvm. Do that from the Apache CloudStack UI.

If you experience problems upgrading due to lack of free space then stop the cloud service, and remove any log files, they can be big.

When your SSVM is properly working again add a new template. Depending on your hypervisor it should be named as follows:

XenServer:

systemvm-xenserver-4.4

KVM:

systemvm-kvm-4.4

Use the same in the description, set OS to the latest Debian (64-bit) release available.

Choose the correct template from this location as the URL, but make sure to use the 64 bit one. http://cloudstack.apt-get.eu/systemvm/4.4/

It should look like this for a XenServer installation: Imgur

After the template is successfully downloaded, connect to your cloud database and run the following queries:

    # this will get you the id to use later. anywhere xenserver is mentioned you replace with your hypervisor
    # if there is more than one (it shouldn't really...), use the highest id as $fromfirststep
    mysql> select id,name from vm_template where name = 'systemvm-xenserver-4.4';
    
    # this will change the template's type to SYSTEM
    mysql> update vm_template set type='SYSTEM' where id = $fromfirststep;
    
    # this will update any existing system vm to use the new template
    # XenServer:
    mysql> update vm_instance set vm_template_id = $fromfirststep where type <> 'USER' and hypervisor_type = 'XenServer';
    
    # KVM: 
    mysql> update vm_instance set vm_template_id = $fromfirststep where type <> 'USER' and hypervisor_type = 'KVM';
    
    # this will update the global configuration option for VRs to use the new template
    # XenServer:
    mysql> update configuration set value = 'systemvm-xenserver-4.4' where name = 'router.template.xen';
    
    # KVM:
    mysql> update configuration set value = 'systemvm-kvm-4.4' where name = 'router.template.kvm';

Now restart cloudstack-management, and hopefully your system vm's should work.

@jschubart
Copy link

mysql> update configuration set value = 'systemvm-xenserver-X.X' where name = 'router.template.xen';

is changed to

mysql> update configuration set value = 'systemvm-xenserver-X.X' where name = 'router.template.xenserver';

in later versions.

You will also want to update minreq.sysvmtemplate.version in the Global Settings to the newer version if you want your VR to give the option to update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment