Search in sources :

Example 6 with TemplateInfo

use of com.cloud.storage.template.TemplateInfo in project CloudStack-archive by CloudStack-extras.

the class MockStorageManagerImpl method CreateStoragePool.

@Override
public Answer CreateStoragePool(CreateStoragePoolCommand cmd) {
    StorageFilerTO sf = cmd.getPool();
    MockStoragePoolVO storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid());
    if (storagePool == null) {
        storagePool = new MockStoragePoolVO();
        storagePool.setUuid(sf.getUuid());
        storagePool.setMountPoint("/mnt/" + sf.getUuid() + File.separator);
        Long size = DEFAULT_HOST_STORAGE_SIZE;
        String path = sf.getPath();
        int index = path.lastIndexOf("/");
        if (index != -1) {
            path = path.substring(index + 1);
            if (path != null) {
                String[] values = path.split("=");
                if (values.length > 1 && values[0].equalsIgnoreCase("size")) {
                    size = Long.parseLong(values[1]);
                }
            }
        }
        storagePool.setCapacity(size);
        storagePool.setStorageType(sf.getType());
        storagePool = _mockStoragePoolDao.persist(storagePool);
    }
    return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 0, new HashMap<String, TemplateInfo>());
}
Also used : TemplateInfo(com.cloud.storage.template.TemplateInfo) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer) MockStoragePoolVO(com.cloud.simulator.MockStoragePoolVO) StorageFilerTO(com.cloud.agent.api.to.StorageFilerTO)

Aggregations

TemplateInfo (com.cloud.storage.template.TemplateInfo)6 ModifyStoragePoolAnswer (com.cloud.agent.api.ModifyStoragePoolAnswer)5 Answer (com.cloud.agent.api.Answer)3 GetStorageStatsAnswer (com.cloud.agent.api.GetStorageStatsAnswer)3 CreateAnswer (com.cloud.agent.api.storage.CreateAnswer)3 PrimaryStorageDownloadAnswer (com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer)3 HashMap (java.util.HashMap)3 AttachVolumeAnswer (com.cloud.agent.api.AttachVolumeAnswer)2 BackupSnapshotAnswer (com.cloud.agent.api.BackupSnapshotAnswer)2 CheckHealthAnswer (com.cloud.agent.api.CheckHealthAnswer)2 CheckVirtualMachineAnswer (com.cloud.agent.api.CheckVirtualMachineAnswer)2 CreateVolumeFromSnapshotAnswer (com.cloud.agent.api.CreateVolumeFromSnapshotAnswer)2 GetHostStatsAnswer (com.cloud.agent.api.GetHostStatsAnswer)2 GetVmStatsAnswer (com.cloud.agent.api.GetVmStatsAnswer)2 ManageSnapshotAnswer (com.cloud.agent.api.ManageSnapshotAnswer)2 ReadyAnswer (com.cloud.agent.api.ReadyAnswer)2 RebootAnswer (com.cloud.agent.api.RebootAnswer)2 SecurityGroupRuleAnswer (com.cloud.agent.api.SecurityGroupRuleAnswer)2 StartAnswer (com.cloud.agent.api.StartAnswer)2 StopAnswer (com.cloud.agent.api.StopAnswer)2