aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/ceilometer_compute/vars
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/ceilometer_compute/vars')
-rw-r--r--deploy/adapters/ansible/roles/ceilometer_compute/vars/Debian.yml17
-rw-r--r--deploy/adapters/ansible/roles/ceilometer_compute/vars/RedHat.yml20
-rw-r--r--deploy/adapters/ansible/roles/ceilometer_compute/vars/main.yml11
3 files changed, 0 insertions, 48 deletions
diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/vars/Debian.yml b/deploy/adapters/ansible/roles/ceilometer_compute/vars/Debian.yml
deleted file mode 100644
index 1bf3956f..00000000
--- a/deploy/adapters/ansible/roles/ceilometer_compute/vars/Debian.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-ceilometer_packages:
- - ceilometer-agent-compute
-
-ceilometer_services:
- - ceilometer-agent-compute
-
-nova_services:
- - nova-compute
diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/vars/RedHat.yml b/deploy/adapters/ansible/roles/ceilometer_compute/vars/RedHat.yml
deleted file mode 100644
index f3d5f0e1..00000000
--- a/deploy/adapters/ansible/roles/ceilometer_compute/vars/RedHat.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-ceilometer_packages:
- - openstack-ceilometer-compute
- - python-ceilometerclient
- - python-pecan
-
-ceilometer_services:
- - openstack-ceilometer-compute
- - openstack-nova-compute
-
-nova_services:
- - openstack-nova-compute
diff --git a/deploy/adapters/ansible/roles/ceilometer_compute/vars/main.yml b/deploy/adapters/ansible/roles/ceilometer_compute/vars/main.yml
deleted file mode 100644
index 209e1e00..00000000
--- a/deploy/adapters/ansible/roles/ceilometer_compute/vars/main.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-##############################################################################
-# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
-#
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
----
-packages_noarch: []
-metering_secret: 1c5df72079b31fb47747
ld } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ }
# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Automation of QEMU hypervisor with direct access to host NICs via
   PCI passthrough.
"""
import logging
import subprocess

from conf import settings as S
from vnfs.qemu.qemu import IVnfQemu
from tools import tasks
from tools.module_manager import ModuleManager

_MODULE_MANAGER = ModuleManager()

class QemuPciPassthrough(IVnfQemu):
    """
    Control an instance of QEMU with direct access to the host network devices
    """
    def __init__(self):
        """
        Initialization function.
        """
        super(QemuPciPassthrough, self).__init__()
        self._logger = logging.getLogger(__name__)
        self._host_nics = S.getValue('NICS')

        # in case of SRIOV and PCI passthrough we must ensure, that MAC addresses are swapped
        if S.getValue('SRIOV_ENABLED') and not self._testpmd_fwd_mode.startswith('mac'):
            self._logger.info("SRIOV detected, forwarding mode of testpmd was changed from '%s' to '%s'",
                              self._testpmd_fwd_mode, 'mac')
            self._testpmd_fwd_mode = 'mac'

        for nic in self._host_nics:
            self._cmd += ['-device', 'vfio-pci,host=' + nic['pci']]

    def start(self):
        """
        Start QEMU instance, bind host NICs to vfio-pci driver
        """
        # load vfio-pci
        _MODULE_MANAGER.insert_modules(['vfio-pci'])

        # bind every interface to vfio-pci driver
        try:
            nics_list = list(tmp_nic['pci'] for tmp_nic in self._host_nics)
            tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--bind=vfio-pci'] + nics_list,
                           self._logger, 'Binding NICs %s...' % nics_list, True)

        except subprocess.CalledProcessError:
            self._logger.error('Unable to bind NICs %s', self._host_nics)

        super(QemuPciPassthrough, self).start()

    def stop(self):
        """
        Stop QEMU instance, bind host NICs to the original driver
        """
        super(QemuPciPassthrough, self).stop()

        # bind original driver to every interface
        for nic in self._host_nics:
            if nic['driver']:
                try:
                    tasks.run_task(['sudo', S.getValue('TOOLS')['bind-tool'], '--bind=' + nic['driver'], nic['pci']],
                                   self._logger, 'Binding NIC %s...' % nic['pci'], True)

                except subprocess.CalledProcessError:
                    self._logger.error('Unable to bind NIC %s to driver %s', nic['pci'], nic['driver'])

        # unload vfio-pci driver
        _MODULE_MANAGER.remove_modules()