diff --git a/.gitignore b/.gitignore deleted file mode 100644 index d2b65cd..0000000 --- a/.gitignore +++ /dev/null @@ -1,29 +0,0 @@ -# Add patterns in here to exclude files created by tools integrated with this -# repository, such as test frameworks from the project's recommended workflow, -# rendered documentation and package builds. -# -# Don't add patterns to exclude files created by preferred personal tools -# (editors, IDEs, your operating system itself even). These should instead be -# maintained outside the repository, for example in a ~/.gitignore file added -# with: -# -# git config --global core.excludesfile '~/.gitignore' - -# Bytecompiled Python -*.py[cod] - -# Packages -*.egg-info - -# Unit test / coverage reports -.coverage -cover/ -.stestr/ -.tox/ - -# Sphinx -doc/build/ - -# pbr generates these -AUTHORS -ChangeLog diff --git a/.stestr.conf b/.stestr.conf deleted file mode 100644 index 527ec98..0000000 --- a/.stestr.conf +++ /dev/null @@ -1,4 +0,0 @@ -[DEFAULT] -test_path=./ceilometer_powervm/tests -top_dir=./ - diff --git a/.zuul.yaml b/.zuul.yaml deleted file mode 100644 index b88597b..0000000 --- a/.zuul.yaml +++ /dev/null @@ -1,7 +0,0 @@ -- project: - templates: - - check-requirements - - openstack-python-jobs-ceilometer - - openstack-python3-train-jobs-ceilometer - - periodic-stable-jobs-ceilometer - - openstack-lower-constraints-jobs-ceilometer diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 1413b61..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,19 +0,0 @@ -Contributing to Ceilometer-PowerVM -================================== -If you would like to contribute to the development of OpenStack, -you must follow the steps in the "If you're a developer, start here" -section of this page: - - http://wiki.openstack.org/HowToContribute - -Once those steps have been completed, changes to OpenStack -should be submitted for review via the Gerrit tool, following -the workflow documented at: - - http://wiki.openstack.org/GerritWorkflow - -Pull requests submitted through GitHub will be ignored. - -Bugs should be filed on Launchpad, not GitHub: - - https://bugs.launchpad.net/ceilometer-powervm diff --git a/HACKING.rst b/HACKING.rst deleted file mode 100644 index 1f28f35..0000000 --- a/HACKING.rst +++ /dev/null @@ -1,21 +0,0 @@ -Ceilometer-PowerVM Style Commandments -===================================== - -- Step 1: Read the OpenStack Style Commandments - https://docs.openstack.org/hacking/latest/ -- Step 2: Read on - -Creating Unit Tests -------------------- -For every new feature, unit tests should be created that both test and -(implicitly) document the usage of said feature. If submitting a patch for a -bug that had no unit test, a new passing unit test should be added. If a -submitted bug fix does have a unit test, be sure to add a new one that fails -without the patch and passes with the patch. - -All unittest classes must ultimately inherit from testtools.TestCase. - -All setUp and tearDown methods must upcall using the super() method. -tearDown methods should be avoided and addCleanup calls should be preferred. -Never manually create tempfiles. Always use the tempfile fixtures from -the fixture library to ensure that they are cleaned up. diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68c771a..0000000 --- a/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - diff --git a/README.rst b/README.rst index a959b06..b1f2b8e 100644 --- a/README.rst +++ b/README.rst @@ -1,123 +1,7 @@ -======================== -Team and repository tags -======================== +The contents of this repository are still available in the Git source +code management system. To see the contents of this repository before it +reached its end of life, please check out the previous commit with +"git checkout HEAD^1". -.. image:: https://governance.openstack.org/tc/badges/ceilometer-powervm.svg - :target: https://governance.openstack.org/tc/reference/tags/index.html - -.. Change things from this point on - -========================================== -Support for PowerVM Performance Monitoring -========================================== - -The IBM PowerVM hypervisor provides virtualization on POWER hardware. -PowerVM customers can see benefits in their environments by making use -of OpenStack. This project implements a Ceilometer-compatible compute -inspector. This inspector, along with the PowerVM Nova driver and Neutron -agent, provides capability for PowerVM customers to natively monitor -utilization and statistics for instances running on OpenStack-managed systems. - - -Problem Description -=================== - -PowerVM supports a variety of performance monitoring interfaces within -the platform, providing virtual machine and system monitoring data. -Ceilometer-powervm implements a Ceilometer-based compute inspector for the -PowerVM hypervisor. - -Inspector Description -===================== - -The Ceilometer compute agent provides an inspector framework that allows -hypervisors to integrate support for gathering instance statistics and -utilization details into Ceilometer. This project provides a standard -Ceilometer virt inspector that pulls its data from the PowerVM Performance and -Capacity Monitoring (PCM) infrastructure. - -This inspector retrieves instance monitoring data for cpu, network, memory, and -disk usage. Interactions with PowerVM PCM occur using the PowerVM REST API -stack through `pypowervm`_, an open source python project. - -This inspector requires that the PowerVM system be configured for management -via `NovaLink`_. - -.. _pypowervm: https://github.com/powervm/pypowervm -.. _NovaLink: http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS215-262&appname=USN - - -End User Impact ---------------- - -The users of the cloud are able to see the metrics for their virtual machines. -As PowerVM deals with 'disk buses' rather than specific disks, the hard disk -data is reported at a 'per bus' level (i.e. each SCSI or Virtual Fibre Channel -bus). - -Performance/Scalability Impacts -------------------------------- - -None. - -Other deployer impact ---------------------- - -The cloud administrator needs to install the ceilometer-powervm project on -their PowerVM compute node. It must be installed on the `NovaLink`_ virtual -machine on the PowerVM system. - -The cloud administrator needs to configure their 'hypervisor_inspector' as -powervm. - -No other configuration is required. - -Developer impact ----------------- - -None - -Implementation -============== - -Assignee(s) ------------ - -Primary assignee: thorst - -Ongoing maintainer: thorst - - -Future lifecycle -================ - -Ongoing maintenance of the PowerVM compute inspector will be handled by the IBM -OpenStack team. - -Dependencies -============ - -- The Ceilometer compute agent. - -- The `pypowervm`_ library. - -- A `NovaLink`_ enabled PowerVM system. - -References -========== - -- Ceilometer Architecture: - http://docs.openstack.org/developer/ceilometer/architecture.html - -- pypowervm: https://github.com/powervm/pypowervm - -- NovaLink: http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS215-262&appname=USN - -- PowerVM REST API Initial Specification (may require a newer version - as they become available): http://ibm.co/1lThV9R - -- PowerVM Virtualization Introduction and Configuration: - http://www.redbooks.ibm.com/abstracts/sg247940.html?Open - -- PowerVM Best Practices: - http://www.redbooks.ibm.com/abstracts/sg248062.html?Open +For any further questions, please email +openstack-discuss@lists.openstack.org or join #openstack-dev on OFTC. diff --git a/babel.cfg b/babel.cfg deleted file mode 100644 index 15cd6cb..0000000 --- a/babel.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[python: **.py] - diff --git a/bindep.txt b/bindep.txt deleted file mode 100644 index b230104..0000000 --- a/bindep.txt +++ /dev/null @@ -1,25 +0,0 @@ -# This is a cross-platform list tracking distribution packages needed for install and tests; -# see https://docs.openstack.org/infra/bindep/ for additional information. - -build-essential [platform:dpkg test] -gcc [platform:rpm test] -# gettext and graphviz are needed by doc builds only. For transition, -# have them in both doc and test. -# TODO(jaegerandi): Remove test once infra scripts are updated. -gettext [doc test] -graphviz [doc test] -language-pack-en [platform:ubuntu] -libxml2-dev [platform:dpkg test] -libxslt-devel [platform:rpm test] -libxslt1-dev [platform:dpkg test] -locales [platform:debian] -pkg-config [platform:dpkg test] -pkgconfig [platform:rpm test] -python-dev [platform:dpkg test] -python-devel [platform:rpm test] -python3-all [platform:dpkg] -python3-all-dev [platform:dpkg] -python3-devel [platform:fedora] -python34-devel [platform:centos] -libpcre3-dev [platform:dpkg test] -pcre-devel [platform:rpm test] diff --git a/ceilometer_powervm/__init__.py b/ceilometer_powervm/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/compute/__init__.py b/ceilometer_powervm/compute/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/compute/virt/__init__.py b/ceilometer_powervm/compute/virt/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/compute/virt/powervm/__init__.py b/ceilometer_powervm/compute/virt/powervm/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/compute/virt/powervm/i18n.py b/ceilometer_powervm/compute/virt/powervm/i18n.py deleted file mode 100644 index d5f31d8..0000000 --- a/ceilometer_powervm/compute/virt/powervm/i18n.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2015 IBM Corp. -# -# All Rights Reserved. -# -# 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. - -import oslo_i18n - -# Initialize message translators and short cut methods -_translators = oslo_i18n.TranslatorFactory(domain='ceilometer-powervm') -_ = _translators.primary diff --git a/ceilometer_powervm/compute/virt/powervm/inspector.py b/ceilometer_powervm/compute/virt/powervm/inspector.py deleted file mode 100644 index 45e6374..0000000 --- a/ceilometer_powervm/compute/virt/powervm/inspector.py +++ /dev/null @@ -1,487 +0,0 @@ -# Copyright 2015, 2019 IBM Corp. -# -# All Rights Reserved. -# -# 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. - -import datetime - -from oslo_log import log as logging -from pypowervm import adapter as pvm_adpt -from pypowervm.helpers import log_helper as log_hlp -from pypowervm.helpers import vios_busy as vio_hlp -from pypowervm.tasks.monitor import util as pvm_mon_util -from pypowervm.utils import uuid as pvm_uuid -from pypowervm.wrappers import logical_partition as pvm_lpar -from pypowervm.wrappers import managed_system as pvm_ms -from pypowervm.wrappers import network as pvm_net - -from ceilometer.compute.virt import inspector as virt_inspector -from ceilometer_powervm.compute.virt.powervm.i18n import _ - -LOG = logging.getLogger(__name__) - - -class PowerVMInspector(virt_inspector.Inspector): - """The implementation of the inspector for the PowerVM hypervisor. - - This code requires that it is run on the PowerVM Compute Host directly. - Utilizes the pypowervm library to gather the instance metrics. - """ - - def __init__(self, conf): - super(PowerVMInspector, self).__init__(conf) - - # Build the adapter. May need to attempt the connection multiple times - # in case the REST server is starting. - session = pvm_adpt.Session(conn_tries=300) - self.adpt = pvm_adpt.Adapter( - session, helpers=[log_hlp.log_helper, - vio_hlp.vios_busy_retry_helper]) - - # Get the host system UUID - host_uuid = self._get_host_uuid(self.adpt) - - # Ensure that metrics gathering is running for the host. - pvm_mon_util.ensure_ltm_monitors(self.adpt, host_uuid) - - # Get the VM Metric Utility - self.vm_metrics = pvm_mon_util.LparMetricCache(self.adpt, host_uuid) - - @staticmethod - def _puuid(instance): - """Derives the PowerVM UUID for an instance. - - :param instance: The OpenStack instance object. - :return: The PowerVM API's UUID for the instance. - """ - return pvm_uuid.convert_uuid_to_pvm(instance.id).upper() - - def _get_host_uuid(self, adpt): - """Returns the Host system's UUID for pypowervm. - - The pypowervm API needs a UUID of the server that it is managing. This - method returns the UUID of that host. - - :param adpt: The pypowervm adapter. - :return: The UUID of the host system. - """ - hosts = pvm_ms.System.wrap(adpt.read(pvm_ms.System.schema_type)) - if len(hosts) != 1: - raise Exception(_("Expected exactly one host; found %d."), - len(hosts)) - LOG.debug("Host UUID: %s" % hosts[0].uuid) - return hosts[0].uuid - - def inspect_instance(self, instance, duration): - """Inspect the statistics for an instance. - - :param instance: the target instance - :param duration: the last 'n' seconds, over which the value should be - inspected. - - The PowerVM implementation does not make use of the duration - field. - :return: the instance statistics - """ - - uuid = self._puuid(instance) - cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid) - - # If the current metric is none, then the instance can not be found in - # the sample set. An error should be raised. - if cur_metric is None: - raise virt_inspector.InstanceNotFoundException( - _('VM %s not found in PowerVM Metrics Sample.') % - instance.name) - - cpu_time = (cur_metric.processor.util_cap_proc_cycles + - cur_metric.processor.util_uncap_proc_cycles) - cpu_num = cur_metric.processor.virt_procs - - # The duration is ignored. There is precedent for this in other - # inspectors if the platform doesn't support duration. - # - # Given the nature of PowerVM to collect samples over coarse periods - # of time, it does not lend well to duration based collection. - # Therefore this works by gathering the latest utilization from the - # samples and ignores the duration. - - # Get the current and previous sample. Delta is performed between - # these two. - prev_date, prev_metric = self.vm_metrics.get_previous_metric(uuid) - - # Get the current data. - cur_util_cap = cur_metric.processor.util_cap_proc_cycles - cur_util_uncap = cur_metric.processor.util_uncap_proc_cycles - cur_idle = cur_metric.processor.idle_proc_cycles - cur_donated = cur_metric.processor.donated_proc_cycles - cur_entitled = cur_metric.processor.entitled_proc_cycles - - # Get the previous sample data - if prev_metric is None: - # If there is no previous sample, that is either a new VM or is - # a live migrated system. A live migrated system will pull all - # of its metrics with it. The issue with this is it could have - # CPU cycles for months of run time. So we can't really determine - # the CPU utilization within the last X seconds...because to THIS - # host it's new (only in the cur_metric). So we error out, the - # inspector will use a debug message in the log. - LOG.warning('Unable to derive CPU Utilization for VM %s. It is ' - 'either a new VM or was recently migrated. It will be ' - 'collected in the next inspection cycle.', - instance.name) - return virt_inspector.InstanceStats( - cpu_time=cpu_time, cpu_number=cpu_num) - - # Gather the previous metrics - prev_util_cap = prev_metric.processor.util_cap_proc_cycles - prev_util_uncap = prev_metric.processor.util_uncap_proc_cycles - prev_idle = prev_metric.processor.idle_proc_cycles - prev_donated = prev_metric.processor.donated_proc_cycles - prev_entitled = prev_metric.processor.entitled_proc_cycles - - # Utilization can be driven by multiple factors on PowerVM. - # PowerVM has 'entitled' cycles. These are cycles that, if the VM - # needs them, they get them no matter what. - # - # In terms of how those cycles are returned from the API: - # util_cap_proc_cycles - How many cycles from the guaranteed - # capacity were used. - # util_uncap_proc_cycles - How many cycles were used that were - # taken from spare (which is either unused processors cycles - # or donated cycles from other VMs). - # idle_proc_cycles - How many cycles (as reported by the OS to the - # hypervisor) were reported as idle. - # donated_proc_cycles - Cycles that were not needed by this VM that - # were given to another VM in need of cycles. - # - # - # So the final utilization equation is: - # (util cap + util uncap - idle - donated) / entitled - # - # It is important to note that idle and donated proc cycles are - # included in the 'util_cap_proc_cycles'. That is why they are - # subtracted out. - # - # The interesting aspect of this is that the CPU Utilization can go - # dramatically above 100% if there are free processors or if the - # other workloads are in a lull. - util_cap = cur_util_cap - prev_util_cap - util_uncap = cur_util_uncap - prev_util_uncap - idle = cur_idle - prev_idle - donated = cur_donated - prev_donated - entitled = cur_entitled - prev_entitled - - # If the entitled is zero, that generally means that the VM has not - # been started yet (everything else would be zero as well). So to - # avoid a divide by zero error, just return 0% in that case. - util = (float(util_cap + util_uncap - idle - donated) / float(entitled) - if entitled else 0.0) - - # Utilization is reported as percents. Therefore, multiply by 100.0 - # to get a readable percentage based format. - return virt_inspector.InstanceStats( - cpu_util=util * 100.0, cpu_time=cpu_time, cpu_number=cpu_num) - - @staticmethod - def mac_for_metric_cna(metric_cna, client_cnas): - """Finds the mac address for a given metric. - - :param metric_cna: The metric for a given client network adapter (CNA) - :param client_cnas: The list of wrappers from pypowervm for the CNAs - attached to a given instance. - :return: Mac address of the adapter. If unable to be found, then None - is returned. - """ - # TODO(thorst) Investigate optimization in pypowervm for this. - for client_cna in client_cnas: - if client_cna.loc_code == metric_cna.physical_location: - # Found the appropriate mac. The PowerVM format is upper - # cased without colons. Convert it. - mac = client_cna.mac.lower() - return ':'.join(mac[i:i + 2] - for i in range(0, len(mac), 2)) - return None - - def _get_cnas(self, lpar_uuid): - """Returns the client VM's Network Adapters. - - :param lpar_uuid: The UUID of the VM. - :return: A list of pypowervm CNA wrappers. - """ - client_cna_resp = self.adpt.read( - pvm_lpar.LPAR.schema_type, root_id=lpar_uuid, - child_type=pvm_net.CNA.schema_type) - return pvm_net.CNA.wrap(client_cna_resp) - - def inspect_vnics(self, instance, duration): - """Inspect the vNIC statistics for an instance. - - :param instance: the target instance - :param duration: the last 'n' seconds, over which the value should be - inspected. - - The PowerVM implementation does not make use of the duration - field. - :return: for each vNIC, the number of bytes & packets - received and transmitted - """ - # Get the current and previous sample. Delta is performed between - # these two. - uuid = self._puuid(instance) - cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid) - - # If the cur_metric is none, then the instance can not be found in the - # sample and an error should be raised. - if cur_metric is None: - raise virt_inspector.InstanceNotFoundException( - _('VM %s not found in PowerVM Metrics Sample.') % - instance.name) - - # If there isn't network information, this is because the Virtual - # I/O Metrics were turned off. Have to pass through this method. - if cur_metric.network is None: - return - - # Get the network interfaces. A 'cna' is a Client VM's Network Adapter - client_cnas = self._get_cnas(uuid) - - for metric_cna in cur_metric.network.cnas: - # Get the mac, but if it isn't found, then move to the next. Might - # have been removed since the last sample. - mac = self.mac_for_metric_cna(metric_cna, client_cnas) - if mac is None: - continue - - # The name will be the location code. MAC is identified from - # above. Others appear libvirt specific. - # - # PowerVM doesn't specify drops by receive vs. transmit. Since we - # have the client adapter, we assume all are receive drops. - # There are no error metrics available. - yield virt_inspector.InterfaceStats( - name=metric_cna.physical_location, - mac=mac, fref=None, parameters=None, - rx_bytes=metric_cna.received_bytes, - rx_packets=metric_cna.received_packets, - rx_drop=metric_cna.dropped_packets, - rx_errors=0, - tx_bytes=metric_cna.sent_bytes, - tx_packets=metric_cna.sent_packets, - tx_drop=0, - tx_errors=0) - - def inspect_vnic_rates(self, instance, duration): - """Inspect the vNIC rate statistics for an instance. - - :param instance: the target instance - :param duration: the last 'n' seconds, over which the value should be - inspected - - The PowerVM implementation does not make use of the duration - field. - :return: for each vNIC, the rate of bytes & packets - received and transmitted - """ - # Get the current and previous sample. Delta is performed between - # these two. - uuid = self._puuid(instance) - cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid) - prev_date, prev_metric = self.vm_metrics.get_previous_metric(uuid) - - # If the current is none, then the instance can not be found in the - # sample and an error should be raised. - if cur_metric is None: - raise virt_inspector.InstanceNotFoundException( - _('VM %s not found in PowerVM Metrics Sample.') % - instance.name) - - # If there isn't network information, this is because the Virtual - # I/O Metrics were turned off. Have to pass through this method. - if (cur_metric.network is None or prev_metric is None or - prev_metric.network is None): - return - - # Get the network interfaces. A 'cna' is a Client VM's Network Adapter - client_cnas = self._get_cnas(uuid) - - def find_prev_net(metric_cna): - """Finds the metric vNIC from the previous sample's vNICs.""" - # If no previous, return None - if prev_metric is None or prev_metric.network is None: - return None - - for prev_cna in prev_metric.network.cnas: - if prev_cna.physical_location == metric_cna.physical_location: - return prev_cna - - # Couldn't find a previous. Maybe the interface was recently - # added to the instance? Return None - return None - - # Need to determine the time delta between the samples. This is - # usually 30 seconds from the API, but the metrics will be specific. - date_delta_num = float((cur_date - prev_date).seconds) - - for metric_cna in cur_metric.network.cnas: - # Get the mac, but if it isn't found, then move to the next. Might - # have been removed since the last sample. - mac = self.mac_for_metric_cna(metric_cna, client_cnas) - if mac is None: - continue - - # Note that here, the previous may be none. That simply indicates - # that the adapter was dynamically added to the VM before the - # previous collection. Not the migration scenario above. - # In this case, we can default the base to 0. - prev = find_prev_net(metric_cna) - rx_bytes_diff = (metric_cna.received_bytes - - (0 if prev is None else prev.received_bytes)) - tx_bytes_diff = (metric_cna.sent_bytes - - (0 if prev is None else prev.sent_bytes)) - - # Stats are the difference in the bytes, divided by the difference - # in time between the two samples. - rx_rate = float(rx_bytes_diff) / float(date_delta_num) - tx_rate = float(tx_bytes_diff) / float(date_delta_num) - - # The name will be the location code. MAC is identified from - # above. Others appear libvirt specific. - yield virt_inspector.InterfaceRateStats( - name=metric_cna.physical_location, - mac=mac, fref=None, parameters=None, - rx_bytes_rate=rx_rate, tx_bytes_rate=tx_rate) - - def inspect_disks(self, instance, duration): - """Inspect the disk statistics for an instance. - - The response is a generator of the values. - - :param instance: the target instance - :param duration: the last 'n' seconds, over which the value should be - inspected. - - The PowerVM implementation does not make use of the duration - field. - :return disk: The Disk indicating the device for the storage device. - :return stats: The DiskStats indicating the read/write data to the - device. - """ - # Get the current and previous sample. Delta is performed between - # these two. - uuid = self._puuid(instance) - cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid) - - # If the cur_metric is none, then the instance can not be found in the - # sample and an error should be raised. - if cur_metric is None: - raise virt_inspector.InstanceNotFoundException( - _('VM %s not found in PowerVM Metrics Sample.') % - instance.name) - - # If there isn't storage information, this is because the Virtual - # I/O Metrics were turned off. Have to pass through this method. - if cur_metric.storage is None: - LOG.debug("Current storage metric was unavailable from the API " - "instance %s." % instance.name) - return - - # Bundle together the SCSI and virtual FC adapters - adpts = cur_metric.storage.virt_adpts + cur_metric.storage.vfc_adpts - - # Loop through all the storage adapters - for adpt in adpts: - # PowerVM only shows the connection (SCSI or FC). Name after - # the connection name - yield virt_inspector.DiskStats( - device=adpt.name, read_requests=adpt.num_reads, - read_bytes=adpt.read_bytes, write_requests=adpt.num_writes, - write_bytes=adpt.write_bytes, errors=0, wr_total_times=0, - rd_total_times=0) - - def inspect_disk_iops(self, instance, duration): - """Inspect the Disk Input/Output operations per second for an instance. - - The response is a generator of the values. - - :param instance: the target instance - :param duration: the last 'n' seconds, over which the value should be - inspected. - - The PowerVM implementation does not make use of the duration - field. - :return disk: The Disk indicating the device for the storage device. - :return stats: The DiskIOPSStats indicating the I/O operations per - second for the device. - """ - # Get the current and previous sample. Delta is performed between - # these two. - uuid = self._puuid(instance) - cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid) - prev_date, prev_metric = self.vm_metrics.get_previous_metric(uuid) - - # If the cur_metric is none, then the instance can not be found in the - # sample and an error should be raised. - if cur_metric is None: - raise virt_inspector.InstanceNotFoundException( - _('VM %s not found in PowerVM Metrics Sample.') % - instance.name) - - # If there isn't storage information, this may be because the Virtual - # I/O Metrics were turned off. If the previous metric is unavailable, - # also have to pass through this method. - if (cur_metric.storage is None or prev_metric is None or - prev_metric.storage is None): - LOG.debug("Current storage metric was unavailable from the API " - "instance %s." % instance.name) - return - - # Need to determine the time delta between the samples. This is - # usually 30 seconds from the API, but the metrics will be specific. - # However, if there is no previous sample, then we have to estimate. - # Therefore, we estimate 15 seconds - half of the standard 30 seconds. - date_delta = ((cur_date - prev_date) if prev_date is not None else - datetime.timedelta(seconds=15)) - - # Bundle together the SCSI and virtual FC adapters - cur_adpts = (cur_metric.storage.virt_adpts + - cur_metric.storage.vfc_adpts) - prev_adpts = (prev_metric.storage.virt_adpts + - prev_metric.storage.vfc_adpts) - - def find_prev(cur_adpt): - for prev_adpt in prev_adpts: - if prev_adpt.name == cur_adpt.name: - return prev_adpt - return None - - # Loop through all the storage adapters - for cur_adpt in cur_adpts: - # IOPs is the read/write counts of the current - prev divided by - # second difference between the two, rounded to the integer. :-) - cur_ops = cur_adpt.num_reads + cur_adpt.num_writes - - # The previous adapter may be None. This simply indicates that the - # adapter was added between the previous sample and this one. It - # does not indicate a live migrate scenario like noted above, as - # the VM itself hasn't moved. - prev_adpt = find_prev(cur_adpt) - prev_ops = ((prev_adpt.num_reads + prev_adpt.num_writes) - if prev_adpt else 0) - iops = (cur_ops - prev_ops) // date_delta.seconds - - # PowerVM only shows the connection (SCSI or FC). Name after - # the connection name - yield virt_inspector.DiskIOPSStats(device=cur_adpt.name, - iops_count=iops) diff --git a/ceilometer_powervm/locale/ceilometer-powervm.pot b/ceilometer_powervm/locale/ceilometer-powervm.pot deleted file mode 100644 index 61efa59..0000000 --- a/ceilometer_powervm/locale/ceilometer-powervm.pot +++ /dev/null @@ -1,34 +0,0 @@ -# Translations template for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "" - diff --git a/ceilometer_powervm/locale/de/ceilometer-powervm.po b/ceilometer_powervm/locale/de/ceilometer-powervm.po deleted file mode 100644 index fa8a723..0000000 --- a/ceilometer_powervm/locale/de/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=2; plural=n != 1;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "Erwartet wurde genau ein Host; gefunden: %d." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "VM %s in Beispiel für PowerVM-Metriken nicht gefunden." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/es/ceilometer-powervm.po b/ceilometer_powervm/locale/es/ceilometer-powervm.po deleted file mode 100644 index 1a058c0..0000000 --- a/ceilometer_powervm/locale/es/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=2; plural=n != 1;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "Se esperaba un único host; se han encontrado %d." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "No se ha encontrado la máquina virtual %s en el ejemplo de métricas de PowerVM." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/fr/ceilometer-powervm.po b/ceilometer_powervm/locale/fr/ceilometer-powervm.po deleted file mode 100644 index 931a308..0000000 --- a/ceilometer_powervm/locale/fr/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=2; plural=n>1;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "Précisément un hôte attendu ; trouvé %d." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "Machine virtuelle %s introuvable dans l'échantillon de métriques PowerVM." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/it/ceilometer-powervm.po b/ceilometer_powervm/locale/it/ceilometer-powervm.po deleted file mode 100644 index 3bd7406..0000000 --- a/ceilometer_powervm/locale/it/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=2; plural=n != 1;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "Previsto un solo host; trovati %d." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "VM %s non trovata nel campione di metriche PowerVM." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/ja/ceilometer-powervm.po b/ceilometer_powervm/locale/ja/ceilometer-powervm.po deleted file mode 100644 index 43532bd..0000000 --- a/ceilometer_powervm/locale/ja/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=1; plural=0;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "予期されたホストは 1 つのみです。検出されたのは %d 個です。" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "VM %s が PowerVM メトリック・サンプルに見つかりません。" - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/ko/ceilometer-powervm.po b/ceilometer_powervm/locale/ko/ceilometer-powervm.po deleted file mode 100644 index 36e5175..0000000 --- a/ceilometer_powervm/locale/ko/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=1; plural=0;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "정확히 하나의 호스트를 예상했지만 %d개를 찾았습니다." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "PowerVM 메트릭 샘플에서 VM %s을(를) 찾을 수 없습니다." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/pt-BR/ceilometer-powervm.po b/ceilometer_powervm/locale/pt-BR/ceilometer-powervm.po deleted file mode 100644 index faf8fa7..0000000 --- a/ceilometer_powervm/locale/pt-BR/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=2; plural=n>1;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "Esperado exatamente um host; localizado %d." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "A VM %s não localizada na Amostra de métricas do PowerVM." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/ru/ceilometer-powervm.po b/ceilometer_powervm/locale/ru/ceilometer-powervm.po deleted file mode 100644 index 6d8d1fe..0000000 --- a/ceilometer_powervm/locale/ru/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "Ожидался только один хост; обнаружено %d." - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "Виртуальная машина %s не найдена в примере PowerVM Metrics." - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/zh-Hans/ceilometer-powervm.po b/ceilometer_powervm/locale/zh-Hans/ceilometer-powervm.po deleted file mode 100644 index eaf5278..0000000 --- a/ceilometer_powervm/locale/zh-Hans/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=1; plural=0;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "期望刚好找到一个主机;但是找到 %d 个主机。" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "在 PowerVM 指标样本中找不到 VM %s。" - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/locale/zh-Hant/ceilometer-powervm.po b/ceilometer_powervm/locale/zh-Hant/ceilometer-powervm.po deleted file mode 100644 index a104fff..0000000 --- a/ceilometer_powervm/locale/zh-Hant/ceilometer-powervm.po +++ /dev/null @@ -1,39 +0,0 @@ -# English translations for ceilometer-powervm. -# Copyright (C) 2018 ORGANIZATION -# This file is distributed under the same license as the ceilometer-powervm -# project. -# FIRST AUTHOR , 2018. -# -msgid "" -msgstr "" -"Project-Id-Version: ceilometer-powervm 6.0.1.dev2\n" -"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2018-03-19 18:17-0400\n" -"PO-Revision-Date: 2018-03-19 18:17-0400\n" -"Last-Translator: FULL NAME \n" -"Language: en\n" -"Language-Team: en \n" -"Plural-Forms: nplurals=1; plural=0;" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=utf-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Generated-By: Babel 2.5.3\n" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:81 -#, python-format -msgid "Expected exactly one host; found %d." -msgstr "預期只有一個主機;但找到 %d 個。" - -#: ceilometer_powervm/compute/virt/powervm/inspector.py:105 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:244 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:302 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:380 -#: ceilometer_powervm/compute/virt/powervm/inspector.py:423 -#, python-format -msgid "VM %s not found in PowerVM Metrics Sample." -msgstr "在 PowerVM 度量範例中找不到 VM %s。" - - -# ENGL1SH_VERS10N 47169_2 DO NOT REMOVE OR CHANGE THIS LINE -# T9N_SRC_ID 33 -# T9N_SH1P_STR1NG VC141AAP001 1 diff --git a/ceilometer_powervm/tests/__init__.py b/ceilometer_powervm/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/tests/compute/__init__.py b/ceilometer_powervm/tests/compute/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/tests/compute/virt/__init__.py b/ceilometer_powervm/tests/compute/virt/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/tests/compute/virt/powervm/__init__.py b/ceilometer_powervm/tests/compute/virt/powervm/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/ceilometer_powervm/tests/compute/virt/powervm/pvm_fixtures.py b/ceilometer_powervm/tests/compute/virt/powervm/pvm_fixtures.py deleted file mode 100644 index b2e9de2..0000000 --- a/ceilometer_powervm/tests/compute/virt/powervm/pvm_fixtures.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2015 IBM Corp. -# -# All Rights Reserved. -# -# 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. - -"""Generic fixtures for unit testing PowerVM and Ceilometer integration.""" - -import fixtures -import mock - - -class PyPowerVMMetrics(fixtures.Fixture): - """Fixtures for the PowerVM Metrics.""" - - def setUp(self): - super(PyPowerVMMetrics, self).setUp() - - self._vm_metrics_patcher = mock.patch('pypowervm.tasks.monitor.util.' - 'LparMetricCache') - self._ensure_ltm = mock.patch('pypowervm.tasks.monitor.util.' - 'ensure_ltm_monitors') - self._uuid_converter = mock.patch('pypowervm.utils.uuid.' - 'convert_uuid_to_pvm') - - self.vm_metrics = self._vm_metrics_patcher.start() - self.ensure_ltm = self._ensure_ltm.start() - self.uuid_converter = self._uuid_converter.start() - - self.addCleanup(self._vm_metrics_patcher.stop) - self.addCleanup(self._ensure_ltm.stop) - self.addCleanup(self._uuid_converter.stop) diff --git a/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py b/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py deleted file mode 100644 index aa3efce..0000000 --- a/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py +++ /dev/null @@ -1,436 +0,0 @@ -# Copyright 2015, 2019 IBM Corp. -# -# All Rights Reserved. -# -# 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. - -import datetime -import mock - -from ceilometer.compute.virt import inspector as virt_inspector -from oslotest import base -from pypowervm.helpers import log_helper as log_hlp -from pypowervm.helpers import vios_busy as vio_hlp -from pypowervm.tests import test_fixtures as api_fx - -from ceilometer_powervm.compute.virt.powervm import inspector as p_inspect -from ceilometer_powervm.tests.compute.virt.powervm import pvm_fixtures - - -class TestPowerVMInspectorInit(base.BaseTestCase): - """Tests the initialization of the VM Inspector.""" - - @mock.patch('pypowervm.tasks.monitor.util.LparMetricCache') - @mock.patch('pypowervm.tasks.monitor.util.ensure_ltm_monitors') - @mock.patch('ceilometer_powervm.compute.virt.powervm.inspector.' - 'PowerVMInspector._get_host_uuid') - @mock.patch('pypowervm.adapter.Adapter') - @mock.patch('pypowervm.adapter.Session') - def test_init(self, mock_session, mock_adapter, mock_get_host_uuid, - mock_ensure_ltm, mock_cache): - # Mock up data - mock_get_host_uuid.return_value = 'host_uuid' - - # Invoke - inspector = p_inspect.PowerVMInspector(None) - - # Validate - mock_session.assert_called_once_with(conn_tries=300) - mock_adapter.assert_called_once_with( - mock_session.return_value, - helpers=[log_hlp.log_helper, vio_hlp.vios_busy_retry_helper]) - - mock_get_host_uuid.assert_called_once_with(mock_adapter.return_value) - mock_ensure_ltm.assert_called_once_with(mock_adapter.return_value, - 'host_uuid') - mock_cache.assert_called_once_with(mock_adapter.return_value, - 'host_uuid') - self.assertEqual(mock_cache.return_value, inspector.vm_metrics) - - -class TestPowerVMInspector(base.BaseTestCase): - - def setUp(self): - super(TestPowerVMInspector, self).setUp() - - # These fixtures allow for stand up of the unit tests that use - # pypowervm. - pvm_adpt_fx = self.useFixture(api_fx.AdapterFx()) - self.adpt = pvm_adpt_fx.adpt - pvm_mon_fx = self.useFixture(pvm_fixtures.PyPowerVMMetrics()) - - # Individual test cases will set return values on the metrics that - # come back from pypowervm. - self.mock_metrics = pvm_mon_fx.vm_metrics - - with mock.patch('ceilometer_powervm.compute.virt.powervm.inspector.' - 'PowerVMInspector._get_host_uuid'): - # Create the inspector - self.inspector = p_inspect.PowerVMInspector(None) - self.inspector.vm_metrics = self.mock_metrics - - def test_inspect_instance_stats(self): - """Validates PowerVM's inspect_instance method.""" - # Validate that an error is raised if the instance can't be found - # in the sample - self.mock_metrics.get_latest_metric.return_value = None, None - self.assertRaises(virt_inspector.InstanceNotFoundException, - self.inspector.inspect_instance, mock.Mock(), None) - - def mock_metric(util_cap, util_uncap, idle, donated, entitled): - """Helper method to create mock proc metrics.""" - metric = mock.MagicMock() - metric.processor.virt_procs = 12 - metric.processor.util_cap_proc_cycles = util_cap - metric.processor.util_uncap_proc_cycles = util_uncap - metric.processor.idle_proc_cycles = idle - metric.processor.donated_proc_cycles = donated - metric.processor.entitled_proc_cycles = entitled - return metric - - # Validate that the CPU metrics raise an issue if the previous metric - # can't be found (perhaps due to a live migration). - self.mock_metrics.get_latest_metric.return_value = ( - mock.Mock(), mock_metric(7000, 50, 1000, 5000, 10000)) - self.mock_metrics.get_previous_metric.return_value = None, None - resp = self.inspector.inspect_instance(mock.Mock(), None) - self.assertEqual(7050, resp.cpu_time) - self.assertEqual(12, resp.cpu_number) - - # Mock up a mixed use environment. - cur = mock_metric(7000, 50, 1000, 5000, 10000) - prev = mock_metric(4000, 25, 500, 2500, 5000) - self.mock_metrics.get_latest_metric.return_value = mock.Mock(), cur - self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev - - # Execute and validate - resp = self.inspector.inspect_instance(mock.Mock(), None) - self.assertEqual(.5, resp.cpu_util) - - # Mock an instance with a dedicated processor, but idling and donating - # cycles to others. In these scenarios, util_cap shows full use, but - # the idle and donated get subtracted out. - cur = mock_metric(10000, 0, 100, 4900, 10000) - prev = mock_metric(5000, 0, 50, 2500, 5000) - self.mock_metrics.get_latest_metric.return_value = mock.Mock(), cur - self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev - - # Execute and validate - resp = self.inspector.inspect_instance(mock.Mock(), None) - self.assertEqual(51.0, resp.cpu_util) - - # Mock an instance with a shared processor. By nature, this doesn't - # idle or donate. If it is 'idling' it is simply giving the cycles - # out. Show a low use one without needing extra cycles - cur = mock_metric(9000, 0, 0, 0, 10000) - prev = mock_metric(5000, 0, 0, 0, 5000) - self.mock_metrics.get_latest_metric.return_value = mock.Mock(), cur - self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev - - # Execute and validate - resp = self.inspector.inspect_instance(mock.Mock(), None) - self.assertEqual(80.0, resp.cpu_util) - - # Mock an instance with a shared processor - but using cycles from - # the uncap pool. This means it is using extra cycles from other - # VMs that are currently not requiring the CPU. - cur = mock_metric(10000, 10000, 0, 0, 10000) - prev = mock_metric(5000, 0, 0, 0, 5000) - self.mock_metrics.get_latest_metric.return_value = mock.Mock(), cur - self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev - - # Execute and validate. This should be running at 300% CPU - # utilization. Fast! - resp = self.inspector.inspect_instance(mock.Mock(), None) - self.assertEqual(300.0, resp.cpu_util) - - # Mock an instance that hasn't been started yet. - cur = mock_metric(0, 0, 0, 0, 0) - prev = mock_metric(0, 0, 0, 0, 0) - self.mock_metrics.get_latest_metric.return_value = mock.Mock(), cur - self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev - - # This should have 0% utilization - resp = self.inspector.inspect_instance(mock.Mock(), None) - self.assertEqual(0.0, resp.cpu_util) - - @staticmethod - def _mock_vnic_metric(rec_bytes, tx_bytes, rec_pkts, tx_pkts, phys_loc, - drop_pkts): - """Helper method to create a specific mock network metric.""" - return mock.Mock(received_bytes=rec_bytes, sent_bytes=tx_bytes, - received_packets=rec_pkts, sent_packets=tx_pkts, - dropped_packets=drop_pkts, physical_location=phys_loc) - - def _build_cur_mock_vnic_metrics(self): - """Helper method to create mock network metrics.""" - cna1 = self._mock_vnic_metric(1000, 1000, 10, 10, 'a', 1) - cna2 = self._mock_vnic_metric(2000, 2000, 20, 20, 'b', 2) - cna3 = self._mock_vnic_metric(3000, 3000, 30, 30, 'c', 3) - - metric = mock.MagicMock() - metric.network.cnas = [cna1, cna2, cna3] - return metric - - def _build_prev_mock_vnic_metrics(self): - """Helper method to create mock network metrics.""" - cna1 = self._mock_vnic_metric(1000, 1000, 10, 10, 'a', 1) - cna2 = self._mock_vnic_metric(200, 200, 20, 20, 'b', 2) - - metric = mock.MagicMock() - metric.network.cnas = [cna1, cna2] - return metric - - @staticmethod - def _build_mock_cnas(): - """Builds a set of mock client network adapters.""" - cna1 = mock.MagicMock() - cna1.loc_code, cna1.mac = 'a', 'AABBCCDDEEFF' - - cna2 = mock.MagicMock() - cna2.loc_code, cna2.mac = 'b', 'AABBCCDDEE11' - - cna3 = mock.MagicMock() - cna3.loc_code, cna3.mac = 'c', 'AABBCCDDEE22' - - return [cna1, cna2, cna3] - - @mock.patch('pypowervm.wrappers.network.CNA.wrap') - def test_inspect_vnics(self, mock_wrap): - """Tests the inspect_vnics inspector method for PowerVM.""" - # Validate that an error is raised if the instance can't be found in - # the sample data. - self.mock_metrics.get_latest_metric.return_value = None, None - self.assertRaises(virt_inspector.InstanceNotFoundException, list, - self.inspector.inspect_vnics(mock.Mock(), None)) - - # Validate that no data is returned if there is a current metric, - # just no network within it. - mock_empty_net = mock.MagicMock() - mock_empty_net.network = None - self.mock_metrics.get_latest_metric.return_value = None, mock_empty_net - self.assertEqual( - [], list(self.inspector.inspect_vnics(mock.Mock(), None))) - - # Build a couple CNAs and verify we get the proper list back - mock_wrap.return_value = self._build_mock_cnas() - self.adpt.read.return_value = mock.Mock() - mock_metrics = self._build_cur_mock_vnic_metrics() - self.mock_metrics.get_latest_metric.return_value = None, mock_metrics - - resp = list(self.inspector.inspect_vnics(mock.Mock(), None)) - self.assertEqual(3, len(resp)) - - stats1 = resp[0] - self.assertEqual('aa:bb:cc:dd:ee:ff', stats1.mac) - self.assertEqual('a', stats1.name) - self.assertEqual(1000, stats1.rx_bytes) - self.assertEqual(1000, stats1.tx_bytes) - self.assertEqual(10, stats1.rx_packets) - self.assertEqual(10, stats1.tx_packets) - self.assertEqual(1, stats1.rx_drop) - self.assertEqual(0, stats1.tx_drop) - self.assertEqual(0, stats1.rx_errors) - self.assertEqual(0, stats1.tx_errors) - - @mock.patch('pypowervm.wrappers.network.CNA.wrap') - def test_inspect_vnic_rates(self, mock_wrap): - """Tests the inspect_vnic_rates inspector method for PowerVM.""" - # Validate that an error is raised if the instance can't be found in - # the sample data. - self.mock_metrics.get_latest_metric.return_value = None, None - self.mock_metrics.get_previous_metric.return_value = None, None - self.assertRaises(virt_inspector.InstanceNotFoundException, list, - self.inspector.inspect_vnic_rates(mock.Mock(), None)) - - # Validate that no data is returned if there is a current metric, - # just no network within it. - mock_empty_net = mock.MagicMock() - mock_empty_net.network = None - self.mock_metrics.get_latest_metric.return_value = None, mock_empty_net - self.assertEqual( - [], list(self.inspector.inspect_vnic_rates(mock.Mock(), None))) - - # Build the response LPAR data - mock_wrap.return_value = self._build_mock_cnas() - self.adpt.read.return_value = mock.Mock() - - # Current metric data - mock_cur = self._build_cur_mock_vnic_metrics() - cur_date = datetime.datetime.now() - self.mock_metrics.get_latest_metric.return_value = cur_date, mock_cur - - # Build the previous - mock_prev = self._build_prev_mock_vnic_metrics() - prev_date = cur_date - datetime.timedelta(seconds=30) - self.mock_metrics.get_previous_metric.return_value = (prev_date, - mock_prev) - - # Execute - resp = list(self.inspector.inspect_vnic_rates(mock.Mock(), None)) - self.assertEqual(3, len(resp)) - - # First metric. No delta - stats1 = resp[0] - self.assertEqual('aa:bb:cc:dd:ee:ff', stats1.mac) - self.assertEqual('a', stats1.name) - self.assertEqual(0, stats1.rx_bytes_rate) - self.assertEqual(0, stats1.tx_bytes_rate) - - # Second metric - stats2 = resp[1] - self.assertEqual('aa:bb:cc:dd:ee:11', stats2.mac) - self.assertEqual('b', stats2.name) - self.assertEqual(60.0, stats2.rx_bytes_rate) - self.assertEqual(60.0, stats2.tx_bytes_rate) - - # Third metric had no previous. - stats3 = resp[2] - self.assertEqual('aa:bb:cc:dd:ee:22', stats3.mac) - self.assertEqual('c', stats3.name) - self.assertEqual(100.0, stats3.rx_bytes_rate) - self.assertEqual(100.0, stats3.tx_bytes_rate) - - @staticmethod - def _mock_stor_metric(num_reads, num_writes, read_bytes, write_bytes, - name): - """Helper method to create a specific mock storage metric.""" - m = mock.Mock(num_reads=num_reads, num_writes=num_writes, - read_bytes=read_bytes, write_bytes=write_bytes) - # Have to do this method as name is a special field. - m.configure_mock(name=name) - return m - - def _build_cur_mock_stor_metrics(self): - """Helper method to create mock storage metrics.""" - vscsi1 = self._mock_stor_metric(1000, 1000, 100000, 100000, 'vscsi1') - vscsi2 = self._mock_stor_metric(2000, 2000, 200000, 200000, 'vscsi2') - vfc1 = self._mock_stor_metric(3000, 3000, 300000, 300000, 'vfc1') - - storage = mock.Mock(virt_adpts=[vscsi1, vscsi2], vfc_adpts=[vfc1]) - metric = mock.MagicMock(storage=storage) - return metric - - def _build_prev_mock_stor_metrics(self): - """Helper method to create mock storage metrics.""" - vscsi1 = self._mock_stor_metric(500, 500, 50000, 50000, 'vscsi1') - vfc1 = self._mock_stor_metric(2000, 2000, 20000, 200000, 'vfc1') - - storage = mock.Mock(virt_adpts=[vscsi1], vfc_adpts=[vfc1]) - metric = mock.MagicMock(storage=storage) - return metric - - def test_inspect_disk_iops(self): - """Tests the inspect_disk_iops inspector method for PowerVM.""" - # Validate that an error is raised if the instance can't be found in - # the sample data. - self.mock_metrics.get_latest_metric.return_value = None, None - self.mock_metrics.get_previous_metric.return_value = None, None - self.assertRaises(virt_inspector.InstanceNotFoundException, list, - self.inspector.inspect_disk_iops(mock.Mock(), None)) - - # Validate that no data is returned if there is a current metric, - # just no storage within it. - mock_empty_st = mock.MagicMock(storage=None) - self.mock_metrics.get_latest_metric.return_value = None, mock_empty_st - self.assertEqual( - [], list(self.inspector.inspect_disk_iops(mock.Mock(), None))) - - # Current metric data - mock_cur = self._build_cur_mock_stor_metrics() - cur_date = datetime.datetime.now() - self.mock_metrics.get_latest_metric.return_value = cur_date, mock_cur - - # Validate that if there is no previous data, get no data back. - self.assertEqual( - [], list(self.inspector.inspect_disk_iops(mock.Mock(), None))) - - # Build the previous - mock_prev = self._build_prev_mock_stor_metrics() - prev_date = cur_date - datetime.timedelta(seconds=30) - self.mock_metrics.get_previous_metric.return_value = (prev_date, - mock_prev) - - # Execute - resp = list(self.inspector.inspect_disk_iops(mock.Mock(), None)) - self.assertEqual(3, len(resp)) - - # Two vSCSI's - stats1 = resp[0] - self.assertEqual('vscsi1', stats1.device) - self.assertEqual(33, stats1.iops_count) - - stats2 = resp[1] - self.assertEqual('vscsi2', stats2.device) - self.assertEqual(133, stats2.iops_count) - - # Next is the vFC metric - stats3 = resp[2] - self.assertEqual('vfc1', stats3.device) - self.assertEqual(66, stats3.iops_count) - - def test_inspect_disks(self): - """Tests the inspect_disks inspector method for PowerVM.""" - # Validate that an error is raised if the instance can't be found in - # the sample data. - self.mock_metrics.get_latest_metric.return_value = None, None - self.assertRaises(virt_inspector.InstanceNotFoundException, list, - self.inspector.inspect_disks(mock.Mock(), None)) - - # Validate that no data is returned if there is a current metric, - # just no storage within it. - mock_empty_st = mock.MagicMock(storage=None) - self.mock_metrics.get_latest_metric.return_value = None, mock_empty_st - self.assertEqual([], - list(self.inspector.inspect_disks(mock.Mock(), None))) - - # Current metric data - mock_cur = self._build_cur_mock_stor_metrics() - cur_date = datetime.datetime.now() - self.mock_metrics.get_latest_metric.return_value = cur_date, mock_cur - - # Execute - resp = list(self.inspector.inspect_disks(mock.Mock(), None)) - self.assertEqual(3, len(resp)) - - # Two vSCSIs. - stats1 = resp[0] - self.assertEqual('vscsi1', stats1.device) - self.assertEqual(1000, stats1.read_requests) - self.assertEqual(100000, stats1.read_bytes) - self.assertEqual(1000, stats1.write_requests) - self.assertEqual(100000, stats1.write_bytes) - self.assertEqual(0, stats1.errors) - self.assertEqual(0, stats1.wr_total_times) - self.assertEqual(0, stats1.rd_total_times) - - stats2 = resp[1] - self.assertEqual('vscsi2', stats2.device) - self.assertEqual(2000, stats2.read_requests) - self.assertEqual(200000, stats2.read_bytes) - self.assertEqual(2000, stats2.write_requests) - self.assertEqual(200000, stats2.write_bytes) - self.assertEqual(0, stats2.errors) - self.assertEqual(0, stats2.wr_total_times) - self.assertEqual(0, stats2.rd_total_times) - - # Next is the vFC metric - stats3 = resp[2] - self.assertEqual('vfc1', stats3.device) - self.assertEqual(3000, stats3.read_requests) - self.assertEqual(300000, stats3.read_bytes) - self.assertEqual(3000, stats3.write_requests) - self.assertEqual(300000, stats3.write_bytes) - self.assertEqual(0, stats3.errors) - self.assertEqual(0, stats3.wr_total_times) - self.assertEqual(0, stats3.rd_total_times) diff --git a/ceilometer_powervm/version.py b/ceilometer_powervm/version.py deleted file mode 100644 index 11315ab..0000000 --- a/ceilometer_powervm/version.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2015, 2016 IBM Corp. -# -# 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. - -import pbr.version - -version_info = pbr.version.VersionInfo(__package__) diff --git a/devstack/README.rst b/devstack/README.rst deleted file mode 100644 index f82f10f..0000000 --- a/devstack/README.rst +++ /dev/null @@ -1,28 +0,0 @@ -======================== -Installing with Devstack -======================== - -1. Download DevStack:: - - $ git clone https://opendev.org/openstack/devstack /opt/stack/devstack - -2. Modify DevStack's local.conf to pull in both Ceilometer and this project by adding:: - - [[local|localrc]] - ... - enable_plugin ceilometer opendev.org/openstack/ceilometer - enable_plugin ceilometer-powervm opendev.org/openstack/ceilometer-powervm - -3. See ceilometer-powervm/doc/source/devref/usage.rst, then configure - the installation through options in local.conf as needed:: - - [[local|localrc]] - ... - - Example devstack config files for all-in-one, compute, and control nodes `can be - found here `_ - -4. Run ``stack.sh`` from devstack:: - - $ cd /opt/stack/devstack - $ ./stack.sh diff --git a/devstack/plugin.sh b/devstack/plugin.sh deleted file mode 100755 index dde56bb..0000000 --- a/devstack/plugin.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash -# -# plugin.sh - Devstack extras script to install and configure the ceilometer -# hypervisor inspector for powervm - -# This driver is enabled in ceilometer.conf with: -# hypervisor_inspector=powervm - -# The following entry points are called in this order for ceilometer-powervm: -# -# - install_ceilometer_powervm -# - configure_ceilometer_powervm -# - start_ceilometer_powervm -# - stop_ceilometer_powervm -# - cleanup_ceilometer_powervm - -# Save trace setting -MY_XTRACE=$(set +o | grep xtrace) -set +o xtrace - -# Defaults -# -------- - -# Set up base directories -CEILOMETER_CONF_DIR=${CEILOMETER_CONF_DIR:-/etc/ceilometer} -CEILOMETER_CONF=${CEILOMETER_CONF:-CEILOMETER_CONF_DIR/ceilometer.conf} -NOVA_CONF=${NOVA_CONF:-/etc/nova/nova.conf} - -# ceilometer-powervm directories -CEILOMETER_POWERVM_DIR=${CEILOMETER_POWERVM_DIR:-${DEST}/ceilometer-powervm} -CEILOMETER_POWERVM_PLUGIN_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]})) - -# Source functions -source $CEILOMETER_POWERVM_PLUGIN_DIR/powervm-functions.sh - -# Entry Points -# ------------ - -# configure_ceilometer_powervm() - Configure the system to use ceilometer_powervm -function configure_ceilometer_powervm { - # Set the hypervisor inspector to be powervm - iniset $CEILOMETER_CONF DEFAULT hypervisor_inspector $HYPERVISOR_INSPECTOR - - # Set the compute monitors - iniset $NOVA_CONF DEFAULT compute_monitors cpu.virt_driver -} - -# install_ceilometer_powervm() - Install ceilometer_powervm and necessary dependencies -function install_ceilometer_powervm { - # Install the ceilometer-powervm package - setup_develop $CEILOMETER_POWERVM_DIR -} - -# start_ceilometer_powervm() - Start the ceilometer_powervm process -function start_ceilometer_powervm { - # Check that NovaLink is installed and running - check_novalink_install - - # Start the pvm ceilometer compute agent - run_process pvm-ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF" -} - -# stop_ceilometer_powervm() - Stop the ceilometer_powervm process -function stop_ceilometer_powervm { - # Stop the pvm ceilometer compute agent - stop_process pvm-ceilometer-acompute -} - -# cleanup_ceilometer_powervm() - Cleanup the ceilometer_powervm process -function cleanup_ceilometer_powervm { - # This function intentionally left blank - : -} - -# Core Dispatch -# ------------- -if is_service_enabled pvm-ceilometer-acompute; then - if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then - # Install NovaLink if set - if [[ "$INSTALL_NOVALINK" = "True" ]]; then - echo_summary "Installing NovaLink" - install_novalink - fi - fi - - if [[ "$1" == "stack" && "$2" == "install" ]]; then - # Perform installation of ceilometer-powervm - echo_summary "Installing ceilometer-powervm" - install_ceilometer_powervm - - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - # Lay down configuration post install - echo_summary "Configuring ceilometer-powervm" - configure_ceilometer_powervm - - elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - # Initialize and start the ceilometer compute agent for PowerVM - echo_summary "Starting ceilometer-powervm" - start_ceilometer_powervm - fi - - if [[ "$1" == "unstack" ]]; then - # Shut down the ceilometer compute agent for PowerVM - echo_summary "Stopping ceilometer-powervm" - stop_ceilometer_powervm - fi - - if [[ "$1" == "clean" ]]; then - # Remove any lingering configuration data - # clean.sh first calls unstack.sh - echo_summary "Cleaning up ceilometer-powervm and associated data" - cleanup_ceilometer_powervm - fi -fi - -# Restore xtrace -$MY_XTRACE - -# Local variables: -# mode: shell-script -# End: diff --git a/devstack/powervm-functions.sh b/devstack/powervm-functions.sh deleted file mode 100644 index 2901eca..0000000 --- a/devstack/powervm-functions.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# devstack/powervm-functions.sh -# Functions to control the installation and configuration of the PowerVM compute services - -# TODO (adreznec) Uncomment when public NovaLink PPA available -# NOVALINK_PPA=${NOVALINK_PPA:-TBD} - -function check_novalink_install { - echo_summary "Checking NovaLink installation" - if ! ( is_package_installed pvm-novalink ); then - echo "WARNING: You are using the NovaLink drivers, but NovaLink is not installed on this system." - fi - - # The user that nova runs as should be a member of **pvm_admin** group - if ! getent group $PVM_ADMIN_GROUP >/dev/null; then - sudo groupadd $PVM_ADMIN_GROUP - fi - add_user_to_group $STACK_USER $PVM_ADMIN_GROUP -} - -function install_novalink { - echo_summary "Installing NovaLink" - if is_ubuntu; then - # Set up the NovaLink PPA - # TODO (adreznec) Uncomment when public NovaLink PPA available - # echo "deb ${NOVALINK_PPA} ${DISTRO} main" | sudo tee /etc/apt/sources.list.d/novalink-${DISTRO}.list - # echo "deb-src ${NOVALINK_PPA} ${DISTRO} main" | sudo tee --append /etc/apt/sources.list.d/novalink-${DISTRO}.list - - NO_UPDATE_REPOS=FALSE - REPOS_UPDATED=FALSE - else - die $LINENO "NovaLink is currently supported only on Ubuntu platforms" - fi - - install_package pvm-novalink - echo_summary "NovaLink install complete" -} diff --git a/devstack/settings b/devstack/settings deleted file mode 100644 index 46ab045..0000000 --- a/devstack/settings +++ /dev/null @@ -1,12 +0,0 @@ -# Devstack settings -# These defaults can be overridden in the localrc section of the local.conf file - -# Add ceilometer-powervm to enabled services -enable_service pvm-ceilometer-acompute - -# NovaLink install/upgrade settings -INSTALL_NOVALINK=$(trueorfalse False INSTALL_NOVALINK) -PVM_ADMIN_GROUP=${PVM_ADMIN_GROUP:-pvm_admin} - -# Ceilometer settings -HYPERVISOR_INSPECTOR=${HYPERVISOR_INSPECTOR:-"powervm"} diff --git a/doc/requirements.txt b/doc/requirements.txt deleted file mode 100644 index a3a98ff..0000000 --- a/doc/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -sphinx!=1.6.6,!=1.6.7,>=1.6.5 # BSD -openstackdocstheme>=1.19.0 # Apache-2.0 diff --git a/doc/source/conf.py b/doc/source/conf.py deleted file mode 100644 index 30cf41d..0000000 --- a/doc/source/conf.py +++ /dev/null @@ -1,87 +0,0 @@ -# ceilometer-powervm documentation build configuration file -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import os -import sys - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('../..')) - -# -- General configuration ------------------------------------------------ - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.autodoc', - 'openstackdocstheme' -] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'ceilometer-powervm' -copyright = u'2015, IBM' - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'openstackdocs' - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' -html_last_updated_fmt = '%Y-%m-%d %H:%M' - - -# -- Options for LaTeX output --------------------------------------------- - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'IBM', 'manual'), -] - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', - '%s' % project, - u'%s Documentation' % project, - u'IBM', 1) -] - - -# -- Options for openstackdocstheme ---------------------------------------- - -repository_name = 'openstack/ceilometer-powervm' -bug_project = 'ceilometer-powervm' -bug_tag = '' - - diff --git a/doc/source/devref/development_environment.rst b/doc/source/devref/development_environment.rst deleted file mode 100644 index 56bc22e..0000000 --- a/doc/source/devref/development_environment.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. - Copyright 2015 IBM - All Rights Reserved. - - 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. - -Setting Up a Development Environment -==================================== - -This page describes how to setup a working Python development -environment that can be used in developing ceilometer-powervm. - -These instructions assume you're already familiar with -Git and Gerrit, which is a code repository mirror and code review toolset, -however if you aren't please see `this Git tutorial`_ for an introduction -to using Git and `this guide`_ for a tutorial on using Gerrit and Git for -code contribution to Openstack projects. - -.. _this Git tutorial: https://git-scm.com/book/en/Getting-Started -.. _this guide: https://docs.openstack.org/infra/manual/developers.html#development-workflow - -Getting the code ----------------- - -Grab the code:: - - git clone https://opendev.org/openstack/ceilometer-powervm - cd ceilometer-powervm - -Setting up your environment ---------------------------- - -The purpose of this project is to provide the 'glue' between OpenStack -Telemetry (Ceilometer) and PowerVM. The `pypowervm`_ project is used to -control and monitor PowerVM systems. - -It is recommended that you clone down the OpenStack Ceilometer project along -with pypowervm into your respective development environment. - -Running the tox python targets for tests will automatically clone these down -via the requirements. When run with tox, it pulls the necessary requirements -into a virtualenv. - -Additional project requirements may be found in the requirements.txt file. - -.. _pypowervm: https://github.com/powervm/pypowervm diff --git a/doc/source/devref/index.rst b/doc/source/devref/index.rst deleted file mode 100644 index 0d90621..0000000 --- a/doc/source/devref/index.rst +++ /dev/null @@ -1,47 +0,0 @@ -.. - Copyright 2015 IBM - All Rights Reserved. - - 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. - -Developer Guide -=============== - -In the Developer Guide, you will find information on how to develop for -Ceilometer-PowerVM and how it interacts with Ceilometer. You will also find -information on setup and usage of Ceilometer-PowerVM. - - -Internals and Programming -------------------------- -.. toctree:: - :maxdepth: 3 - - development_environment - usage - - -Testing -------- -.. toctree:: - :maxdepth: 3 - - testing - -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/doc/source/devref/testing.rst b/doc/source/devref/testing.rst deleted file mode 100644 index 2679610..0000000 --- a/doc/source/devref/testing.rst +++ /dev/null @@ -1,65 +0,0 @@ -.. - Copyright 2015 IBM - All Rights Reserved. - - 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. - -Running Ceilometer-PowerVM Tests -================================ - -This page describes how to run the Ceilometer-PowerVM tests. This page assumes you -have already set up an working Python environment for Ceilometer-PowerVM development. - -With `tox` -~~~~~~~~~~ - -Ceilometer-PowerVM, like other OpenStack projects, uses `tox`_ for managing the virtual -environments for running test cases. It uses `Testr`_ for managing the running -of the test cases. - -Tox handles the creation of a series of `virtualenvs`_ that target specific -versions of Python. - -Testr handles the parallel execution of series of test cases as well as -the tracking of long-running tests and other things. - -For more information on the standard tox-based test infrastructure used by -OpenStack and how to do some common test/debugging procedures with Testr, -see this wiki page: - - https://wiki.openstack.org/wiki/Testr - -.. _Testr: https://wiki.openstack.org/wiki/Testr -.. _tox: http://tox.readthedocs.org/en/latest/ -.. _virtualenvs: https://pypi.python.org/project/virtualenv - -PEP8 and Unit Tests -+++++++++++++++++++ - -Running pep8 and unit tests is as easy as executing this in the root -directory of the Ceilometer-PowerVM source code:: - - tox - -To run only pep8:: - - tox -e pep8 - -Since pep8 includes running pylint on all files, it can take quite some time to run. -To restrict the pylint check to only the files altered by the latest patch changes:: - - tox -e pep8 HEAD~1 - -To run only the unit tests:: - - tox -e py27 diff --git a/doc/source/devref/usage.rst b/doc/source/devref/usage.rst deleted file mode 100644 index 068b52b..0000000 --- a/doc/source/devref/usage.rst +++ /dev/null @@ -1,25 +0,0 @@ -.. - Copyright 2015 IBM - All Rights Reserved. - - 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. - -Usage -===== -- Configure the PowerVM system for `NovaLink`_ -- Install the ceilometer-powervm plugin on the `NovaLink`_ VM on the PowerVM - Server. -- Set the hypervisor_inspector in the ceilometer.conf to "powervm" -- Start the ceilometer-agent-compute on the compute server - -.. _NovaLink: http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS215-262&appname=USN \ No newline at end of file diff --git a/doc/source/index.rst b/doc/source/index.rst deleted file mode 100644 index bd74cbf..0000000 --- a/doc/source/index.rst +++ /dev/null @@ -1,55 +0,0 @@ -.. - Copyright 2015 IBM - All Rights Reserved. - - 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. - -Welcome to Ceilometer-PowerVM's documentation! -============================================== - -This project will provide Ceilometer-compatible compute agent plugins -for monitoring instance utilization and statistics on PowerVM systems. - -Documentation on Ceilometer can be found at the `Ceilometer documentation`_. - -.. _`Ceilometer documentation`: http://docs.openstack.org/developer/ceilometer - -Ceilometer-PowerVM Information and Configuration -================================================ - -Contents: - -.. toctree:: - :maxdepth: 1 - - readme - -Ceilometer-PowerVM Policies -=========================== - -Contents: - -.. toctree:: - :maxdepth: 1 - - policies/index - -Ceilometer-PowerVM Devref -========================= - -Contents: - -.. toctree:: - :maxdepth: 1 - - devref/index diff --git a/doc/source/policies/bugs.rst b/doc/source/policies/bugs.rst deleted file mode 100644 index 4083827..0000000 --- a/doc/source/policies/bugs.rst +++ /dev/null @@ -1,26 +0,0 @@ -Ceilometer-PowerVM Bugs -======================= - -Ceilometer-PowerVM maintains all of its bugs in `Launchpad `_. -All of the current open Ceilometer-PowerVM bugs can be found in that link. - -Bug Triage Process ------------------- - -The process of bug triaging consists of the following steps: - -1. Check if a bug was filed for a correct component (project). If not, either change the project - or mark it as "Invalid". -2. Add appropriate tags. Even if the bug is not valid or is a duplicate of another one, it still - may help bug submitters and corresponding sub-teams. -3. Check if a similar bug was filed before. If so, mark it as a duplicate of the previous bug. -4. Check if the bug description is consistent, e.g. it has enough information for developers to - reproduce it. If it's not consistent, ask submitter to provide more info and mark a bug as - "Incomplete". -5. Depending on ease of reproduction (or if the issue can be spotted in the code), mark it as - "Confirmed". -6. Assign the importance. Bugs that obviously break core and widely used functionality should get - assigned as "High" or "Critical" importance. The same applies to bugs that were filed for gate - failures. -7. (Optional). Add comments explaining the issue and possible strategy of fixing/working around - the bug. diff --git a/doc/source/policies/code-reviews.rst b/doc/source/policies/code-reviews.rst deleted file mode 100644 index f7f2596..0000000 --- a/doc/source/policies/code-reviews.rst +++ /dev/null @@ -1,13 +0,0 @@ -Code Reviews -============ - -Code reviews are a critical component of all OpenStack projects. Code reviews provide a -way to enforce a level of consistency across the project, and also allow for the careful -onboarding of contributions from new contributors. - -Code Review Practices ---------------------- -Ceilometer-PowerVM follows the `code review guidelines `_ as -set forth for all OpenStack projects. It is expected that all reviewers are following the guidelines -set forth on that page. - diff --git a/doc/source/policies/contributing.rst b/doc/source/policies/contributing.rst deleted file mode 100644 index b1cd2f3..0000000 --- a/doc/source/policies/contributing.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../../CONTRIBUTING.rst diff --git a/doc/source/policies/index.rst b/doc/source/policies/index.rst deleted file mode 100644 index 8639080..0000000 --- a/doc/source/policies/index.rst +++ /dev/null @@ -1,40 +0,0 @@ -.. - Copyright 2015 IBM - All Rights Reserved. - - 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. - -Ceilometer-PowerVM Policies -=========================== - -In the Policies Guide, you will find documented policies for developing with -Ceilometer-PowerVM. This includes the processes we use for blueprints and specs, -bugs, contributor onboarding, and other procedural items. - -Policies --------- -.. toctree:: - :maxdepth: 3 - - bugs - contributing - code-reviews - readme - -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/doc/source/policies/readme.rst b/doc/source/policies/readme.rst deleted file mode 100644 index e4a3ad5..0000000 --- a/doc/source/policies/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../../README.rst diff --git a/doc/source/readme.rst b/doc/source/readme.rst deleted file mode 100644 index a6210d3..0000000 --- a/doc/source/readme.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../../README.rst diff --git a/etc/ceilometer/pipeline.yaml b/etc/ceilometer/pipeline.yaml deleted file mode 100644 index f25a8c2..0000000 --- a/etc/ceilometer/pipeline.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -sources: - - name: meter_source - interval: 600 - meters: - - "*" - sinks: - - meter_sink - - name: disk_source - interval: 600 - meters: - - "disk.read.bytes" - - "disk.read.requests" - - "disk.write.bytes" - - "disk.write.requests" - - "disk.device.read.bytes" - - "disk.device.read.requests" - - "disk.device.write.bytes" - - "disk.device.write.requests" - sinks: - - disk_sink -sinks: - - name: meter_sink - transformers: - publishers: - - notifier:// - - name: disk_sink - transformers: - - name: "rate_of_change" - parameters: - source: - map_from: - name: "(disk\\.device|disk)\\.(read|write)\\.(bytes|requests)" - unit: "(B|request)" - target: - map_to: - name: "\\1.\\2.\\3.rate" - unit: "\\1/s" - type: "gauge" - publishers: - - notifier:// diff --git a/lower-constraints.txt b/lower-constraints.txt deleted file mode 100644 index 4cb30a2..0000000 --- a/lower-constraints.txt +++ /dev/null @@ -1,79 +0,0 @@ -alabaster==0.7.10 -appdirs==1.3.0 -automaton==1.9.0 -Babel==2.3.4 -bashate==0.5.1 -cachetools==2.0.0 -ceilometer==11.0.0 -contextlib2==0.4.0 -coverage==4.0 -debtcollector==1.2.0 -decorator==3.4.0 -docutils==0.11 -extras==1.0.0 -fasteners==0.7.0 -fixtures==3.0.0 -flake8==2.5.5 -future==0.16.0 -futurist==1.2.0 -hacking==0.12.0 -imagesize==0.7.1 -iso8601==0.1.11 -Jinja2==2.10 -jsonschema==2.6.0 -keystoneauth1==3.4.0 -linecache2==1.0.0 -lxml==3.4.1 -MarkupSafe==1.0 -mccabe==0.2.1 -mock==2.0.0 -monotonic==0.6 -mox3==0.20.0 -msgpack-python==0.4.0 -netaddr==0.7.18 -netifaces==0.10.4 -networkx==1.10 -os-client-config==1.28.0 -os-testr==1.0.0 -oslo.concurrency==3.25.0 -oslo.config==5.2.0 -oslo.context==2.19.2 -oslo.i18n==3.15.3 -oslo.log==3.36.0 -oslo.serialization==2.18.0 -oslo.utils==3.33.0 -oslosphinx==4.7.0 -oslotest==3.2.0 -pbr==2.0.0 -pep8==1.5.7 -prettytable==0.7.2 -pyasn1==0.1.8 -pyasn1-modules==0.0.6 -pyflakes==0.8.1 -Pygments==2.2.0 -pyinotify==0.9.6 -pyparsing==2.1.0 -pypowervm==1.1.11 -python-dateutil==2.5.3 -python-mimeparse==1.6.0 -python-subunit==1.0.0 -pytz==2013.6 -PyYAML==3.12 -requests==2.14.2 -requestsexceptions==1.2.0 -rfc3986==0.3.1 -setuptools==21.0.0 -six==1.10.0 -snowballstemmer==1.2.1 -Sphinx==1.6.5 -sphinxcontrib-websupport==1.0.1 -stestr==1.0.0 -stevedore==1.20.0 -taskflow==2.16.0 -tenacity==3.2.1 -testrepository==0.0.18 -testscenarios==0.4 -testtools==2.2.0 -traceback2==1.4.0 -unittest2==1.1.0 -wrapt==1.7.0 diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 64763a2..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. -oslo.log>=3.36.0 # Apache-2.0 -pbr!=2.1.0,>=2.0.0 # Apache-2.0 -pypowervm>=1.1.11 # Apache-2.0 -setuptools!=24.0.0,!=34.0.0,!=34.0.1,!=34.0.2,!=34.0.3,!=34.1.0,!=34.1.1,!=34.2.0,!=34.3.0,!=34.3.1,!=34.3.2,!=36.2.0,>=21.0.0 # PSF/ZPL -ceilometer>=11.0.0 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index cb37399..0000000 --- a/setup.cfg +++ /dev/null @@ -1,45 +0,0 @@ -[metadata] -name = ceilometer-powervm -summary = PowerVM Ceilometer Inspector for OpenStack Ceilometer. -description-file = README.rst -author = OpenStack -author-email = openstack-discuss@lists.openstack.org -home-page = http://ceilometer-powervm.readthedocs.io/en/latest -classifier = - Environment :: OpenStack - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - -[entry_points] -ceilometer.compute.virt = - powervm = ceilometer_powervm.compute.virt.powervm.inspector:PowerVMInspector - -[files] -packages = ceilometer_powervm - -[compile_catalog] -directory = ceilometer_powervm/locale -domain = ceilometer-powervm - -[init_catalog] -domain = ceilometer-powervm -output_dir = ceilometer_powervm/locale -input_file = ceilometer_powervm/locale/ceilometer-powervm.pot - -[update_catalog] -domain = ceilometer-powervm -output_dir = ceilometer_powervm/locale -input_file = ceilometer_powervm/locale/ceilometer-powervm.pot - -[extract_messages] -keywords = _ gettext ngettext l_ lazy_gettext -mapping_file = babel.cfg -output_file = ceilometer_powervm/locale/ceilometer-powervm.pot diff --git a/setup.py b/setup.py deleted file mode 100644 index 566d844..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# 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. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr>=2.0.0'], - pbr=True) diff --git a/sonar-project.properties b/sonar-project.properties deleted file mode 100644 index 89caec6..0000000 --- a/sonar-project.properties +++ /dev/null @@ -1,13 +0,0 @@ -# Required metadata -sonar.projectKey=org.codehaus.sonar:ceilometer-powervm -sonar.projectName=ceilometer-powervm -sonar.projectVersion=1.0 - -# Comma-separated paths to directories with sources (required) -sonar.sources=. - -# Language -sonar.language=py - -# Encoding of the source files -sonar.sourceEncoding=UTF-8 diff --git a/specs/newton/template.rst b/specs/newton/template.rst deleted file mode 120000 index dc9373e..0000000 --- a/specs/newton/template.rst +++ /dev/null @@ -1 +0,0 @@ -../template.rst \ No newline at end of file diff --git a/specs/template.rst b/specs/template.rst deleted file mode 100644 index c5dbcc5..0000000 --- a/specs/template.rst +++ /dev/null @@ -1,255 +0,0 @@ -.. - This work is licensed under a Creative Commons Attribution 3.0 Unported - License. - - http://creativecommons.org/licenses/by/3.0/legalcode - -========================================== -Example Spec - The title of your blueprint -========================================== - -Include the URL of your launchpad blueprint: - -https://blueprints.launchpad.net/ceilometer-powervm/+spec/example - -Introduction paragraph -- why are we doing anything? A single paragraph of -prose that operators can understand. The title and this first paragraph -should be used as the subject line and body of the commit message -respectively. - -Some notes about using this template: - -* The aim of this document is first to define the problem we need to solve, - and second agree the overall approach to solve that problem. - -* You should aim to get your spec approved before writing your code. - While you are free to write prototypes and code before getting your spec - approved, its possible that the outcome of the spec review process leads - you towards a fundamentally different solution than you first envisaged. - -* Your spec should be in ReSTructured text, like this template. - -* Please wrap text at 79 columns. - -* The filename in the git repository should match the launchpad URL, for - example: https://blueprints.launchpad.net/ceilometer-powervm/+spec/awesome-thing - should be named awesome-thing.rst - -* Please do not delete any of the sections in this template. If you have - nothing to say for a whole section, just write: None - -* For help with syntax, see http://sphinx-doc.org/rest.html - -* To test out your formatting, build the docs using tox and see the generated - HTML file in doc/build/html/specs/ - -* If you would like to provide a diagram with your spec, ascii diagrams are - required. http://asciiflow.com/ is a very nice tool to assist with making - ascii diagrams. The reason for this is that the tool used to review specs is - based purely on plain text. Plain text will allow review to proceed without - having to look at additional files which can not be viewed in gerrit. It - will also allow inline feedback on the diagram itself. - - -Problem description -=================== - -A detailed description of the problem. What problem is this blueprint -addressing? - - -Use Cases ---------- - -What use cases does this address? What impact on actors does this change have? -Ensure you are clear about the actors in each use case: Developer, End User, -Deployer etc. - - -Proposed change -=============== - -Here is where you cover the change you propose to make in detail. How do you -propose to solve this problem? - -If this is one part of a larger effort make it clear where this piece ends. In -other words, what's the scope of this effort? - - -Alternatives ------------- - -What other ways could we do this thing? Why aren't we using those? This doesn't -have to be a full literature review, but it should demonstrate that thought has -been put into why the proposed solution is an appropriate one. - - -Security impact ---------------- - -Describe any potential security impact on the system. Some of the items to -consider include: - -* Does this change touch sensitive data such as tokens, keys, or user data? - -* Does this change involve cryptography or hashing? - -* Does this change require the use of sudo or any elevated privileges? - -* Does this change involve using or parsing user-provided data? This could - be directly at the API level or indirectly such as changes to a cache layer. - -* Can this change enable a resource exhaustion attack, such as allowing a - single API interaction to consume significant server resources? Some examples - of this include launching subprocesses for each connection, or entity - expansion attacks in XML. - -For more detailed guidance, please see the OpenStack Security Guidelines as -a reference (https://wiki.openstack.org/wiki/Security/Guidelines). These -guidelines are a work in progress and are designed to help you identify -security best practices. For further information, feel free to reach out -to the OpenStack Security Group at openstack-security@lists.openstack.org. - - -End user impact ---------------- - -How would the end user be impacted by this change? The "End User" is defined -as the users of the deployed cloud? - - -Performance Impact ------------------- - -Describe any potential performance impact on the system, for example -how often will new code be called, and is there a major change to the calling -pattern of existing code. - -Examples of things to consider here include: - -* A small change in a utility function or a commonly used decorator can have a - large impacts on performance. - -* Will the change include any locking, and if so what considerations are there - on holding the lock? - - -Deployer impact ---------------- - -Discuss things that will affect how you deploy and configure OpenStack -that have not already been mentioned, such as: - -* What config options are being added? Are the default values ones which will - work well in real deployments? - -* Is this a change that takes immediate effect after its merged, or is it - something that has to be explicitly enabled? - -* If this change is a new binary, how would it be deployed? - -* Please state anything that those doing continuous deployment, or those - upgrading from the previous release, need to be aware of. Also describe - any plans to deprecate configuration values or features. - - -Developer impact ----------------- - -Discuss things that will affect other developers working on the driver or -OpenStack in general. - - -Implementation -============== - -Assignee(s) ------------ - -Who is leading the writing of the code? Or is this a blueprint where you're -throwing it out there to see who picks it up? - -If more than one person is working on the implementation, please designate the -primary author and contact. - -Primary assignee: - - -Other contributors: - - -Work Items ----------- - -Work items or tasks -- break the feature up into the things that need to be -done to implement it. Those parts might end up being done by different people, -but we're mostly trying to understand the timeline for implementation. - - -Dependencies -============ - -* Include specific references to specs/blueprints in ceilometer-powervm, or - in other projects, that this one either depends on or is related to. For - example, a dependency on pypowervm changes should be documented here. - -* If this requires functionality of another project that is not currently used - by ceilometer-powervm document that fact. - -* Does this feature require any new library dependencies or code otherwise not - included in OpenStack? Or does it depend on a specific version of library? - - -Testing -======= - -Please discuss the important scenarios needed to test here, as well as -specific edge cases we should be ensuring work correctly. For each -scenario please specify if this requires specialized hardware, a full -openstack environment, etc. - -Please discuss how the change will be tested. We especially want to know what -functional tests will be added. It is assumed that unit test coverage will be -added so that doesn't need to be mentioned explicitly. - - -Documentation Impact -==================== - -Which audiences are affected most by this change, and which documentation -titles should be updated because of this change? Don't repeat details -discussed above, but reference them here in the context of documentation -for multiple audiences. - - -References -========== - -Please add any useful references here. You are not required to have any -reference. Moreover, this specification should still make sense when your -references are unavailable. Examples of what you could include are: - -* Links to mailing list or IRC discussions - -* Links to notes from a summit session - -* Links to relevant research, if appropriate - -* Related specifications as appropriate - -* Anything else you feel it is worthwhile to refer to - - -History -======= - -Optional section intended to be used each time the spec is updated to describe -new design. - -.. list-table:: Revisions - :header-rows: 1 - - * - Release Name - - Description - * - Mitaka - - Introduced diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 34d4b22..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,14 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. -hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 - -bashate>=0.5.1 # Apache-2.0 -coverage!=4.4,>=4.0 # Apache-2.0 -fixtures>=3.0.0 # Apache-2.0/BSD -python-subunit>=1.0.0 # Apache-2.0/BSD -stestr>=1.0.0 # Apache-2.0 -testscenarios>=0.4 # Apache-2.0/BSD -testtools>=2.2.0 # MIT -oslotest>=3.2.0 # Apache-2.0 -mock>=2.0.0 # BSD diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 7ef2876..0000000 --- a/tox.ini +++ /dev/null @@ -1,96 +0,0 @@ -[tox] -minversion = 3.1.1 -skipsdist = True -envlist = py27,py36,py37,pep8 -# Automatic envs (pyXX) will use the python version appropriate to that -# env and ignore basepython inherited from [testenv]. That's what we -# want, and we don't need to be warned about it. -ignore_basepython_conflict = True - -[testenv] -basepython = python3 -usedevelop = True -install_command = pip install {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} - PYTHONHASHSEED=0 - LANGUAGE=en_US - LC_ALL=en_US.utf-8 - OS_STDOUT_CAPTURE=1 - OS_STDERR_CAPTURE=1 - OS_TEST_TIMEOUT=60 -deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} - -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -rhttps://opendev.org/openstack/ceilometer/raw/branch/master/test-requirements.txt -whitelist_externals = - bash - find -commands = - find . -type f -name "*.pyc" -delete - -[testenv:py27] -commands = - {[testenv]commands} - stestr run {posargs} - stestr slowest - -[testenv:py36] -commands = - {[testenv]commands} - stestr run {posargs} - stestr slowest - -[testenv:py37] -commands = - {[testenv]commands} - stestr run {posargs} - stestr slowest - -[testenv:pep8] -commands = flake8 - -[testenv:venv] -commands = {posargs} - -[testenv:cover] -setenv = - {[testenv]setenv} - PYTHON=coverage run --source ceilometer_powervm --parallel-mode -commands = - {[testenv]commands} - coverage erase - stestr run {posargs} - coverage combine - coverage html -d cover - coverage xml -o cover/coverage.xml - coverage report - -[testenv:docs] -deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/master/upper-constraints.txt} - -r{toxinidir}/doc/requirements.txt -commands = sphinx-build -W -b html doc/source doc/build/html - -[testenv:bashate] -commands = - bash -c "ls devstack/*.sh | xargs bashate -v {posargs}" -whitelist_externals = bash - -[flake8] -ignore = -builtins = _ -exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,nova_tests,build -show-source = true - -[hacking] -import_exceptions = ceilometer.openstack.common.gettextutils - -[testenv:lower-constraints] -basepython = python3 -deps = - -c{toxinidir}/lower-constraints.txt - -r{toxinidir}/test-requirements.txt - -r{toxinidir}/requirements.txt - -rhttps://opendev.org/openstack/ceilometer/raw/branch/master/test-requirements.txt