Package org.apache.cloudstack.storage.datastore.db

Examples of org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO


    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;
    }
View Full Code Here


        List<SnapshotDataStoreVO> snapshots = listBy(sc);
        // create an entry for each record, but with empty install path since the content is not yet on region-wide store yet
        if (snapshots != null) {
            s_logger.info("Duplicate " + snapshots.size() + " snapshot cache store records to region store");
            for (SnapshotDataStoreVO snap : snapshots) {
                SnapshotDataStoreVO snapStore = findByStoreSnapshot(DataStoreRole.Image, storeId, snap.getSnapshotId());
                if (snapStore != null) {
                    s_logger.info("There is already entry for snapshot " + snap.getSnapshotId() + " on region store " + storeId);
                    continue;
                }
                s_logger.info("Persisting an entry for snapshot " + snap.getSnapshotId() + " on region store " + storeId);
                SnapshotDataStoreVO ss = new SnapshotDataStoreVO();
                ss.setSnapshotId(snap.getSnapshotId());
                ss.setDataStoreId(storeId);
                ss.setRole(DataStoreRole.Image);
                ss.setVolumeId(snap.getVolumeId());
                ss.setParentSnapshotId(snap.getParentSnapshotId());
                ss.setState(snap.getState());
                ss.setSize(snap.getSize());
                ss.setPhysicalSize(snap.getPhysicalSize());
                ss.setRefCnt(snap.getRefCnt());
                persist(ss);
                // increase ref_cnt so that this will not be recycled before the content is pushed to region-wide store
                snap.incrRefCnt();
                update(snap.getId(), snap);
            }
View Full Code Here

        DataStore store = createDataStore();
        try {
            SnapshotInfo snapshotInfo = snapshotDataFactory.getSnapshot(snapshotVO.getId(), store);
            SnapshotResult result = snapshotService.takeSnapshot(snapshotInfo);
            Assert.assertTrue(result.isSuccess());
            SnapshotDataStoreVO storeRef = snapshotDataStoreDao.findByStoreSnapshot(store.getRole(), store.getId(), snapshotVO.getId());
            Assert.assertTrue(storeRef != null);
            Assert.assertTrue(storeRef.getState() == ObjectInDataStoreStateMachine.State.Ready);
            snapshotInfo = result.getSnashot();
            boolean deletResult = snapshotService.deleteSnapshot(snapshotInfo);
            Assert.assertTrue(deletResult);
            snapshotDataStoreDao.expunge(storeRef.getId());
        } finally {
            snapshotDao.expunge(snapshotVO.getId());
            primaryDataStoreDao.remove(store.getId());
        }
    }
View Full Code Here

            FakePrimaryDataStoreDriver dataStoreDriver = (FakePrimaryDataStoreDriver)store.getDriver();
            dataStoreDriver.makeTakeSnapshotSucceed(false);
            SnapshotInfo snapshotInfo = snapshotDataFactory.getSnapshot(snapshotVO.getId(), store);
            SnapshotResult result = snapshotService.takeSnapshot(snapshotInfo);
            Assert.assertFalse(result.isSuccess());
            SnapshotDataStoreVO storeRef = snapshotDataStoreDao.findByStoreSnapshot(store.getRole(), store.getId(), snapshotVO.getId());
            Assert.assertTrue(storeRef == null);
        } finally {
            snapshotDao.expunge(snapshotVO.getId());
            if (store != null) {
                primaryDataStoreDao.remove(store.getId());
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.