コード例 #1
0
ファイル: test_volume_mapping.py プロジェクト: ppatel826/zun
 def test_get_volume_mapping_by_uuid(self, mock_write, mock_read):
     mock_read.side_effect = etcd.EtcdKeyNotFound
     volume_mapping = utils.create_test_volume_mapping(context=self.context)
     mock_read.side_effect = lambda *args: FakeEtcdResult(volume_mapping.
                                                          as_dict())
     res = dbapi.get_volume_mapping_by_uuid(self.context,
                                            volume_mapping.uuid)
     self.assertEqual(volume_mapping.id, res.id)
     self.assertEqual(volume_mapping.uuid, res.uuid)
コード例 #2
0
    def get_by_uuid(cls, context, uuid):
        """Find a volume mapping based on uuid.

        :param uuid: the uuid of a volume mapping.
        :param context: Security context
        :returns: a :class:`VolumeMapping` object.
        """
        db_volume = dbapi.get_volume_mapping_by_uuid(context, uuid)
        volume = VolumeMapping._from_db_object(cls(context), db_volume)
        return volume
コード例 #3
0
ファイル: volume_mapping.py プロジェクト: openstack/higgins
    def get_by_uuid(cls, context, uuid):
        """Find a volume mapping based on uuid.

        :param uuid: the uuid of a volume mapping.
        :param context: Security context
        :returns: a :class:`VolumeMapping` object.
        """
        db_volume = dbapi.get_volume_mapping_by_uuid(context, uuid)
        volume = VolumeMapping._from_db_object(cls(context), db_volume)
        return volume
コード例 #4
0
 def test_get_volume_mapping_by_uuid(self):
     volume_mapping = utils.create_test_volume_mapping(context=self.context)
     res = dbapi.get_volume_mapping_by_uuid(self.context,
                                            volume_mapping.uuid)
     self.assertEqual(volume_mapping.id, res.id)
     self.assertEqual(volume_mapping.uuid, res.uuid)
コード例 #5
0
 def test_get_volume_mapping_by_uuid(self):
     volume_mapping = utils.create_test_volume_mapping(context=self.context)
     res = dbapi.get_volume_mapping_by_uuid(self.context,
                                            volume_mapping.uuid)
     self.assertEqual(volume_mapping.id, res.id)
     self.assertEqual(volume_mapping.uuid, res.uuid)