def create_volume(self, size, name, location=None, snapshot=None):
        """
        Creates a data volume
        Defaults to the first location
        """
        for diskOffering in self.ex_list_disk_offerings():
            if diskOffering.size == size or diskOffering.customizable:
                break
        else:
            raise LibcloudError(
                'Disk offering with size=%s not found' % size)

        if location is None:
            location = self.list_locations()[0]

        params = {'name': name,
                  'diskOfferingId': diskOffering.id,
                  'zoneId': location.id}

        if diskOffering.customizable:
            params['size'] = size

        requestResult = self._async_request(command='createVolume',
                                            params=params,
                                            method='GET')

        volumeResponse = requestResult['volume']

        state = self._to_volume_state(volumeResponse)

        return StorageVolume(id=volumeResponse['id'],
                             name=name,
                             size=size,
                             state=state,
                             driver=self,
                             extra=dict(name=volumeResponse['name']))
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/cloudstack.py/CloudStackNodeDriver.create_volume/original