Exemple #1
0
    def get_lun_id(self, volume):
        """Retrieves id of the volume's backing LUN.

        :param volume: volume information
        """
        if volume.provider_location:
            return utils.extract_provider_location(volume.provider_location,
                                                   'id')
        else:
            # In some cases, cinder will not update volume info in DB with
            # provider_location returned by us. We need to retrieve the id
            # from array.
            lun = self.client.get_lun(name=volume.name)
            return lun.get_id() if lun is not None else None
Exemple #2
0
    def get_lun_id(self, volume):
        """Retrieves id of the volume's backing LUN.

        :param volume: volume information
        """
        if volume.provider_location:
            return utils.extract_provider_location(volume.provider_location,
                                                   'id')
        else:
            # In some cases, cinder will not update volume info in DB with
            # provider_location returned by us. We need to retrieve the id
            # from array.
            lun = self.client.get_lun(name=volume.name)
            return lun.get_id() if lun is not None else None
Exemple #3
0
 def test_extract_provider_location_none(self):
     self.assertIsNone(utils.extract_provider_location(None, 'abc'))
Exemple #4
0
 def test_extract_provider_location_not_found(self):
     location = 'id^ev_1|system^unity|type^thin|version^3'
     self.assertIsNone(utils.extract_provider_location(location, 'na'))
Exemple #5
0
 def test_extract_provider_location_id(self):
     location = 'id^ev_1|system^unity|type^thin|version^3'
     self.assertEqual('ev_1',
                      utils.extract_provider_location(location, 'id'))
Exemple #6
0
 def test_extract_provider_location_none(self):
     self.assertIsNone(utils.extract_provider_location(None, 'abc'))
Exemple #7
0
 def test_extract_provider_location_not_found(self):
     location = 'id^ev_1|system^unity|type^thin|version^3'
     self.assertIsNone(utils.extract_provider_location(location, 'na'))
Exemple #8
0
 def test_extract_provider_location_id(self):
     location = 'id^ev_1|system^unity|type^thin|version^3'
     self.assertEqual('ev_1',
                      utils.extract_provider_location(location, 'id'))