test_class.declarator: templateManager = new TemplateManagerImpl()
test_class.modifier: @Inject
test_class.original_string: @Inject
      TemplateManagerImpl templateManager = new TemplateManagerImpl();
test_class.type: TemplateManagerImpl
test_class.var_name: templateManager
test_class.declarator: dataStoreManager
test_class.modifier: @Inject
test_class.original_string: @Inject
      DataStoreManager dataStoreManager;
test_class.type: DataStoreManager
test_class.var_name: dataStoreManager
test_class.declarator: vmTemplateDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      VMTemplateDao vmTemplateDao;
test_class.type: VMTemplateDao
test_class.var_name: vmTemplateDao
test_class.declarator: vmTemplatePoolDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      VMTemplatePoolDao vmTemplatePoolDao;
test_class.type: VMTemplatePoolDao
test_class.var_name: vmTemplatePoolDao
test_class.declarator: templateDataStoreDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      TemplateDataStoreDao templateDataStoreDao;
test_class.type: TemplateDataStoreDao
test_class.var_name: templateDataStoreDao
test_class.declarator: storagePoolHostDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      StoragePoolHostDao storagePoolHostDao;
test_class.type: StoragePoolHostDao
test_class.var_name: storagePoolHostDao
test_class.declarator: primaryDataStoreDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      PrimaryDataStoreDao primaryDataStoreDao;
test_class.type: PrimaryDataStoreDao
test_class.var_name: primaryDataStoreDao
test_class.declarator: resourceLimitMgr
test_class.modifier: @Inject
test_class.original_string: @Inject
      ResourceLimitService resourceLimitMgr;
test_class.type: ResourceLimitService
test_class.var_name: resourceLimitMgr
test_class.declarator: imgStoreDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      ImageStoreDao imgStoreDao;
test_class.type: ImageStoreDao
test_class.var_name: imgStoreDao
test_class.declarator: guestOSDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      GuestOSDao guestOSDao;
test_class.type: GuestOSDao
test_class.var_name: guestOSDao
test_class.declarator: tmpltDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      VMTemplateDao tmpltDao;
test_class.type: VMTemplateDao
test_class.var_name: tmpltDao
test_class.declarator: snapshotDao
test_class.modifier: @Inject
test_class.original_string: @Inject
      SnapshotDao snapshotDao;
test_class.type: SnapshotDao
test_class.var_name: snapshotDao
test_class.declarator: storageStrategyFactory
test_class.modifier: @Inject
test_class.original_string: @Inject
      StorageStrategyFactory storageStrategyFactory;
test_class.type: StorageStrategyFactory
test_class.var_name: storageStrategyFactory
test_class.file: cosmic-core/server/src/test/java/com/cloud/template/TemplateManagerImplTest.java
test_class.identifier: TemplateManagerImplTest
test_case.body: @Test
      public void testCreatePrivateTemplateRecordForRegionStore() throws ResourceAllocationException {
  
          final CreateTemplateCmd mockCreateCmd = mock(CreateTemplateCmd.class);
          when(mockCreateCmd.getTemplateName()).thenReturn("test");
          when(mockCreateCmd.getTemplateTag()).thenReturn(null);
          when(mockCreateCmd.getBits()).thenReturn(64);
          when(mockCreateCmd.isPasswordEnabled()).thenReturn(false);
          when(mockCreateCmd.isPublic()).thenReturn(false);
          when(mockCreateCmd.isFeatured()).thenReturn(false);
          when(mockCreateCmd.isDynamicallyScalable()).thenReturn(false);
          when(mockCreateCmd.getVolumeId()).thenReturn(null);
          when(mockCreateCmd.getSnapshotId()).thenReturn(1L);
          when(mockCreateCmd.getOsTypeId()).thenReturn(1L);
          when(mockCreateCmd.getEventDescription()).thenReturn("test");
          when(mockCreateCmd.getDetails()).thenReturn(null);
  
          final Account mockTemplateOwner = mock(Account.class);
  
          final SnapshotVO mockSnapshot = mock(SnapshotVO.class);
          when(snapshotDao.findById(anyLong())).thenReturn(mockSnapshot);
  
          when(mockSnapshot.getVolumeId()).thenReturn(1L);
          when(mockSnapshot.getState()).thenReturn(Snapshot.State.BackedUp);
          when(mockSnapshot.getHypervisorType()).thenReturn(HypervisorType.XenServer);
  
          doNothing().when(resourceLimitMgr).checkResourceLimit(any(Account.class), eq(Resource.ResourceType.template));
          doNothing().when(resourceLimitMgr).checkResourceLimit(any(Account.class), eq(Resource.ResourceType.secondary_storage), anyLong());
  
          final GuestOSVO mockGuestOS = mock(GuestOSVO.class);
          when(guestOSDao.findById(anyLong())).thenReturn(mockGuestOS);
  
          when(tmpltDao.getNextInSequence(eq(Long.class), eq("id"))).thenReturn(1L);
  
          final List<ImageStoreVO> mockRegionStores = new ArrayList<>();
          final ImageStoreVO mockRegionStore = mock(ImageStoreVO.class);
          mockRegionStores.add(mockRegionStore);
          when(imgStoreDao.findRegionImageStores()).thenReturn(mockRegionStores);
  
          when(tmpltDao.persist(any(VMTemplateVO.class))).thenAnswer(new Answer<VMTemplateVO>() {
              @Override
              public VMTemplateVO answer(final InvocationOnMock invocationOnMock) throws Throwable {
                  final Object[] args = invocationOnMock.getArguments();
                  return (VMTemplateVO) args[0];
              }
          });
  
          final VMTemplateVO template = templateManager.createPrivateTemplateRecord(mockCreateCmd, mockTemplateOwner);
          assertTrue("Template in a region store should have cross zones set", template.isCrossZones());
      }
test_case.class_method_signature: TemplateManagerImplTest.testCreatePrivateTemplateRecordForRegionStore()
test_case.full_signature: @Test public void testCreatePrivateTemplateRecordForRegionStore()
test_case.identifier: testCreatePrivateTemplateRecordForRegionStore
test_case.invocations: mock thenReturn when getTemplateName thenReturn when getTemplateTag thenReturn when getBits thenReturn when isPasswordEnabled thenReturn when isPublic thenReturn when isFeatured thenReturn when isDynamicallyScalable thenReturn when getVolumeId thenReturn when getSnapshotId thenReturn when getOsTypeId thenReturn when getEventDescription thenReturn when getDetails mock mock thenReturn when findById anyLong thenReturn when getVolumeId thenReturn when getState thenReturn when getHypervisorType checkResourceLimit when doNothing any eq checkResourceLimit when doNothing any eq anyLong mock thenReturn when findById anyLong thenReturn when getNextInSequence eq eq mock add thenReturn when findRegionImageStores thenAnswer when persist any getArguments createPrivateTemplateRecord assertTrue isCrossZones
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreatePrivateTemplateRecordForRegionStore()
focal_class.declarator: s_logger = LoggerFactory.getLogger(TemplateManagerImpl.class)
focal_class.modifier: private final static
focal_class.original_string: private final static Logger s_logger = LoggerFactory.getLogger(TemplateManagerImpl.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: _messageBus
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      MessageBus _messageBus;
focal_class.type: MessageBus
focal_class.var_name: _messageBus
focal_class.declarator: _preloadExecutor
focal_class.original_string: ExecutorService _preloadExecutor;
focal_class.type: ExecutorService
focal_class.var_name: _preloadExecutor
focal_class.declarator: _tmpltDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VMTemplateDao _tmpltDao;
focal_class.type: VMTemplateDao
focal_class.var_name: _tmpltDao
focal_class.declarator: _tmplStoreDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private TemplateDataStoreDao _tmplStoreDao;
focal_class.type: TemplateDataStoreDao
focal_class.var_name: _tmplStoreDao
focal_class.declarator: _tmpltPoolDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VMTemplatePoolDao _tmpltPoolDao;
focal_class.type: VMTemplatePoolDao
focal_class.var_name: _tmpltPoolDao
focal_class.declarator: _tmpltZoneDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VMTemplateZoneDao _tmpltZoneDao;
focal_class.type: VMTemplateZoneDao
focal_class.var_name: _tmpltZoneDao
focal_class.declarator: _vmInstanceDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VMInstanceDao _vmInstanceDao;
focal_class.type: VMInstanceDao
focal_class.var_name: _vmInstanceDao
focal_class.declarator: _poolDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private PrimaryDataStoreDao _poolDao;
focal_class.type: PrimaryDataStoreDao
focal_class.var_name: _poolDao
focal_class.declarator: _poolHostDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private StoragePoolHostDao _poolHostDao;
focal_class.type: StoragePoolHostDao
focal_class.var_name: _poolHostDao
focal_class.declarator: _accountDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private AccountDao _accountDao;
focal_class.type: AccountDao
focal_class.var_name: _accountDao
focal_class.declarator: _agentMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private AgentManager _agentMgr;
focal_class.type: AgentManager
focal_class.var_name: _agentMgr
focal_class.declarator: _accountMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private AccountManager _accountMgr;
focal_class.type: AccountManager
focal_class.var_name: _accountMgr
focal_class.declarator: _hostDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private HostDao _hostDao;
focal_class.type: HostDao
focal_class.var_name: _hostDao
focal_class.declarator: _dcDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private DataCenterDao _dcDao;
focal_class.type: DataCenterDao
focal_class.var_name: _dcDao
focal_class.declarator: _userVmDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private UserVmDao _userVmDao;
focal_class.type: UserVmDao
focal_class.var_name: _userVmDao
focal_class.declarator: _volumeDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VolumeDao _volumeDao;
focal_class.type: VolumeDao
focal_class.var_name: _volumeDao
focal_class.declarator: _snapshotDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private SnapshotDao _snapshotDao;
focal_class.type: SnapshotDao
focal_class.var_name: _snapshotDao
focal_class.declarator: _configDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private ConfigurationDao _configDao;
focal_class.type: ConfigurationDao
focal_class.var_name: _configDao
focal_class.declarator: _domainDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private DomainDao _domainDao;
focal_class.type: DomainDao
focal_class.var_name: _domainDao
focal_class.declarator: _guestOSDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private GuestOSDao _guestOSDao;
focal_class.type: GuestOSDao
focal_class.var_name: _guestOSDao
focal_class.declarator: _storageMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private StorageManager _storageMgr;
focal_class.type: StorageManager
focal_class.var_name: _storageMgr
focal_class.declarator: _accountService
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private AccountService _accountService;
focal_class.type: AccountService
focal_class.var_name: _accountService
focal_class.declarator: _resourceLimitMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private ResourceLimitService _resourceLimitMgr;
focal_class.type: ResourceLimitService
focal_class.var_name: _resourceLimitMgr
focal_class.declarator: _launchPermissionDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private LaunchPermissionDao _launchPermissionDao;
focal_class.type: LaunchPermissionDao
focal_class.var_name: _launchPermissionDao
focal_class.declarator: _projectMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private ProjectManager _projectMgr;
focal_class.type: ProjectManager
focal_class.var_name: _projectMgr
focal_class.declarator: _volFactory
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VolumeDataFactory _volFactory;
focal_class.type: VolumeDataFactory
focal_class.var_name: _volFactory
focal_class.declarator: _tmplFactory
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private TemplateDataFactory _tmplFactory;
focal_class.type: TemplateDataFactory
focal_class.var_name: _tmplFactory
focal_class.declarator: _snapshotFactory
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private SnapshotDataFactory _snapshotFactory;
focal_class.type: SnapshotDataFactory
focal_class.var_name: _snapshotFactory
focal_class.declarator: _storageStrategyFactory
focal_class.modifier: @Inject
focal_class.original_string: @Inject
      StorageStrategyFactory _storageStrategyFactory;
focal_class.type: StorageStrategyFactory
focal_class.var_name: _storageStrategyFactory
focal_class.declarator: _tmpltSvr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private TemplateService _tmpltSvr;
focal_class.type: TemplateService
focal_class.var_name: _tmpltSvr
focal_class.declarator: _dataStoreMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private DataStoreManager _dataStoreMgr;
focal_class.type: DataStoreManager
focal_class.var_name: _dataStoreMgr
focal_class.declarator: _volumeMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private VolumeOrchestrationService _volumeMgr;
focal_class.type: VolumeOrchestrationService
focal_class.var_name: _volumeMgr
focal_class.declarator: _epSelector
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private EndPointSelector _epSelector;
focal_class.type: EndPointSelector
focal_class.var_name: _epSelector
focal_class.declarator: _userVmJoinDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private UserVmJoinDao _userVmJoinDao;
focal_class.type: UserVmJoinDao
focal_class.var_name: _userVmJoinDao
focal_class.declarator: _snapshotStoreDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private SnapshotDataStoreDao _snapshotStoreDao;
focal_class.type: SnapshotDataStoreDao
focal_class.var_name: _snapshotStoreDao
focal_class.declarator: _imgStoreDao
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private ImageStoreDao _imgStoreDao;
focal_class.type: ImageStoreDao
focal_class.var_name: _imgStoreDao
focal_class.declarator: _disableExtraction = false
focal_class.modifier: private
focal_class.original_string: private boolean _disableExtraction = false;
focal_class.type: boolean
focal_class.var_name: _disableExtraction
focal_class.declarator: _adapters
focal_class.modifier: private
focal_class.original_string: private List<TemplateAdapter> _adapters;
focal_class.type: List<TemplateAdapter>
focal_class.var_name: _adapters
focal_class.declarator: cacheMgr
focal_class.modifier: @Inject
      private
focal_class.original_string: @Inject
      private StorageCacheManager cacheMgr;
focal_class.type: StorageCacheManager
focal_class.var_name: cacheMgr
focal_class.file: cosmic-core/server/src/main/java/com/cloud/template/TemplateManagerImpl.java
focal_class.identifier: TemplateManagerImpl
focal_class.interfaces: implements TemplateManager, TemplateApiService, Configurable
focal_class.class_method_signature: TemplateManagerImpl.TemplateManagerImpl()
focal_class.full_signature: protected  TemplateManagerImpl()
focal_class.identifier: TemplateManagerImpl
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.signature:  TemplateManagerImpl()
focal_class.class_method_signature: TemplateManagerImpl.registerTemplate(final RegisterTemplateCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template") public VirtualMachineTemplate registerTemplate(final RegisterTemplateCmd cmd)
focal_class.identifier: registerTemplate
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template") public
focal_class.parameters: (final RegisterTemplateCmd cmd)
focal_class.return: VirtualMachineTemplate
focal_class.signature: VirtualMachineTemplate registerTemplate(final RegisterTemplateCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.registerTemplateForPostUpload(final GetUploadParamsForTemplateCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating post upload template") public GetUploadParamsResponse registerTemplateForPostUpload(final GetUploadParamsForTemplateCmd cmd)
focal_class.identifier: registerTemplateForPostUpload
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating post upload template") public
focal_class.parameters: (final GetUploadParamsForTemplateCmd cmd)
focal_class.return: GetUploadParamsResponse
focal_class.signature: GetUploadParamsResponse registerTemplateForPostUpload(final GetUploadParamsForTemplateCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.registerIso(final RegisterIsoCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_CREATE, eventDescription = "creating iso") public VirtualMachineTemplate registerIso(final RegisterIsoCmd cmd)
focal_class.identifier: registerIso
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_CREATE, eventDescription = "creating iso") public
focal_class.parameters: (final RegisterIsoCmd cmd)
focal_class.return: VirtualMachineTemplate
focal_class.signature: VirtualMachineTemplate registerIso(final RegisterIsoCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.copyTemplate(final CopyTemplateCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_COPY, eventDescription = "copying template", async = true) public VirtualMachineTemplate copyTemplate(final CopyTemplateCmd cmd)
focal_class.identifier: copyTemplate
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_COPY, eventDescription = "copying template", async = true) public
focal_class.parameters: (final CopyTemplateCmd cmd)
focal_class.return: VirtualMachineTemplate
focal_class.signature: VirtualMachineTemplate copyTemplate(final CopyTemplateCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.prepareTemplate(final long templateId, final long zoneId, final Long storageId)
focal_class.full_signature: @Override public VirtualMachineTemplate prepareTemplate(final long templateId, final long zoneId, final Long storageId)
focal_class.identifier: prepareTemplate
focal_class.modifiers: @Override public
focal_class.parameters: (final long templateId, final long zoneId, final Long storageId)
focal_class.return: VirtualMachineTemplate
focal_class.signature: VirtualMachineTemplate prepareTemplate(final long templateId, final long zoneId, final Long storageId)
focal_class.class_method_signature: TemplateManagerImpl.prepareTemplateInOneStoragePool(final VMTemplateVO template, final StoragePoolVO pool)
focal_class.full_signature: private void prepareTemplateInOneStoragePool(final VMTemplateVO template, final StoragePoolVO pool)
focal_class.identifier: prepareTemplateInOneStoragePool
focal_class.modifiers: private
focal_class.parameters: (final VMTemplateVO template, final StoragePoolVO pool)
focal_class.return: void
focal_class.signature: void prepareTemplateInOneStoragePool(final VMTemplateVO template, final StoragePoolVO pool)
focal_class.class_method_signature: TemplateManagerImpl.prepareTemplateInAllStoragePools(final VMTemplateVO template, final long zoneId)
focal_class.full_signature: public void prepareTemplateInAllStoragePools(final VMTemplateVO template, final long zoneId)
focal_class.identifier: prepareTemplateInAllStoragePools
focal_class.modifiers: public
focal_class.parameters: (final VMTemplateVO template, final long zoneId)
focal_class.return: void
focal_class.signature: void prepareTemplateInAllStoragePools(final VMTemplateVO template, final long zoneId)
focal_class.class_method_signature: TemplateManagerImpl.prepareTemplateForCreate(final VMTemplateVO templ, final StoragePool pool)
focal_class.full_signature: @Override @DB public VMTemplateStoragePoolVO prepareTemplateForCreate(final VMTemplateVO templ, final StoragePool pool)
focal_class.identifier: prepareTemplateForCreate
focal_class.modifiers: @Override @DB public
focal_class.parameters: (final VMTemplateVO templ, final StoragePool pool)
focal_class.return: VMTemplateStoragePoolVO
focal_class.signature: VMTemplateStoragePoolVO prepareTemplateForCreate(final VMTemplateVO templ, final StoragePool pool)
focal_class.class_method_signature: TemplateManagerImpl.resetTemplateDownloadStateOnPool(final long templateStoragePoolRefId)
focal_class.full_signature: @Override @DB public boolean resetTemplateDownloadStateOnPool(final long templateStoragePoolRefId)
focal_class.identifier: resetTemplateDownloadStateOnPool
focal_class.modifiers: @Override @DB public
focal_class.parameters: (final long templateStoragePoolRefId)
focal_class.return: boolean
focal_class.signature: boolean resetTemplateDownloadStateOnPool(final long templateStoragePoolRefId)
focal_class.class_method_signature: TemplateManagerImpl.copy(final long userId, final VMTemplateVO template, final DataStore srcSecStore, final DataCenterVO dstZone)
focal_class.full_signature: @Override @DB public boolean copy(final long userId, final VMTemplateVO template, final DataStore srcSecStore, final DataCenterVO dstZone)
focal_class.identifier: copy
focal_class.modifiers: @Override @DB public
focal_class.parameters: (final long userId, final VMTemplateVO template, final DataStore srcSecStore, final DataCenterVO dstZone)
focal_class.return: boolean
focal_class.signature: boolean copy(final long userId, final VMTemplateVO template, final DataStore srcSecStore, final DataCenterVO dstZone)
focal_class.class_method_signature: TemplateManagerImpl.delete(final long userId, final long templateId, final Long zoneId)
focal_class.full_signature: @Override public boolean delete(final long userId, final long templateId, final Long zoneId)
focal_class.identifier: delete
focal_class.modifiers: @Override public
focal_class.parameters: (final long userId, final long templateId, final Long zoneId)
focal_class.return: boolean
focal_class.signature: boolean delete(final long userId, final long templateId, final Long zoneId)
focal_class.class_method_signature: TemplateManagerImpl.getUnusedTemplatesInPool(final StoragePoolVO pool)
focal_class.full_signature: @Override public List<VMTemplateStoragePoolVO> getUnusedTemplatesInPool(final StoragePoolVO pool)
focal_class.identifier: getUnusedTemplatesInPool
focal_class.modifiers: @Override public
focal_class.parameters: (final StoragePoolVO pool)
focal_class.return: List<VMTemplateStoragePoolVO>
focal_class.signature: List<VMTemplateStoragePoolVO> getUnusedTemplatesInPool(final StoragePoolVO pool)
focal_class.class_method_signature: TemplateManagerImpl.evictTemplateFromStoragePool(final VMTemplateStoragePoolVO templatePoolVO)
focal_class.full_signature: @Override @DB public void evictTemplateFromStoragePool(final VMTemplateStoragePoolVO templatePoolVO)
focal_class.identifier: evictTemplateFromStoragePool
focal_class.modifiers: @Override @DB public
focal_class.parameters: (final VMTemplateStoragePoolVO templatePoolVO)
focal_class.return: void
focal_class.signature: void evictTemplateFromStoragePool(final VMTemplateStoragePoolVO templatePoolVO)
focal_class.class_method_signature: TemplateManagerImpl.templateIsDeleteable(final VMTemplateHostVO templateHostRef)
focal_class.full_signature: @Override public boolean templateIsDeleteable(final VMTemplateHostVO templateHostRef)
focal_class.identifier: templateIsDeleteable
focal_class.modifiers: @Override public
focal_class.parameters: (final VMTemplateHostVO templateHostRef)
focal_class.return: boolean
focal_class.signature: boolean templateIsDeleteable(final VMTemplateHostVO templateHostRef)
focal_class.class_method_signature: TemplateManagerImpl.templateIsDeleteable(final long templateId)
focal_class.full_signature: @Override public boolean templateIsDeleteable(final long templateId)
focal_class.identifier: templateIsDeleteable
focal_class.modifiers: @Override public
focal_class.parameters: (final long templateId)
focal_class.return: boolean
focal_class.signature: boolean templateIsDeleteable(final long templateId)
focal_class.class_method_signature: TemplateManagerImpl.getAbsoluteIsoPath(final long templateId, final long dataCenterId)
focal_class.full_signature: @Override public Pair<String, String> getAbsoluteIsoPath(final long templateId, final long dataCenterId)
focal_class.identifier: getAbsoluteIsoPath
focal_class.modifiers: @Override public
focal_class.parameters: (final long templateId, final long dataCenterId)
focal_class.return: Pair<String, String>
focal_class.signature: Pair<String, String> getAbsoluteIsoPath(final long templateId, final long dataCenterId)
focal_class.class_method_signature: TemplateManagerImpl.getSecondaryStorageURL(final long zoneId)
focal_class.full_signature: @Override public String getSecondaryStorageURL(final long zoneId)
focal_class.identifier: getSecondaryStorageURL
focal_class.modifiers: @Override public
focal_class.parameters: (final long zoneId)
focal_class.return: String
focal_class.signature: String getSecondaryStorageURL(final long zoneId)
focal_class.class_method_signature: TemplateManagerImpl.getImageStore(final long zoneId, final long tmpltId)
focal_class.full_signature: @Override public DataStore getImageStore(final long zoneId, final long tmpltId)
focal_class.identifier: getImageStore
focal_class.modifiers: @Override public
focal_class.parameters: (final long zoneId, final long tmpltId)
focal_class.return: DataStore
focal_class.signature: DataStore getImageStore(final long zoneId, final long tmpltId)
focal_class.class_method_signature: TemplateManagerImpl.getImageStore(final long tmpltId)
focal_class.full_signature: @Override public DataStore getImageStore(final long tmpltId)
focal_class.identifier: getImageStore
focal_class.modifiers: @Override public
focal_class.parameters: (final long tmpltId)
focal_class.return: DataStore
focal_class.signature: DataStore getImageStore(final long tmpltId)
focal_class.class_method_signature: TemplateManagerImpl.getTemplateSize(final long templateId, final long zoneId)
focal_class.full_signature: @Override public Long getTemplateSize(final long templateId, final long zoneId)
focal_class.identifier: getTemplateSize
focal_class.modifiers: @Override public
focal_class.parameters: (final long templateId, final long zoneId)
focal_class.return: Long
focal_class.signature: Long getTemplateSize(final long templateId, final long zoneId)
focal_class.class_method_signature: TemplateManagerImpl.getImageStore(final String storeUuid, final Long zoneId)
focal_class.full_signature: @Override public DataStore getImageStore(final String storeUuid, final Long zoneId)
focal_class.identifier: getImageStore
focal_class.modifiers: @Override public
focal_class.parameters: (final String storeUuid, final Long zoneId)
focal_class.return: DataStore
focal_class.signature: DataStore getImageStore(final String storeUuid, final Long zoneId)
focal_class.class_method_signature: TemplateManagerImpl.getChecksum(final DataStore store, final String templatePath)
focal_class.full_signature: @Override public String getChecksum(final DataStore store, final String templatePath)
focal_class.identifier: getChecksum
focal_class.modifiers: @Override public
focal_class.parameters: (final DataStore store, final String templatePath)
focal_class.return: String
focal_class.signature: String getChecksum(final DataStore store, final String templatePath)
focal_class.class_method_signature: TemplateManagerImpl.getImageStoreByTemplate(final long templateId, final Long zoneId)
focal_class.full_signature: @Override public List<DataStore> getImageStoreByTemplate(final long templateId, final Long zoneId)
focal_class.identifier: getImageStoreByTemplate
focal_class.modifiers: @Override public
focal_class.parameters: (final long templateId, final Long zoneId)
focal_class.return: List<DataStore>
focal_class.signature: List<DataStore> getImageStoreByTemplate(final long templateId, final Long zoneId)
focal_class.class_method_signature: TemplateManagerImpl.prepareIso(final long isoId, final long dcId)
focal_class.full_signature: @Override public TemplateInfo prepareIso(final long isoId, final long dcId)
focal_class.identifier: prepareIso
focal_class.modifiers: @Override public
focal_class.parameters: (final long isoId, final long dcId)
focal_class.return: TemplateInfo
focal_class.signature: TemplateInfo prepareIso(final long isoId, final long dcId)
focal_class.class_method_signature: TemplateManagerImpl.prepareIsoForVmProfile(final VirtualMachineProfile profile)
focal_class.full_signature: @Override public void prepareIsoForVmProfile(final VirtualMachineProfile profile)
focal_class.identifier: prepareIsoForVmProfile
focal_class.modifiers: @Override public
focal_class.parameters: (final VirtualMachineProfile profile)
focal_class.return: void
focal_class.signature: void prepareIsoForVmProfile(final VirtualMachineProfile profile)
focal_class.class_method_signature: TemplateManagerImpl.detachIso(final long vmId)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_DETACH, eventDescription = "detaching ISO", async = true) public boolean detachIso(final long vmId)
focal_class.identifier: detachIso
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_DETACH, eventDescription = "detaching ISO", async = true) public
focal_class.parameters: (final long vmId)
focal_class.return: boolean
focal_class.signature: boolean detachIso(final long vmId)
focal_class.class_method_signature: TemplateManagerImpl.attachIso(final long isoId, final long vmId)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_ATTACH, eventDescription = "attaching ISO", async = true) public boolean attachIso(final long isoId, final long vmId)
focal_class.identifier: attachIso
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_ATTACH, eventDescription = "attaching ISO", async = true) public
focal_class.parameters: (final long isoId, final long vmId)
focal_class.return: boolean
focal_class.signature: boolean attachIso(final long isoId, final long vmId)
focal_class.class_method_signature: TemplateManagerImpl.deleteTemplate(final DeleteTemplateCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_DELETE, eventDescription = "deleting template", async = true) public boolean deleteTemplate(final DeleteTemplateCmd cmd)
focal_class.identifier: deleteTemplate
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_DELETE, eventDescription = "deleting template", async = true) public
focal_class.parameters: (final DeleteTemplateCmd cmd)
focal_class.return: boolean
focal_class.signature: boolean deleteTemplate(final DeleteTemplateCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.deleteIso(final DeleteIsoCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_DELETE, eventDescription = "deleting iso", async = true) public boolean deleteIso(final DeleteIsoCmd cmd)
focal_class.identifier: deleteIso
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_DELETE, eventDescription = "deleting iso", async = true) public
focal_class.parameters: (final DeleteIsoCmd cmd)
focal_class.return: boolean
focal_class.signature: boolean deleteIso(final DeleteIsoCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.extract(final ExtractIsoCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_EXTRACT, eventDescription = "extracting ISO", async = true) public String extract(final ExtractIsoCmd cmd)
focal_class.identifier: extract
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_ISO_EXTRACT, eventDescription = "extracting ISO", async = true) public
focal_class.parameters: (final ExtractIsoCmd cmd)
focal_class.return: String
focal_class.signature: String extract(final ExtractIsoCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.extract(final ExtractTemplateCmd cmd)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_EXTRACT, eventDescription = "extracting template", async = true) public String extract(final ExtractTemplateCmd cmd)
focal_class.identifier: extract
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_EXTRACT, eventDescription = "extracting template", async = true) public
focal_class.parameters: (final ExtractTemplateCmd cmd)
focal_class.return: String
focal_class.signature: String extract(final ExtractTemplateCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.listTemplatePermissions(final BaseListTemplateOrIsoPermissionsCmd cmd)
focal_class.full_signature: @Override public List<String> listTemplatePermissions(final BaseListTemplateOrIsoPermissionsCmd cmd)
focal_class.identifier: listTemplatePermissions
focal_class.modifiers: @Override public
focal_class.parameters: (final BaseListTemplateOrIsoPermissionsCmd cmd)
focal_class.return: List<String>
focal_class.signature: List<String> listTemplatePermissions(final BaseListTemplateOrIsoPermissionsCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.updateTemplateOrIsoPermissions(final BaseUpdateTemplateOrIsoPermissionsCmd cmd)
focal_class.full_signature: @DB @Override public boolean updateTemplateOrIsoPermissions(final BaseUpdateTemplateOrIsoPermissionsCmd cmd)
focal_class.identifier: updateTemplateOrIsoPermissions
focal_class.modifiers: @DB @Override public
focal_class.parameters: (final BaseUpdateTemplateOrIsoPermissionsCmd cmd)
focal_class.return: boolean
focal_class.signature: boolean updateTemplateOrIsoPermissions(final BaseUpdateTemplateOrIsoPermissionsCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner)
focal_class.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", create = true) public VMTemplateVO createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner)
focal_class.identifier: createPrivateTemplateRecord
focal_class.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", create = true) public
focal_class.parameters: (final CreateTemplateCmd cmd, final Account templateOwner)
focal_class.return: VMTemplateVO
focal_class.signature: VMTemplateVO createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner)
focal_class.class_method_signature: TemplateManagerImpl.createPrivateTemplate(final CreateTemplateCmd command)
focal_class.full_signature: @Override @DB @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", async = true) public VirtualMachineTemplate createPrivateTemplate(final CreateTemplateCmd command)
focal_class.identifier: createPrivateTemplate
focal_class.modifiers: @Override @DB @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", async = true) public
focal_class.parameters: (final CreateTemplateCmd command)
focal_class.return: VirtualMachineTemplate
focal_class.signature: VirtualMachineTemplate createPrivateTemplate(final CreateTemplateCmd command)
focal_class.class_method_signature: TemplateManagerImpl.updateTemplate(final UpdateIsoCmd cmd)
focal_class.full_signature: @Override public VMTemplateVO updateTemplate(final UpdateIsoCmd cmd)
focal_class.identifier: updateTemplate
focal_class.modifiers: @Override public
focal_class.parameters: (final UpdateIsoCmd cmd)
focal_class.return: VMTemplateVO
focal_class.signature: VMTemplateVO updateTemplate(final UpdateIsoCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.updateTemplate(final UpdateTemplateCmd cmd)
focal_class.full_signature: @Override public VMTemplateVO updateTemplate(final UpdateTemplateCmd cmd)
focal_class.identifier: updateTemplate
focal_class.modifiers: @Override public
focal_class.parameters: (final UpdateTemplateCmd cmd)
focal_class.return: VMTemplateVO
focal_class.signature: VMTemplateVO updateTemplate(final UpdateTemplateCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.updateTemplateOrIso(final BaseUpdateTemplateOrIsoCmd cmd)
focal_class.full_signature: private VMTemplateVO updateTemplateOrIso(final BaseUpdateTemplateOrIsoCmd cmd)
focal_class.identifier: updateTemplateOrIso
focal_class.modifiers: private
focal_class.parameters: (final BaseUpdateTemplateOrIsoCmd cmd)
focal_class.return: VMTemplateVO
focal_class.signature: VMTemplateVO updateTemplateOrIso(final BaseUpdateTemplateOrIsoCmd cmd)
focal_class.class_method_signature: TemplateManagerImpl.verifyTemplateId(final Long id)
focal_class.full_signature:  void verifyTemplateId(final Long id)
focal_class.identifier: verifyTemplateId
focal_class.parameters: (final Long id)
focal_class.return: void
focal_class.signature: void verifyTemplateId(final Long id)
focal_class.class_method_signature: TemplateManagerImpl.extract(final Account caller, final Long templateId, final String url, final Long zoneId, final String mode, final Long eventId, final boolean isISO)
focal_class.full_signature: private String extract(final Account caller, final Long templateId, final String url, final Long zoneId, final String mode, final Long eventId, final boolean isISO)
focal_class.identifier: extract
focal_class.modifiers: private
focal_class.parameters: (final Account caller, final Long templateId, final String url, final Long zoneId, final String mode, final Long eventId, final boolean isISO)
focal_class.return: String
focal_class.signature: String extract(final Account caller, final Long templateId, final String url, final Long zoneId, final String mode, final Long eventId, final boolean isISO)
focal_class.class_method_signature: TemplateManagerImpl.attachISOToVM(final long vmId, final long userId, final long isoId, final boolean attach)
focal_class.full_signature: private boolean attachISOToVM(final long vmId, final long userId, final long isoId, final boolean attach)
focal_class.identifier: attachISOToVM
focal_class.modifiers: private
focal_class.parameters: (final long vmId, final long userId, final long isoId, final boolean attach)
focal_class.return: boolean
focal_class.signature: boolean attachISOToVM(final long vmId, final long userId, final long isoId, final boolean attach)
focal_class.class_method_signature: TemplateManagerImpl.attachISOToVM(final long vmId, final long isoId, final boolean attach)
focal_class.full_signature: private boolean attachISOToVM(final long vmId, final long isoId, final boolean attach)
focal_class.identifier: attachISOToVM
focal_class.modifiers: private
focal_class.parameters: (final long vmId, final long isoId, final boolean attach)
focal_class.return: boolean
focal_class.signature: boolean attachISOToVM(final long vmId, final long isoId, final boolean attach)
focal_class.class_method_signature: TemplateManagerImpl.getAdapter(final HypervisorType type)
focal_class.full_signature: private TemplateAdapter getAdapter(final HypervisorType type)
focal_class.identifier: getAdapter
focal_class.modifiers: private
focal_class.parameters: (final HypervisorType type)
focal_class.return: TemplateAdapter
focal_class.signature: TemplateAdapter getAdapter(final HypervisorType type)
focal_class.class_method_signature: TemplateManagerImpl.configure(final String name, final Map<String, Object> params)
focal_class.full_signature: @Override public boolean configure(final String name, final Map<String, Object> params)
focal_class.identifier: configure
focal_class.modifiers: @Override public
focal_class.parameters: (final String name, final Map<String, Object> params)
focal_class.return: boolean
focal_class.signature: boolean configure(final String name, final Map<String, Object> params)
focal_class.class_method_signature: TemplateManagerImpl.start()
focal_class.full_signature: @Override public boolean start()
focal_class.identifier: start
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean start()
focal_class.class_method_signature: TemplateManagerImpl.stop()
focal_class.full_signature: @Override public boolean stop()
focal_class.identifier: stop
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean stop()
focal_class.class_method_signature: TemplateManagerImpl.getConfigComponentName()
focal_class.full_signature: @Override public String getConfigComponentName()
focal_class.identifier: getConfigComponentName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getConfigComponentName()
focal_class.class_method_signature: TemplateManagerImpl.getConfigKeys()
focal_class.full_signature: @Override public ConfigKey<?>[] getConfigKeys()
focal_class.identifier: getConfigKeys
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: ConfigKey<?>[]
focal_class.signature: ConfigKey<?>[] getConfigKeys()
focal_class.class_method_signature: TemplateManagerImpl.setTemplateAdapters(final List<TemplateAdapter> adapters)
focal_class.full_signature: @Inject public void setTemplateAdapters(final List<TemplateAdapter> adapters)
focal_class.identifier: setTemplateAdapters
focal_class.modifiers: @Inject public
focal_class.parameters: (final List<TemplateAdapter> adapters)
focal_class.return: void
focal_class.signature: void setTemplateAdapters(final List<TemplateAdapter> adapters)
focal_class.superclass: extends ManagerBase
focal_method.body: @Override
      @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", create = true)
      public VMTemplateVO createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner) throws ResourceAllocationException {
          final Account caller = CallContext.current().getCallingAccount();
          final boolean isAdmin = this._accountMgr.isAdmin(caller.getId());
  
          this._accountMgr.checkAccess(caller, null, true, templateOwner);
  
          final String name = cmd.getTemplateName();
          if (name == null || name.length() > 32) {
              throw new InvalidParameterValueException("Template name cannot be null and should be less than 32 characters");
          }
  
          if (cmd.getTemplateTag() != null) {
              if (!this._accountService.isRootAdmin(caller.getId())) {
                  throw new PermissionDeniedException("Parameter templatetag can only be specified by a Root Admin, permission denied");
              }
          }
  
          // do some parameter defaulting
          final Integer bits = cmd.getBits();
          final Boolean passwordEnabled = cmd.isPasswordEnabled();
          Boolean isPublic = cmd.isPublic();
          Boolean featured = cmd.isFeatured();
          final int bitsValue = bits == null ? 64 : bits;
          final boolean passwordEnabledValue = passwordEnabled != null && passwordEnabled;
          if (isPublic == null) {
              isPublic = Boolean.FALSE;
          }
          final boolean isDynamicScalingEnabled = cmd.isDynamicallyScalable();
          // check whether template owner can create public templates
          final boolean allowPublicUserTemplates = AllowPublicUserTemplates.valueIn(templateOwner.getId());
          if (!isAdmin && !allowPublicUserTemplates && isPublic) {
              throw new PermissionDeniedException("Failed to create template " + name + ", only private templates can be created.");
          }
  
          final Long volumeId = cmd.getVolumeId();
          final Long snapshotId = cmd.getSnapshotId();
          if (volumeId == null && snapshotId == null) {
              throw new InvalidParameterValueException("Failed to create private template record, neither volume ID nor snapshot ID were specified.");
          }
          if (volumeId != null && snapshotId != null) {
              throw new InvalidParameterValueException("Failed to create private template record, please specify only one of volume ID (" + volumeId +
                      ") and snapshot ID (" + snapshotId + ")");
          }
  
          HypervisorType hyperType;
          final VolumeVO volume;
          SnapshotVO snapshot = null;
          final VMTemplateVO privateTemplate;
          if (volumeId != null) { // create template from volume
              volume = this._volumeDao.findById(volumeId);
              if (volume == null) {
                  throw new InvalidParameterValueException("Failed to create private template record, unable to find volume " + volumeId);
              }
              // check permissions
              this._accountMgr.checkAccess(caller, null, true, volume);
  
              // If private template is created from Volume, check that the volume
              // will not be active when the private template is
              // created
              if (!this._volumeMgr.volumeInactive(volume)) {
                  final String msg = "Unable to create private template for volume: " + volume.getName() + "; volume is detached or attached to a Running VM";
                  if (s_logger.isInfoEnabled()) {
                      s_logger.info(msg);
                  }
                  throw new CloudRuntimeException(msg);
              }
  
              hyperType = this._volumeDao.getHypervisorType(volumeId);
  
              // Try to find a better one than None
              if (hyperType == HypervisorType.None) {
                  try {
                      final String hypers = _configDao.getValue(Config.HypervisorList.key());
                      final String[] hypervisors = hypers.split(",");
                      final String defaultHyper = hypervisors[0];
                      hyperType = HypervisorType.valueOf(defaultHyper);
                  } catch (IllegalArgumentException e) {
                      s_logger.debug("Unable to get hypervisor from global settings");
                      hyperType = HypervisorType.None;
                  }
              }
  
          } else { // create template from snapshot
              snapshot = this._snapshotDao.findById(snapshotId);
              if (snapshot == null) {
                  throw new InvalidParameterValueException("Failed to create private template record, unable to find snapshot " + snapshotId);
              }
              // Volume could be removed so find including removed to record source template id.
              volume = this._volumeDao.findByIdIncludingRemoved(snapshot.getVolumeId());
  
              // check permissions
              this._accountMgr.checkAccess(caller, null, true, snapshot);
  
              if (snapshot.getState() != Snapshot.State.BackedUp) {
                  throw new InvalidParameterValueException("Snapshot id=" + snapshotId + " is not in " + Snapshot.State.BackedUp +
                          " state yet and can't be used for template creation");
              }
  
              /*
               * // bug #11428. Operation not supported if vmware and snapshots
               * parent volume = ROOT if(snapshot.getHypervisorType() ==
               * HypervisorType.VMware && snapshotVolume.getVolumeType() ==
               * Type.DATADISK){ throw new UnsupportedServiceException(
               * "operation not supported, snapshot with id " + snapshotId +
               * " is created from Data Disk"); }
               */
  
              hyperType = snapshot.getHypervisorType();
          }
  
          this._resourceLimitMgr.checkResourceLimit(templateOwner, ResourceType.template);
          this._resourceLimitMgr.checkResourceLimit(templateOwner, ResourceType.secondary_storage, volume != null ? volume.getSize() : snapshot.getSize());
  
          if (!isAdmin || featured == null) {
              featured = Boolean.FALSE;
          }
          final Long guestOSId = cmd.getOsTypeId();
          final GuestOSVO guestOS = this._guestOSDao.findById(guestOSId);
          if (guestOS == null) {
              throw new InvalidParameterValueException("GuestOS with ID: " + guestOSId + " does not exist.");
          }
  
          final Long nextTemplateId = this._tmpltDao.getNextInSequence(Long.class, "id");
          final String description = cmd.getDisplayText();
          boolean isExtractable = false;
          Long sourceTemplateId = null;
          if (volume != null) {
              final VMTemplateVO template = ApiDBUtils.findTemplateById(volume.getTemplateId());
              isExtractable = template != null && template.isExtractable() && template.getTemplateType() != TemplateType.SYSTEM;
              if (volume.getIsoId() != null && volume.getIsoId() != 0) {
                  sourceTemplateId = volume.getIsoId();
              } else if (volume.getTemplateId() != null) {
                  sourceTemplateId = volume.getTemplateId();
              }
          }
          final String templateTag = cmd.getTemplateTag();
          if (templateTag != null) {
              if (s_logger.isDebugEnabled()) {
                  s_logger.debug("Adding template tag: " + templateTag);
              }
          }
  
          // if specified from the API, use that one
          if (cmd.getHypervisor() != null) {
              hyperType = HypervisorType.getType(cmd.getHypervisor());
          }
  
          privateTemplate = new VMTemplateVO(nextTemplateId, name, ImageFormat.RAW, isPublic, featured, isExtractable, TemplateType.USER, null, bitsValue, templateOwner.getId(),
                  null, description, passwordEnabledValue, guestOS.getId(), true, hyperType, templateTag, cmd.getDetails(), false,
                  isDynamicScalingEnabled);
  
          if (sourceTemplateId != null) {
              if (s_logger.isDebugEnabled()) {
                  s_logger.debug("This template is getting created from other template, setting source template Id to: " + sourceTemplateId);
              }
          }
  
          // for region wide storage, set cross zones flag
          final List<ImageStoreVO> stores = this._imgStoreDao.findRegionImageStores();
          if (stores.size() > 0) {
              privateTemplate.setCrossZones(true);
          }
  
          privateTemplate.setSourceTemplateId(sourceTemplateId);
  
          final VMTemplateVO template = this._tmpltDao.persist(privateTemplate);
          // Increment the number of templates
          if (template != null) {
              final Map<String, String> details = new HashMap<>();
              if (volume != null) {
                  final Long vmId = volume.getInstanceId();
                  if (vmId != null) {
                      final UserVmVO userVm = this._userVmDao.findById(vmId);
                      if (userVm != null) {
                          this._userVmDao.loadDetails(userVm);
                          details.putAll(userVm.getDetails());
                      }
                  }
              }
              if (cmd.getDetails() != null) {
                  details.remove("Encrypted.Password"); // new password will be generated during vm deployment from password enabled template
                  details.putAll(cmd.getDetails());
              }
              if (!details.isEmpty()) {
                  privateTemplate.setDetails(details);
                  this._tmpltDao.saveDetails(privateTemplate);
              }
  
              this._resourceLimitMgr.incrementResourceCount(templateOwner.getId(), ResourceType.template);
              this._resourceLimitMgr.incrementResourceCount(templateOwner.getId(), ResourceType.secondary_storage,
                      new Long(volume != null ? volume.getSize() : snapshot.getSize()));
          }
  
          if (template != null) {
              return template;
          } else {
              throw new CloudRuntimeException("Failed to create a template");
          }
      }
focal_method.class_method_signature: TemplateManagerImpl.createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner)
focal_method.full_signature: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", create = true) public VMTemplateVO createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner)
focal_method.identifier: createPrivateTemplateRecord
focal_method.invocations: getCallingAccount current isAdmin getId checkAccess getTemplateName length getTemplateTag isRootAdmin getId getBits isPasswordEnabled isPublic isFeatured isDynamicallyScalable valueIn getId getVolumeId getSnapshotId findById checkAccess volumeInactive getName isInfoEnabled info getHypervisorType getValue key split valueOf debug findById findByIdIncludingRemoved getVolumeId checkAccess getState getHypervisorType checkResourceLimit checkResourceLimit getSize getSize getOsTypeId findById getNextInSequence getDisplayText findTemplateById getTemplateId isExtractable getTemplateType getIsoId getIsoId getIsoId getTemplateId getTemplateId getTemplateTag isDebugEnabled debug getHypervisor getType getHypervisor getId getId getDetails isDebugEnabled debug findRegionImageStores size setCrossZones setSourceTemplateId persist getInstanceId findById loadDetails putAll getDetails getDetails remove putAll getDetails isEmpty setDetails saveDetails incrementResourceCount getId incrementResourceCount getId getSize getSize
focal_method.modifiers: @Override @ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_CREATE, eventDescription = "creating template", create = true) public
focal_method.parameters: (final CreateTemplateCmd cmd, final Account templateOwner)
focal_method.return: VMTemplateVO
focal_method.signature: VMTemplateVO createPrivateTemplateRecord(final CreateTemplateCmd cmd, final Account templateOwner)