@Override public DataStore initialize(Map<String, Object> dsInfos) { DataStore store = primaryStoreHelper.createPrimaryDataStore(null); return providerMgr.getPrimaryDataStore(store.getId()); }
private Long findAgentIdForImageStore(final DataStore dataStore) throws ResourceUnavailableException { EndPoint endpoint = _ep.select(dataStore); if (endpoint == null) { throw new ResourceUnavailableException("Config drive creation failed, secondary store not available", dataStore.getClass(), dataStore.getId()); } return endpoint.getId(); }
public DataStore attachZone(DataStore store, HypervisorType hypervisor) { StoragePoolVO pool = this.dataStoreDao.findById(store.getId()); pool.setScope(ScopeType.ZONE); pool.setHypervisor(hypervisor); pool.setStatus(StoragePoolStatus.Up); this.dataStoreDao.update(pool.getId(), pool); return dataStoreMgr.getDataStore(store.getId(), DataStoreRole.Primary); }
public boolean maintain(DataStore store) { StoragePoolVO pool = this.dataStoreDao.findById(store.getId()); pool.setStatus(StoragePoolStatus.Maintenance); this.dataStoreDao.update(pool.getId(), pool); return true; }
public boolean enable(DataStore store) { StoragePoolVO pool = this.dataStoreDao.findById(store.getId()); pool.setStatus(StoragePoolStatus.Up); dataStoreDao.update(pool.getId(), pool); return true; }
public DataStore attachCluster(DataStore store) { StoragePoolVO pool = this.dataStoreDao.findById(store.getId()); storageMgr.createCapacityEntry(pool.getId()); pool.setScope(ScopeType.CLUSTER); pool.setStatus(StoragePoolStatus.Up); this.dataStoreDao.update(pool.getId(), pool); return dataStoreMgr.getDataStore(store.getId(), DataStoreRole.Primary); }
public boolean disable(DataStore store) { StoragePoolVO pool = this.dataStoreDao.findById(store.getId()); pool.setStatus(StoragePoolStatus.Disabled); this.dataStoreDao.update(pool.getId(), pool); return true; }
private boolean isVolumeOnManagedStorage(VolumeInfo volumeInfo) { DataStore dataStore = volumeInfo.getDataStore(); if (dataStore.getRole() == DataStoreRole.Primary) { long storagePooldId = dataStore.getId(); StoragePoolVO storagePoolVO = _storagePoolDao.findById(storagePooldId); return storagePoolVO.isManaged(); } return false; }
@Override public Long getRefCount() { if (dataStore == null) { return null; } if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) { TemplateDataStoreVO store = templateStoreDao.findByStoreTemplate(dataStore.getId(), getId()); return store.getRefCnt(); } return null; }
@Override public Long getRefCount() { if (dataStore == null) { return null; } if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) { VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId()); return store.getRefCnt(); } return null; }
@Override public SnapshotInfo getParent() { SnapshotDataStoreVO snapStoreVO = snapshotStoreDao.findByStoreSnapshot(store.getRole(), store.getId(), snapshot.getId()); Long parentId = null; if (snapStoreVO != null) { parentId = snapStoreVO.getParentSnapshotId(); if (parentId != null && parentId != 0) { return snapshotFactory.getSnapshot(parentId, store); } } return null; }
@Override public void decRefCount() { if (dataStore == null) { return; } if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) { TemplateDataStoreVO store = templateStoreDao.findByStoreTemplate(dataStore.getId(), getId()); store.decrRefCnt(); store.setLastUpdated(new Date()); templateStoreDao.update(store.getId(), store); } }
@Override public void decRefCount() { if (dataStore == null) { return; } if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) { VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId()); store.decrRefCnt(); store.setLastUpdated(new Date()); volumeStoreDao.update(store.getId(), store); } }
@Override public void incRefCount() { if (dataStore == null) { return; } if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) { TemplateDataStoreVO store = templateStoreDao.findByStoreTemplate(dataStore.getId(), getId()); store.incrRefCnt(); store.setLastUpdated(new Date()); templateStoreDao.update(store.getId(), store); } }
@Override public void incRefCount() { if (dataStore == null) { return; } if (dataStore.getRole() == DataStoreRole.Image || dataStore.getRole() == DataStoreRole.ImageCache) { VolumeDataStoreVO store = volumeStoreDao.findByStoreVolume(dataStore.getId(), getId()); store.incrRefCnt(); store.setLastUpdated(new Date()); volumeStoreDao.update(store.getId(), store); } }
@Override public void decRefCount() { if (store == null) { return; } if (store.getRole() == DataStoreRole.Image || store.getRole() == DataStoreRole.ImageCache) { SnapshotDataStoreVO store = snapshotStoreDao.findByStoreSnapshot(this.store.getRole(), this.store.getId(), getId()); store.decrRefCnt(); store.setLastUpdated(new Date()); snapshotStoreDao.update(store.getId(), store); } }
@Override public Long getRefCount() { if (store == null) { return null; } if (store.getRole() == DataStoreRole.Image || store.getRole() == DataStoreRole.ImageCache) { SnapshotDataStoreVO store = snapshotStoreDao.findByStoreSnapshot(this.store.getRole(), this.store.getId(), getId()); return store.getRefCnt(); } return null; }
@Override public void incRefCount() { if (store == null) { return; } if (store.getRole() == DataStoreRole.Image || store.getRole() == DataStoreRole.ImageCache) { SnapshotDataStoreVO store = snapshotStoreDao.findByStoreSnapshot(this.store.getRole(), this.store.getId(), getId()); store.incrRefCnt(); store.setLastUpdated(new Date()); snapshotStoreDao.update(store.getId(), store); } }