if (volumes.get(volume.getUuid()) != null)
{
throw new PluginException("Volume already exists");
}
Volume created = new Volume();
created.setUuid(volume.getUuid());
created.setSizeInMB(volume.getSizeInMB());
created.setAvailableInMB(volume.getSizeInMB());
created.setUsedInMB(0L);
created.setAddress(Address.iscsi(device.getServiceIp(), device.getServicePort(),
"iqn.1993-08.org.debian:01:b22bb69c97d3", 0));
volumes.put(created.getUuid(), created);
// Update the available size in the pool
Pool updatedPool = pools.get(pool.getName());
updatedPool.setUsedInMB(updatedPool.getUsedInMB() + created.getSizeInMB());
updatedPool.setAvailableInMB(updatedPool.getSizeInMB() - updatedPool.getUsedInMB());
return created;
}