Examples of StoragePoolVO


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

        this.dataStoreDao.update(pool.getId(), pool);
        return true;
    }

    public boolean cancelMaintain(DataStore store) {
        StoragePoolVO pool = this.dataStoreDao.findById(store.getId());
        pool.setStatus(StoragePoolStatus.Up);
        dataStoreDao.update(store.getId(), pool);
        return true;
    }
View Full Code Here

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

        return true;
    }

    public boolean deletePrimaryDataStore(DataStore store) {
        List<StoragePoolHostVO> hostPoolRecords = this.storagePoolHostDao.listByPoolId(store.getId());
        StoragePoolVO poolVO = this.dataStoreDao.findById(store.getId());
        Transaction txn = Transaction.currentTxn();
        txn.start();
        for (StoragePoolHostVO host : hostPoolRecords) {
            storagePoolHostDao.deleteStoragePoolHostDetails(host.getHostId(), host.getPoolId());
        }
        poolVO.setUuid(null);
        this.dataStoreDao.update(poolVO.getId(), poolVO);
        dataStoreDao.remove(poolVO.getId());
        deletePoolStats(poolVO.getId());
        // Delete op_host_capacity entries
        this._capacityDao.removeBy(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED, null, null, null, poolVO.getId());
        txn.commit();

        s_logger.debug("Storage pool id=" + poolVO.getId() + " is removed successfully");
        return true;
    }
View Full Code Here

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

             * DataStore store = lifeCycle.initialize(params); ClusterScope
             * scope = new ClusterScope(clusterId, podId, dcId);
             * lifeCycle.attachCluster(store, scope);
             */

            StoragePoolVO pool = new StoragePoolVO();
            pool.setClusterId(clusterId);
            pool.setDataCenterId(dcId);
            URI uri = new URI(this.getPrimaryStorageUrl());
            pool.setHostAddress(uri.getHost());
            pool.setPath(uri.getPath());
            pool.setPort(0);
            pool.setName(this.primaryName);
            pool.setUuid(this.getPrimaryStorageUuid());
            pool.setStatus(StoragePoolStatus.Up);
            pool.setPoolType(StoragePoolType.VMFS);
            pool.setPodId(podId);
            pool.setScope(ScopeType.CLUSTER);
            pool.setStorageProviderName("cloudstack primary data store provider");
            pool = this.primaryStoreDao.persist(pool);
            DataStore store = this.dataStoreMgr.getPrimaryDataStore(pool.getId());
            return store;
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

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

             * DataStore store = lifeCycle.initialize(params); ClusterScope
             * scope = new ClusterScope(clusterId, podId, dcId);
             * lifeCycle.attachCluster(store, scope);
             */

            StoragePoolVO pool = new StoragePoolVO();
            pool.setClusterId(clusterId);
            pool.setDataCenterId(dcId);
            URI uri = new URI(this.getPrimaryStorageUrl());
            pool.setHostAddress(uri.getHost());
            pool.setPath(uri.getPath());
            pool.setPort(0);
            pool.setName(this.primaryName);
            pool.setUuid(this.getPrimaryStorageUuid());
            pool.setStatus(StoragePoolStatus.Up);
            pool.setPoolType(StoragePoolType.NetworkFilesystem);
            pool.setPodId(podId);
            pool.setScope(ScopeType.CLUSTER);
            pool.setStorageProviderName(DataStoreProvider.DEFAULT_PRIMARY);
            pool = this.primaryStoreDao.persist(pool);
            DataStore store = this.dataStoreMgr.getPrimaryDataStore(pool.getId());
            return store;
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

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

        List<StoragePoolVO> pools = primaryDataStoreDao.findPoolByName(uuid);
        if (pools.size() > 0) {
            return dataStoreManager.getPrimaryDataStore(pools.get(0).getId());
        }

        StoragePoolVO pool = new StoragePoolVO();
        if (scope != ScopeType.ZONE) {
            pool.setClusterId(clusterId);
        }
        pool.setDataCenterId(dcId);

        pool.setHostAddress(uuid);
        pool.setPath(uuid);
        pool.setPort(0);
        pool.setName(uuid);
        pool.setUuid(uuid);
        pool.setStatus(StoragePoolStatus.Up);
        pool.setPoolType(Storage.StoragePoolType.NetworkFilesystem);
        pool.setPodId(podId);
        pool.setScope(scope);
        pool.setStorageProviderName(DataStoreProvider.DEFAULT_PRIMARY);
        pool = primaryDataStoreDao.persist(pool);
        DataStore store = dataStoreManager.getPrimaryDataStore(pool.getId());
        return store;
    }
View Full Code Here

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

        cluster.setManagedState(ManagedState.Managed);
        cluster = clusterDao.persist(cluster);
        clusterId = cluster.getId();

        DataStoreProvider provider = providerMgr.getDataStoreProvider(DataStoreProvider.DEFAULT_PRIMARY);
        storage = new StoragePoolVO();
        storage.setDataCenterId(dcId);
        storage.setPodId(podId);
        storage.setPoolType(StoragePoolType.NetworkFilesystem);
        storage.setClusterId(clusterId);
        storage.setStatus(StoragePoolStatus.Up);
View Full Code Here

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

        Long newStorageId = null;
        try {
            createDb();

            DataStoreProvider provider = providerMgr.getDataStoreProvider(DataStoreProvider.DEFAULT_PRIMARY);
            storage = new StoragePoolVO();
            storage.setDataCenterId(dcId);
            storage.setPodId(podId);
            storage.setPoolType(StoragePoolType.NetworkFilesystem);
            storage.setClusterId(clusterId);
            storage.setStatus(StoragePoolStatus.Up);
            storage.setScope(ScopeType.CLUSTER);
            storage.setUsedBytes(1000);
            storage.setCapacityBytes(20000);
            storage.setHostAddress(UUID.randomUUID().toString());
            storage.setPath(UUID.randomUUID().toString());
            storage.setStorageProviderName(provider.getName());
            StoragePoolVO newStorage = storagePoolDao.persist(storage);
            newStorageId = newStorage.getId();

            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
View Full Code Here

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

    @Test
    public void testZoneWideStorageAllocator() {
        try {
            createDb();

            StoragePoolVO pool = storagePoolDao.findById(storagePoolId);
            pool.setHypervisor(HypervisorType.KVM);
            pool.setScope(ScopeType.ZONE);
            pool.setClusterId(null);
            pool.setPodId(null);
            storagePoolDao.update(pool.getId(), pool);

            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.KVM);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(vmProfile.getHypervisorType()).thenReturn(HypervisorType.KVM);
            Mockito.when(
View Full Code Here

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

    @Test
    public void testCLOUDSTACK3481() {
      try {
          createDb();

          StoragePoolVO pool = storagePoolDao.findById(storagePoolId);
          pool.setHypervisor(HypervisorType.KVM);
          pool.setScope(ScopeType.ZONE);
          pool.setClusterId(null);
          pool.setPodId(null);
          storagePoolDao.update(pool.getId(), pool);


          DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.KVM);
          VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
          Account account = Mockito.mock(Account.class);
View Full Code Here

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

    @Test
    public void testPoolStateIsNotUp() {
        try {
            createDb();

            StoragePoolVO pool = storagePoolDao.findById(storagePoolId);
            pool.setScope(ScopeType.ZONE);
            pool.setStatus(StoragePoolStatus.Maintenance);
            storagePoolDao.update(pool.getId(), pool);

            DiskProfile profile = new DiskProfile(volume, diskOffering, HypervisorType.XenServer);
            VirtualMachineProfile vmProfile = Mockito.mock(VirtualMachineProfile.class);
            Mockito.when(
                    storageMgr.storagePoolHasEnoughSpace(Matchers.anyListOf(Volume.class),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.