Search in sources :

Example 1 with TemplateInfo

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

the class LibvirtComputingResource method execute.

protected Answer execute(ModifyStoragePoolCommand cmd) {
    KVMStoragePool storagepool = _storagePoolMgr.createStoragePool(cmd.getPool().getUuid(), cmd.getPool().getHost(), cmd.getPool().getPath(), cmd.getPool().getType());
    if (storagepool == null) {
        return new Answer(cmd, false, " Failed to create storage pool");
    }
    Map<String, TemplateInfo> tInfo = new HashMap<String, TemplateInfo>();
    ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(cmd, storagepool.getCapacity(), storagepool.getUsed(), tInfo);
    return answer;
}
Also used : FenceAnswer(com.cloud.agent.api.FenceAnswer) ConsoleProxyLoadAnswer(com.cloud.agent.api.proxy.ConsoleProxyLoadAnswer) DeleteSnapshotBackupAnswer(com.cloud.agent.api.DeleteSnapshotBackupAnswer) MaintainAnswer(com.cloud.agent.api.MaintainAnswer) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) CheckSshAnswer(com.cloud.agent.api.check.CheckSshAnswer) GetVncPortAnswer(com.cloud.agent.api.GetVncPortAnswer) RebootAnswer(com.cloud.agent.api.RebootAnswer) ManageSnapshotAnswer(com.cloud.agent.api.ManageSnapshotAnswer) CreatePrivateTemplateAnswer(com.cloud.agent.api.storage.CreatePrivateTemplateAnswer) AttachVolumeAnswer(com.cloud.agent.api.AttachVolumeAnswer) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer) PrimaryStorageDownloadAnswer(com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer) CreateAnswer(com.cloud.agent.api.storage.CreateAnswer) StartAnswer(com.cloud.agent.api.StartAnswer) GetStorageStatsAnswer(com.cloud.agent.api.GetStorageStatsAnswer) MigrateAnswer(com.cloud.agent.api.MigrateAnswer) CreateVolumeFromSnapshotAnswer(com.cloud.agent.api.CreateVolumeFromSnapshotAnswer) CheckNetworkAnswer(com.cloud.agent.api.CheckNetworkAnswer) GetVmStatsAnswer(com.cloud.agent.api.GetVmStatsAnswer) StopAnswer(com.cloud.agent.api.StopAnswer) NetworkUsageAnswer(com.cloud.agent.api.NetworkUsageAnswer) Answer(com.cloud.agent.api.Answer) BackupSnapshotAnswer(com.cloud.agent.api.BackupSnapshotAnswer) CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) IpAssocAnswer(com.cloud.agent.api.routing.IpAssocAnswer) CheckHealthAnswer(com.cloud.agent.api.CheckHealthAnswer) CopyVolumeAnswer(com.cloud.agent.api.storage.CopyVolumeAnswer) ReadyAnswer(com.cloud.agent.api.ReadyAnswer) PrepareForMigrationAnswer(com.cloud.agent.api.PrepareForMigrationAnswer) SecurityGroupRuleAnswer(com.cloud.agent.api.SecurityGroupRuleAnswer) TemplateInfo(com.cloud.storage.template.TemplateInfo) KVMStoragePool(com.cloud.agent.storage.KVMStoragePool) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer)

Example 2 with TemplateInfo

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

the class MockStorageManagerImpl method ListTemplates.

@Override
public Answer ListTemplates(ListTemplateCommand cmd) {
    MockSecStorageVO storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl());
    if (storage == null) {
        return new Answer(cmd, false, "Failed to get secondary storage");
    }
    List<MockVolumeVO> templates = _mockVolumeDao.findByStorageIdAndType(storage.getId(), MockVolumeType.TEMPLATE);
    Map<String, TemplateInfo> templateInfos = new HashMap<String, TemplateInfo>();
    for (MockVolumeVO template : templates) {
        templateInfos.put(template.getName(), new TemplateInfo(template.getName(), template.getPath().replaceAll(storage.getMountPoint(), ""), template.getSize(), template.getSize(), true, false));
    }
    return new ListTemplateAnswer(cmd.getSecUrl(), templateInfos);
}
Also used : DownloadAnswer(com.cloud.agent.api.storage.DownloadAnswer) Answer(com.cloud.agent.api.Answer) BackupSnapshotAnswer(com.cloud.agent.api.BackupSnapshotAnswer) ListTemplateAnswer(com.cloud.agent.api.storage.ListTemplateAnswer) ManageSnapshotAnswer(com.cloud.agent.api.ManageSnapshotAnswer) CreatePrivateTemplateAnswer(com.cloud.agent.api.storage.CreatePrivateTemplateAnswer) AttachVolumeAnswer(com.cloud.agent.api.AttachVolumeAnswer) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer) PrimaryStorageDownloadAnswer(com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer) CopyVolumeAnswer(com.cloud.agent.api.storage.CopyVolumeAnswer) CreateAnswer(com.cloud.agent.api.storage.CreateAnswer) GetStorageStatsAnswer(com.cloud.agent.api.GetStorageStatsAnswer) CreateVolumeFromSnapshotAnswer(com.cloud.agent.api.CreateVolumeFromSnapshotAnswer) SecStorageSetupAnswer(com.cloud.agent.api.SecStorageSetupAnswer) TemplateInfo(com.cloud.storage.template.TemplateInfo) HashMap(java.util.HashMap) ListTemplateAnswer(com.cloud.agent.api.storage.ListTemplateAnswer) MockSecStorageVO(com.cloud.simulator.MockSecStorageVO) MockVolumeVO(com.cloud.simulator.MockVolumeVO)

Example 3 with TemplateInfo

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

the class FakeComputingResource method execute.

private Answer execute(ModifyStoragePoolCommand cmd) {
    long capacity = getConfiguredProperty("local.storage.capacity", 10000000000L);
    long used = 10000000L;
    long available = capacity - used;
    if (cmd.getAdd()) {
        ModifyStoragePoolAnswer answer = new ModifyStoragePoolAnswer(cmd, capacity, used, new HashMap<String, TemplateInfo>());
        if (s_logger.isInfoEnabled())
            s_logger.info("Sending ModifyStoragePoolCommand answer with capacity: " + capacity + ", used: " + used + ", available: " + available);
        return answer;
    } else {
        if (s_logger.isInfoEnabled())
            s_logger.info("ModifyNetfsStoragePoolCmd is not add command, cmd: " + cmd.toString());
        return new Answer(cmd);
    }
}
Also used : StopAnswer(com.cloud.agent.api.StopAnswer) Answer(com.cloud.agent.api.Answer) GetHostStatsAnswer(com.cloud.agent.api.GetHostStatsAnswer) CheckVirtualMachineAnswer(com.cloud.agent.api.CheckVirtualMachineAnswer) RebootAnswer(com.cloud.agent.api.RebootAnswer) CheckHealthAnswer(com.cloud.agent.api.CheckHealthAnswer) CheckStateAnswer(com.cloud.agent.api.CheckStateAnswer) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer) PrimaryStorageDownloadAnswer(com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer) CreateAnswer(com.cloud.agent.api.storage.CreateAnswer) ReadyAnswer(com.cloud.agent.api.ReadyAnswer) StartAnswer(com.cloud.agent.api.StartAnswer) GetStorageStatsAnswer(com.cloud.agent.api.GetStorageStatsAnswer) GetVmStatsAnswer(com.cloud.agent.api.GetVmStatsAnswer) SecurityGroupRuleAnswer(com.cloud.agent.api.SecurityGroupRuleAnswer) TemplateInfo(com.cloud.storage.template.TemplateInfo) ModifyStoragePoolAnswer(com.cloud.agent.api.ModifyStoragePoolAnswer)

Example 4 with TemplateInfo

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

the class AgentRoutingResource method initializeLocalSR.

private StartupStorageCommand initializeLocalSR() {
    Map<String, TemplateInfo> tInfo = new HashMap<String, TemplateInfo>();
    StoragePoolInfo poolInfo = _simMgr.getLocalStorage(hostGuid);
    StartupStorageCommand cmd = new StartupStorageCommand(poolInfo.getHostPath(), poolInfo.getPoolType(), poolInfo.getCapacityBytes(), tInfo);
    cmd.setPoolInfo(poolInfo);
    cmd.setGuid(agentHost.getGuid());
    cmd.setResourceType(StorageResourceType.STORAGE_POOL);
    return cmd;
}
Also used : TemplateInfo(com.cloud.storage.template.TemplateInfo) HashMap(java.util.HashMap) StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StoragePoolInfo(com.cloud.agent.api.StoragePoolInfo)

Example 5 with TemplateInfo

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

the class MockStorageManagerImpl method ModifyStoragePool.

@Override
public ModifyStoragePoolAnswer ModifyStoragePool(ModifyStoragePoolCommand 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