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>());
}
Aggregations