Skip to content

Commit 6edbb63

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add ability for diplaying hypervisor statistics"
2 parents 8f7e0ef + 90c4a0a commit 6edbb63

4 files changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
================
2+
hypervisor stats
3+
================
4+
5+
Compute v2
6+
7+
hypervisor stats show
8+
---------------------
9+
10+
Display hypervisor stats details
11+
12+
.. program:: hypervisor stats show
13+
.. code:: bash
14+
15+
os hypervisor stats show
16+

‎doc/source/commands.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ referring to both Compute and Volume quotas.
8888
* ``group``: (**Identity**) a grouping of users
8989
* ``host``: Compute - the physical computer running a hypervisor
9090
* ``hypervisor``: (**Compute**) the virtual machine manager
91+
* ``hypervisor stats``: (**Compute**) hypervisor statistics over all compute nodes
9192
* ``identity provider``: (**Identity**) a source of users and authentication
9293
* ``image``: (**Image**) a disk image
9394
* ``ip fixed``: Compute, Network - an internal IP address assigned to a server
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
#
13+
14+
15+
"""Hypervisor Stats action implementations"""
16+
17+
import logging
18+
import six
19+
20+
from cliff import show
21+
22+
23+
class ShowHypervisorStats(show.ShowOne):
24+
"""Display hypervisor stats details"""
25+
26+
log = logging.getLogger(__name__ + ".ShowHypervisorStats")
27+
28+
def take_action(self, parsed_args):
29+
self.log.debug("take_action(%s)", parsed_args)
30+
compute_client = self.app.client_manager.compute
31+
hypervisor_stats = compute_client.hypervisors.statistics().to_dict()
32+
33+
return zip(*sorted(six.iteritems(hypervisor_stats)))

‎setup.cfg‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ openstack.compute.v2 =
8282
hypervisor_list = openstackclient.compute.v2.hypervisor:ListHypervisor
8383
hypervisor_show = openstackclient.compute.v2.hypervisor:ShowHypervisor
8484

85+
hypervisor_stats_show = openstackclient.compute.v2.hypervisor_stats:ShowHypervisorStats
86+
8587
ip_fixed_add = openstackclient.compute.v2.fixedip:AddFixedIP
8688
ip_fixed_remove = openstackclient.compute.v2.fixedip:RemoveFixedIP
8789

0 commit comments

Comments
 (0)