Package org.apache.cloudstack.engine.subsystem.api.storage

Examples of org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore


        return false;
    }

    @Override
    public boolean update(DataObject data, Event event) throws NoTransitionException, ConcurrentOperationException {
        DataObjectInStore obj = this.findObject(data, data.getDataStore());
        if (obj == null) {
            throw new CloudRuntimeException("can't find mapping in ObjectInDataStore table for: " + data);
        }

        boolean result = true;
View Full Code Here


        return findObject(obj.getId(), obj.getType(), store.getId(), store.getRole());
    }

    @Override
    public DataObjectInStore findObject(long objId, DataObjectType type, long dataStoreId, DataStoreRole role) {
        DataObjectInStore vo = null;
        if (role == DataStoreRole.Image || role == DataStoreRole.ImageCache) {
            switch (type) {
            case TEMPLATE:
                vo = templateDataStoreDao.findByStoreTemplate(dataStoreId, objId);
                break;
View Full Code Here

    @Override
    public DataStore findStore(long objId, DataObjectType type, DataStoreRole role) {
        DataStore store = null;
        if (role == DataStoreRole.Image) {
            DataObjectInStore vo = null;
            switch (type) {
            case TEMPLATE:
                vo = templateDataStoreDao.findByTemplate(objId, role);
                break;
            case SNAPSHOT:
                vo = snapshotDataStoreDao.findBySnapshot(objId, role);
                break;
            case VOLUME:
                vo = volumeDataStoreDao.findByVolume(objId);
                break;
            }
            if (vo != null) {
                store = this.storeMgr.getDataStore(vo.getDataStoreId(), role);
            }
        }
        return store;
    }
View Full Code Here

    @Override
    public String getUri() {
        if (this.dataStore == null) {
            throw new CloudRuntimeException("datastore must be set before using this object");
        }
        DataObjectInStore obj = objectInStoreMgr.findObject(this.volumeVO.getId(), DataObjectType.VOLUME,
                this.dataStore.getId(), this.dataStore.getRole());
        if (obj.getState() != ObjectInDataStoreStateMachine.State.Ready) {
            return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&"
                    + EncodingType.SIZE + "=" + this.volumeVO.getSize() + "&" + EncodingType.NAME + "="
                    + this.volumeVO.getName();
        } else {
            return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&"
                    + EncodingType.PATH + "=" + obj.getInstallPath();
        }
    }
View Full Code Here

    @Override
    public String getPath() {
        if (this.dataStore.getRole() == DataStoreRole.Primary) {
            return this.volumeVO.getPath();
        } else {
            DataObjectInStore objInStore = this.objectInStoreMgr.findObject(this, dataStore);
            if (objInStore != null) {
                return objInStore.getInstallPath();
            } else {
                return null;
            }
        }
    }
View Full Code Here

        return true;
    }

    @Override
    public DataObject createCacheObject(DataObject data, DataStore store) {
        DataObjectInStore obj = objectInStoreMgr.findObject(data, store);
        if (obj != null && obj.getState() == ObjectInDataStoreStateMachine.State.Ready) {
            s_logger.debug("there is already one in the cache store");
            DataObject dataObj = objectInStoreMgr.get(data, store);
            dataObj.incRefCount();
            return dataObj;
        }
View Full Code Here

            return installPath;

        if (dataStore == null) {
            return null;
        }
        DataObjectInStore obj = objectInStoreMgr.findObject(this, dataStore);
        return obj.getInstallPath();
    }
View Full Code Here

    @Override
    public String getUri() {
        if (this.dataStore == null) {
            throw new CloudRuntimeException("datastore must be set before using this object");
        }
        DataObjectInStore obj = objectInStoreMgr.findObject(this.volumeVO.getId(), DataObjectType.VOLUME,
                this.dataStore.getId(), this.dataStore.getRole());
        if (obj.getState() != ObjectInDataStoreStateMachine.State.Ready) {
            return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&"
                    + EncodingType.SIZE + "=" + this.volumeVO.getSize() + "&" + EncodingType.NAME + "="
                    + this.volumeVO.getName();
        } else {
            return this.dataStore.getUri() + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + "&"
                    + EncodingType.PATH + "=" + obj.getInstallPath();
        }
    }
View Full Code Here

    @Override
    public String getPath() {
        if (this.dataStore.getRole() == DataStoreRole.Primary) {
            return this.volumeVO.getPath();
        } else {
            DataObjectInStore objInStore = this.objectInStoreMgr.findObject(this, dataStore);
            if (objInStore != null) {
                return objInStore.getInstallPath();
            } else {
                return null;
            }
        }
    }
View Full Code Here

        }
       
        // if there are multiple cache stores, we give priority to the one where data is already there
        if (cacheStores.size() > 1) {
            for (DataStore store : cacheStores) {
                DataObjectInStore obj = objectInStoreMgr.findObject(data, store);
                if (obj != null && obj.getState() == ObjectInDataStoreStateMachine.State.Ready) {
                    s_logger.debug("pick the cache store " + store.getId() + " where data is already there");
                    return store;
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore

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.