Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 3
0
 def test_extract_provider_location_none(self):
     self.assertIsNone(utils.extract_provider_location(None, 'abc'))
Exemplo n.º 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'))
Exemplo n.º 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'))
Exemplo n.º 6
0
 def test_extract_provider_location_none(self):
     self.assertIsNone(utils.extract_provider_location(None, 'abc'))
Exemplo n.º 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'))
Exemplo n.º 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'))