← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1325304] Re: hypervisors.staticstics().running_vms count includes shutdown vms

 

I was able to reproduce what you saw using devstack, I powered off the
one vm I had and still saw running_vms = 1. I used nova --debug
hypervisor-stats to see what came back from nova api, and it matched:

REQ: curl -i 'http://10.0.2.15:8774/v2/a7f85c3e8af5467c91019cfb7af62cc9/os-hypervisors/statistics' -X GET -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: admin" -H "X-Auth-Token: {SHA1}b364808d3f8ec53bf7603abd9cb77af17cebb9af"
RESP: [200] {'date': 'Thu, 11 Sep 2014 21:14:55 GMT', 'connection': 'keep-alive', 'content-type': 'application/json', 'content-length': '257', 'x-compute-request-id': 'req-0e1fc40c-db77-4d75-9455-5e831fa580c8'}
RESP BODY: {"hypervisor_statistics": {"count": 1, "vcpus_used": 1, "local_gb_used": 1, "memory_mb": 7986, "current_workload": 0, "vcpus": 2, "running_vms": 1, "free_disk_gb": 77, "disk_available_least": 68, "local_gb": 78, "free_ram_mb": 6962, "memory_mb_used": 1024}}

I looked around the nova code and found indeed "running vms" doesn't
take power state into account and I don't think it's a bug -- it might
technically be "runnable vms." I'll add nova to this bug and mark it as
a Wishlist item.

** Changed in: python-novaclient
       Status: New => Invalid

** Also affects: nova
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1325304

Title:
  hypervisors.staticstics().running_vms count includes shutdown vms

Status in OpenStack Compute (Nova):
  Confirmed
Status in Python client library for Nova:
  Invalid

Bug description:
  Nova client reports:

  In [13]: from novaclient.v1_1 import client

  In [14]: from django.conf import settings

  In [15]: nt = client.Client(settings.OS_USERNAME, settings.OS_PASSWORD,
                         settings.OS_TENANT_NAME, settings.OS_AUTH_URL,
                         service_type="compute")

  In [16]: nt.hypervisors.statistics().running_vms
  Out[16]: 12

  DB reports:

  mysql> select hostname, availability_zone, vm_state from instances where vm_state != 'deleted';
  +----------------+-------------------+----------+
  | hostname       | availability_zone | vm_state |
  +----------------+-------------------+----------+
  | js1            | nova              | active   |
  | js2            | nova              | active   |
  | js3            | nova              | active   |
  | cirros1        | nova              | stopped  |
  | js4            | nova              | stopped  |
  | js5            | nova              | stopped  |
  | jstest1east    | east-zone         | stopped  |
  | jstest1west    | NULL              | active   |
  | randgen-mpv8sw | NULL              | active   |
  | randgen-fbjk98 | NULL              | stopped  |
  | randgen-tvcl9t | NULL              | active   |
  | stratus        | NULL              | active   |
  +----------------+-------------------+----------+
  12 rows in set (0.00 sec)

  Either the field name is misleading, or the data is not being filtered
  properly.  As a suggestion, it would be nice to have a total and
  running vm count.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1325304/+subscriptions