~ubuntu-branches/debian/stretch/waagent/stretch

« back to all changes in this revision

Viewing changes to azurelinuxagent/pa/rdma/factory.py

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2016-08-24 16:48:22 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20160824164822-vdf8m5xy5gycm1cz
Tags: 2.1.6-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2016 Microsoft Corporation
 
2
#
 
3
# Licensed under the Apache License, Version 2.0 (the "License");
 
4
# you may not use this file except in compliance with the License.
 
5
# You may obtain a copy of the License at
 
6
#
 
7
#     http://www.apache.org/licenses/LICENSE-2.0
 
8
#
 
9
# Unless required by applicable law or agreed to in writing, software
 
10
# distributed under the License is distributed on an "AS IS" BASIS,
 
11
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
12
# See the License for the specific language governing permissions and
 
13
# limitations under the License.
 
14
#
 
15
# Requires Python 2.4+ and Openssl 1.0+
 
16
#
 
17
 
 
18
import azurelinuxagent.common.logger as logger
 
19
 
 
20
from azurelinuxagent.common.version import DISTRO_FULL_NAME, DISTRO_VERSION
 
21
from azurelinuxagent.common.rdma import RDMAHandler
 
22
from .suse import SUSERDMAHandler
 
23
from .centos import CentOSRDMAHandler
 
24
 
 
25
 
 
26
def get_rdma_handler(
 
27
        distro_full_name=DISTRO_FULL_NAME,
 
28
        distro_version=DISTRO_VERSION
 
29
):
 
30
    """Return the handler object for RDMA driver handling"""
 
31
    if (
 
32
            distro_full_name == 'SUSE Linux Enterprise Server' and
 
33
            int(distro_version) > 11
 
34
    ):
 
35
        return SUSERDMAHandler()
 
36
 
 
37
    if distro_full_name == 'CentOS Linux' or distro_full_name == 'CentOS':
 
38
        return CentOSRDMAHandler(distro_version)
 
39
 
 
40
    logger.info("No RDMA handler exists for distro='{0}' version='{1}'", distro_full_name, distro_version)
 
41
    return RDMAHandler()