Retire PowerVMStacker SIG: Remove Project Content

Depends-on: https://review.opendev.org/c/openstack/project-config/+/909535
Change-Id: I9983db89974e37134cde612d55affb6b6b38230a
This commit is contained in:
Takashi Kajinami 2024-02-20 22:53:16 +09:00
parent 7ca211e700
commit 610a2e4fe6
60 changed files with 6 additions and 3031 deletions

29
.gitignore vendored
View File

@ -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

View File

@ -1,4 +0,0 @@
[DEFAULT]
test_path=./ceilometer_powervm/tests
top_dir=./

View File

@ -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

View File

@ -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

View File

@ -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.

176
LICENSE
View File

@ -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.

View File

@ -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.

View File

@ -1,2 +0,0 @@
[python: **.py]

View File

@ -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]

View File

@ -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

View File

@ -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)

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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 <EMAIL@ADDRESS>, 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 <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\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

View File

@ -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)

View File

@ -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)