Package org.apache.cloudstack.storage.volume.db

Examples of org.apache.cloudstack.storage.volume.db.VolumeVO


        return false;
    }

    @Override
    public VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId) {
        VolumeVO vo = volDao.allocVolume(size, type, volName, templateId);
        return new VolumeEntityImpl(VolumeObject.getVolumeObject(null, vo), this);
    }
View Full Code Here


        return new VolumeEntityImpl(VolumeObject.getVolumeObject(null, vo), this);
    }

    @Override
    public VolumeEntity getVolumeEntity(long volumeId) {
        VolumeVO vo = volDao.findById(volumeId);
        if (vo == null) {
            return null;
        }

        if (vo.getPoolId() == null) {
            return new VolumeEntityImpl(VolumeObject.getVolumeObject(null, vo), this);
        } else {
            PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(vo.getPoolId());
            return new VolumeEntityImpl(dataStore.getVolume(volumeId), this);
        }
    }
View Full Code Here

        return dataStore;
    }

    @Override
    public VolumeInfo getVolume(long id) {
        VolumeVO volumeVO = volumeDao.findById(id);
        VolumeObject vol = VolumeObject.getVolumeObject(this, volumeVO);
        return vol;
    }
View Full Code Here

    ObjectInDataStoreManager objMap;
    @Inject
    DataStoreManager storeMgr;
    @Override
    public VolumeInfo getVolume(long volumeId, DataStore store) {
        VolumeVO volumeVO = volumeDao.findById(volumeId);
        ObjectInDataStoreVO obj = objMap.findObject(volumeId, DataObjectType.VOLUME, store.getId(), store.getRole());
        if (obj == null) {
            VolumeObject vol = VolumeObject.getVolumeObject(null, volumeVO);
            return vol;
        }
View Full Code Here

      return null;
    }
  }

  private VolumeVO createVolume(Long templateId, long dataStoreId) {
    VolumeVO volume = new VolumeVO(1000, new RootDisk().toString(), UUID.randomUUID().toString(), templateId);
    volume.setPoolId(dataStoreId);
    volume = volumeDao.persist(volume);
    return volume;
  }
View Full Code Here

  @Test(priority=2)
  public void createVolumeFromTemplate() {
      DataStore primaryStore = this.primaryStore;
    TemplateInfo te = createTemplate();
    VolumeVO volume = createVolume(te.getId(), primaryStore.getId());
    VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
    //ve.createVolumeFromTemplate(primaryStore.getId(), new VHD(), te);
    AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeFromTemplateAsync(vol, primaryStore.getId(), te);
    try {
            future.get();
        } catch (InterruptedException e) {
View Full Code Here

  }
 
  //@Test(priority=3)
  public void createDataDisk() {
      DataStore primaryStore = this.primaryStore;
      VolumeVO volume = createVolume(null, primaryStore.getId());
      VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
      AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeAsync(vol, primaryStore.getId());
      try {
            future.get();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
View Full Code Here

  }
 
  //@Test(priority=3)
  public void createAndDeleteDataDisk() {
      DataStore primaryStore = this.primaryStore;
      VolumeVO volume = createVolume(null, primaryStore.getId());
      VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore);
      AsyncCallFuture<VolumeApiResult> future = volumeService.createVolumeAsync(vol, primaryStore.getId());
      try {
          future.get();
      } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      } catch (ExecutionException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
     
      //delete the volume
      vol = volumeFactory.getVolume(volume.getId(), primaryStore);
      future = volumeService.deleteVolumeAsync(vol);
      try {
            future.get();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
View Full Code Here

TOP

Related Classes of org.apache.cloudstack.storage.volume.db.VolumeVO

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.