def create_volume_with_profile(self, dataset_id, size, profile_name): """Create a new volume on the array. :param dataset_id: The Flocker dataset ID for the volume. :param size: The size of the new volume in bytes. :param profile_name: The name of the storage profile for this volume. :return: A ``BlockDeviceVolume`` """ LOG.debug('Entering EMCVNXBlockAPI.create_volume_with_profile: ' 'dataset_id=%s, size=%s, profile_name', dataset_id, size, profile_name) # For VNX, only CapacityPoolScheduler is used to get a pool which # has the biggest capacity. pools = self._get_managed_storage_pools(self.pool_names) filter_properties = { 'size': size, } pool = self.scheduler.filter_one(pools, filter_properties) volume = loopback._blockdevicevolume_from_dataset_id( size=size, dataset_id=dataset_id) volume_name = self._build_volume_name_from_blockdevice_id( volume.blockdevice_id) volume_size = self._bytes_to_gib(size) self.client.create_lun(pool.name, volume_name, volume_size) LOG.debug('Exiting EMCVNXBlockAPI.create_volume_with_profile: ' 'pool=%s, volume_name=%s, volume_size=%s', pool.name, volume_name, volume_size) return volume
def create_volume_with_profile(self, dataset_id, size, profile_name): """Create a new volume on the array. :param dataset_id: The Flocker dataset ID for the volume. :param size: The size of the new volume in bytes. :param profile_name: The name of the storage profile for this volume. :return: A ``BlockDeviceVolume`` """ LOG.debug('Entering EMCUnityBlockAPI.create_volume_with_profile: ' 'dataset_id=%s, size=%s, profile_name=%s', dataset_id, size, profile_name) pools = self._get_managed_storage_pools(self.pool_names) if profile_name: filter_properties = { 'profile_name': profile_name.upper(), 'size': size, } pool = self.scheduler['profile'].filter_one( pools, filter_properties) else: filter_properties = { 'size': size, } pool = self.scheduler['capacity'].filter_one( pools, filter_properties) volume = loopback._blockdevicevolume_from_dataset_id( size=size, dataset_id=dataset_id) volume_name = self._build_volume_name_from_blockdevice_id( volume.blockdevice_id) volume_size = self._bytes_to_gib(size) self.client.create_lun(pool.name, volume_name, volume_size) LOG.debug('Exiting EMCUnityBlockAPI.create_volume_with_profile: ' 'pool=%s, volume_name=%s, volume_size=%s', pool.name, volume_name, volume_size) return volume
def create_volume(self, dataset_id, size): Message.new(operation=u'create_volume', dataset_id=str(dataset_id), size=size).write() volume = _blockdevicevolume_from_dataset_id( size=size, dataset_id=dataset_id ) lun_name = self._get_lun_name_from_blockdevice_id( volume.blockdevice_id ) rc, out = self._client.create_volume( lun_name, str(self._convert_volume_size(size)), self._pool ) Message.new(operation=u'create_volume_output', dataset_id=str(dataset_id), size=size, lun_name=lun_name, rc=rc, out=out).write() if rc != 0: raise Exception(rc, out) return volume