Beispiel #1
0
    def manage_existing_get_size(self, volume, existing_ref):
        """Returns size of volume to be managed by `manage_existing`.

        The driver does some check here:
        1. The LUN `existing_ref` should be managed by the `volume.host`.
        """
        lun = self._get_referenced_lun(existing_ref)
        target_pool_name = utils.get_pool_name(volume)
        lun_pool_name = lun.pool.name
        if target_pool_name and lun_pool_name != target_pool_name:
            reason = (_('The imported LUN is in pool %(pool_name)s '
                        'which is not managed by the host %(host)s.') %
                      {'pool_name': lun_pool_name,
                       'host': volume.host})
            raise exception.ManageExistingInvalidReference(
                existing_ref=existing_ref, reason=reason)

        return utils.byte_to_gib(lun.size_total)
Beispiel #2
0
    def manage_existing_get_size(self, volume, existing_ref):
        """Returns size of volume to be managed by `manage_existing`.

        The driver does some check here:
        1. The LUN `existing_ref` should be managed by the `volume.host`.
        """
        lun = self._get_referenced_lun(existing_ref)
        target_pool_name = utils.get_pool_name(volume)
        lun_pool_name = lun.pool.name
        if target_pool_name and lun_pool_name != target_pool_name:
            reason = (_('The imported LUN is in pool %(pool_name)s '
                        'which is not managed by the host %(host)s.') %
                      {'pool_name': lun_pool_name,
                       'host': volume.host})
            raise exception.ManageExistingInvalidReference(
                existing_ref=existing_ref, reason=reason)

        return utils.byte_to_gib(lun.size_total)
Beispiel #3
0
 def _get_target_pool(self, volume):
     return self.storage_pools_map[utils.get_pool_name(volume)]
Beispiel #4
0
 def test_get_pool_name(self):
     volume = test_adapter.MockOSResource(host='host@backend#pool_name')
     self.assertEqual('pool_name', utils.get_pool_name(volume))
Beispiel #5
0
 def test_get_pool_name(self):
     volume = mock.Mock(host='host@backend#pool_name')
     self.assertEqual('pool_name', utils.get_pool_name(volume))
Beispiel #6
0
 def test_get_pool_name(self):
     volume = test_adapter.MockOSResource(host='host@backend#pool_name')
     self.assertEqual('pool_name', utils.get_pool_name(volume))
Beispiel #7
0
 def test_get_pool_name(self):
     volume = mock.Mock(host='host@backend#pool_name')
     self.assertEqual('pool_name', utils.get_pool_name(volume))
Beispiel #8
0
 def _get_target_pool(self, volume):
     return self.storage_pools_map[utils.get_pool_name(volume)]