Package com.abiquo.ssm.model

Examples of com.abiquo.ssm.model.Volume


    @Override
    public Volume getVolume(final Device device, final Pool pool, final String uuid)
        throws PluginException
    {
        Volume volume = volumes.get(uuid);
        if (volume == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }
        return volume;
View Full Code Here


        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);
       
        IscsiAddress iscsiAddress = new IscsiAddress();
        iscsiAddress.setPortal(device.getIp());
        iscsiAddress.setIqn("iqn.1993-08.org.debian:01:b22bb69c97d3");
        iscsiAddress.setLun(0);
        created.setIscsiAddress(iscsiAddress);

        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;
    }
View Full Code Here

        if (volumes.get(uuid) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume removed = volumes.remove(uuid);

        // Update the available size in the pool
        Pool updatedPool = pools.get(pool.getName());
        updatedPool.setUsedInMB(updatedPool.getUsedInMB() - removed.getSizeInMB());
        updatedPool.setAvailableInMB(updatedPool.getSizeInMB() - updatedPool.getUsedInMB());
    }
View Full Code Here

        if (volumes.get(volume.getUuid()) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume original = volumes.get(volume.getUuid());
        Volume resize = new Volume();
        resize.setUuid(original.getUuid());
        resize.setIscsiAddress(original.getIscsiAddress());
        // Update size
        resize.setSizeInMB(volume.getSizeInMB());
        resize.setAvailableInMB(volume.getSizeInMB());
        resize.setUsedInMB(0L);

        volumes.put(volume.getUuid(), resize);

        long sizeIncrement = volume.getSizeInMB() - original.getSizeInMB();
View Full Code Here

    public IscsiAddress grantAccess(final Device device, final Pool pool, final String ostype,
        final String initiatorIQN, final String volumeUuid) throws PluginException
    {
        // Validate pool and volume existance
        getPool(device, pool.getName());
        Volume volume = getVolume(device, pool, volumeUuid);

        return volume.getIscsiAddress();
    }
View Full Code Here

    @Override
    public Volume getVolume(final Device device, final Pool pool, final String uuid)
        throws PluginException
    {
        Volume volume = volumes.get(uuid);
        if (volume == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }
        return volume;
View Full Code Here

        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.getIp(), device.getPort(),
            "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;
    }
View Full Code Here

        if (volumes.get(uuid) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume removed = volumes.remove(uuid);

        // Update the available size in the pool
        Pool updatedPool = pools.get(pool.getName());
        updatedPool.setUsedInMB(updatedPool.getUsedInMB() - removed.getSizeInMB());
        updatedPool.setAvailableInMB(updatedPool.getSizeInMB() - updatedPool.getUsedInMB());
    }
View Full Code Here

        if (volumes.get(volume.getUuid()) == null)
        {
            throw new PluginException(PluginError.RESOURCE_NOT_FOUND, "Unexisting volume");
        }

        Volume original = volumes.get(volume.getUuid());
        Volume resize = new Volume();
        resize.setUuid(original.getUuid());
        resize.setAddress(original.getAddress());
        // Update size
        resize.setSizeInMB(volume.getSizeInMB());
        resize.setAvailableInMB(volume.getSizeInMB());
        resize.setUsedInMB(0L);

        volumes.put(volume.getUuid(), resize);

        long sizeIncrement = volume.getSizeInMB() - original.getSizeInMB();
View Full Code Here

    public Address grantAccess(final Device device, final Pool pool, final String volumeUuid,
        final ClientDetails clientDetails) throws PluginException
    {
        // Validate pool and volume existance
        getPool(device, pool.getName());
        Volume volume = getVolume(device, pool, volumeUuid);

        return volume.getAddress();
    }
View Full Code Here

TOP

Related Classes of com.abiquo.ssm.model.Volume

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.