public TemplateProfile prepareDelete(DeleteIsoCmd cmd) {
    TemplateProfile profile = super.prepareDelete(cmd);
    Long zoneId = profile.getZoneId();

    if (zoneId != null && (_ssvmMgr.findSecondaryStorageHost(zoneId) == null)) {
      throw new InvalidParameterValueException(
          "Failed to find a secondary storage host in the specified zone.");
    }

    return profile;
  }
  public TemplateProfile prepareDelete(DeleteTemplateCmd cmd) {
    TemplateProfile profile = super.prepareDelete(cmd);
    VMTemplateVO template = profile.getTemplate();
    Long zoneId = profile.getZoneId();

    if (template.getTemplateType() == TemplateType.SYSTEM) {
      throw new InvalidParameterValueException("The DomR template cannot be deleted.");
    }

    if (zoneId != null && (_ssvmMgr.findSecondaryStorageHost(zoneId) == null)) {
      throw new InvalidParameterValueException(
          "Failed to find a secondary storage host in the specified zone.");
    }

    return profile;
  }