if(vmMo.createSnapshot("cloud.template.base", "Base snapshot", false, false)) {
// the same template may be deployed with multiple copies at per-datastore per-host basis,
// save the original template name from CloudStack DB as the UUID to associate them.
vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_UUID, templateName);
vmMo.markAsTemplate();
} else {
vmMo.destroy();
String msg = "Unable to create base snapshot for template, templateName: " + templateName + ", templateUuid: " + templateUuid;
s_logger.error(msg);
throw new Exception(msg);