Tempalte extract and register calls

This allows you to automatically extract and register templates and to work around CloudStack bug https://issues.apache.org/jira/browse/CLOUDSTACK-1808