libvirt: Shared Resource Provider (RP) DISK_GB is NOT taken into account if it's configured with Compute Node RPs

Bug #1771728 reported by Bhagyashri Shewale
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Bhagyashri Shewale

Bug Description

If user configures shared resource provider for disk_gb resources and links it with the compute nodes resource provider using aggregates then the disk_gb resources are still allocated from compute Node resource provider instead of shared resource provider.

Environment Details:

commit id: 0051e622e90ef4ea2678f3a1135043da460cad19

1. Compute Host A
2. NFS server on Host B
3. Disk files stored in the instance path on each compute nodes is mounted on NFS server storage.

Steps to reproduce:

1. Create shared resource provider

$ curl -g -i -X POST http://<HOST IP>/placement/resource_providers -H "Content-Type: application/json" -H "X-Auth-Token: <auth-token value>" -H "OpenStack-API-Version: placement latest" -d '{"name": "shared-disk", "uuid": <UUID of ----->'

2. Create inventory DISK_GB against shared resource provider created step 1.

$ curl -g -i -X POST http://<HOST IP>/placement/resource_providers/<RP ID>/inventories -H "Content-Type: application/json" -H "X-Auth-Token: <auth-token value>" " -d '{"resource_class": "DISK_GB", "total": 78, "reserved": 0, "min_unit": 1, "max_unit": 78, "step_size": 1, "allocation_ratio": 1.0}'

3. Create an aggregate

$ nova aggregate-create shared_resource_aggregate

4. link both the compute node RP and shared resource provider to agrregate create in step 3

$ curl -g -i -X PUT http://<HOST IP>/placement/resource_providers/<RP ID>/aggregates -H "Accept: application/json" -H "Content-Type: application/json" -H "OpenStack-API-Version: placement latest" -H "x-auth-token: <auth-token value>" " -d '{"aggregates": [ "<aggregate ID>" ], "resource_provider_generation": 1}'

5. Add MISC_SHARES_VIA_AGGREGATE trait to shared resource provider

$ curl -g -i -X PUT http://<HOST IP>/placement/resource_providers/<RP ID>/traits -H "Accept: application/json" -H "Content-Type: application/json" -H "OpenStack-API-Version: placement latest" -H "x-auth-token: <auth-token value>" " -d '{"traits": ["MISC_SHARES_VIA_AGGREGATE"], "resource_provider_generation": 1}'

6. Boot the instance:

 Flavor Details:

 $ nova boot --flavor 1 --image <image_id> <instance_name>

7. Check usages of compute node resource provider:

$ curl -g -i -X GET http://<HOST IP>/placement/resource_providers/<RP ID>/usages -H "Accept: application/json" -H "Content-Type: application/json" -H "OpenStack-API-Version: placement latest" -H "x-auth-token: 27903d0f-cc28-45ae-ae2e-3105c9e640b9"
HTTP/1.1 200 OK
Date: Wed, 28 Mar 2018 06:22:59 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 90
Content-Type: application/json
Cache-Control: no-cache
Last-Modified: Wed, 28 Mar 2018 06:22:59 GMT
openstack-api-version: placement 1.21
vary: openstack-api-version
x-openstack-request-id: req-b3fe929f-187f-47d6-92a6-03c605a39848
Connection: close

{"resource_provider_generation": 5, "usages": {"VCPU": 1, "MEMORY_MB": 512, "DISK_GB": 1}}

8. Check usages of shared resource provider:

$ curl -g -i -X GET http:// <HOST IP>/placement/resource_providers/<RP ID>/usages -H "Accept: application/json" -H "Content-Type: application/json" -H "OpenStack-API-Version: placement latest" -H "x-auth-token: 27903d0f-cc28-45ae-ae2e-3105c9e640b9"
HTTP/1.1 200 OK
Date: Wed, 28 Mar 2018 06:23:05 GMT
Server: Apache/2.4.18 (Ubuntu)
Content-Length: 61
Content-Type: application/json
Cache-Control: no-cache
Last-Modified: Wed, 28 Mar 2018 06:23:05 GMT
openstack-api-version: placement 1.21
vary: openstack-api-version
x-openstack-request-id: req-8093854e-c5ab-429a-8dbc-474ef06ed243
Connection: close

{"resource_provider_generation": 3, "usages": {"DISK_GB": 0}}

Observation:
By comparing usages details above (point 7 and 8) it shows that DISK_GB is consumed from Compute Node Resource Provider and not from the Shared Resource Provider.

Expected Result: DISK_GB should be allocated from the shared resource provider.

Changed in nova:
assignee: nobody → Bhagyashri Shewale (bhagyashri-shewale)
Changed in nova:
status: New → In Progress
Changed in nova:
assignee: Bhagyashri Shewale (bhagyashri-shewale) → Eric Fried (efried)
Changed in nova:
assignee: Eric Fried (efried) → Bhagyashri Shewale (bhagyashri-shewale)
Changed in nova:
assignee: Bhagyashri Shewale (bhagyashri-shewale) → Eric Fried (efried)
Revision history for this message
Jay Pipes (jaypipes) wrote :

Unless I'm badly mistaken, the root cause of this bug is that the compute node resource provider continues to have inventory of DISK_GB, even when a sharing provider of DISK_GB is associated with it. The solution to this problem should be that the virt driver should notice that there is a sharing provider of DISK_GB and remove the DISK_GB inventory on the compute node resource provider.

Revision history for this message
Eric Fried (efried) wrote :

@Jay, that's exactly what https://review.openstack.org/#/c/560459/ is doing. (This bug was opened after the code was started, which I guess is why that patch didn't get tagged in here.)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/569228
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b864d08eaf8b670cc173319d661e82111eb54f08
Submitter: Zuul
Branch: master

commit b864d08eaf8b670cc173319d661e82111eb54f08
Author: Eric Fried <email address hidden>
Date: Thu May 17 14:07:15 2018 -0500

    ProviderTree.has_inventory_changed for new fields

    The has_inventory_changed method of ProviderTree is deliberately not
    automatically reporting True if the incoming record is "sparse" - that
    is, for a given resource class, it only contains a subset of the keys in
    the existing record. For example, the caller may want to know if the
    total has changed, but doesn't care about the other fields, so may ask:

    ptree.has_inventory_changed(uuid, {'VCPU': {'total': 3}, ...})

    ...and has_inventory_changed will only compare the 'total' field.

    However, we were doing the same if the incoming record contained fields
    that were *not* in the existing record. For example, if the current
    inventory was:

    { 'VCPU': {
          'total': 8,
          'min_unit': 1,
          'max_unit': 8,
          'step_size': 1,
      }
    }

    ...and the new inventory was:

    { 'VCPU': {
          'total': 8,
          'min_unit': 1,
          'max_unit': 8,
          'step_size': 1,
          'allocation_ratio': 16.0, # <== new
          'reserved': 1, # <== new
      }
    }

    ...the presence of the new fields was *not* enough to trigger a True
    response.

    This is problematic because we currently expect to be able to add
    specifically these fields - allocation_ratio and reserved - to an
    inventory record if they are not present (see [1]).

    With this change set, we add a condition to automatically return True
    (inventory *has* changed) whenever the incoming (new) record contains
    fields absent from the existing record.

    [1] https://github.com/openstack/nova/blob/050e9202f69b6eeb23026b7350eeb8821ca9f1cc/nova/compute/resource_tracker.py#L83-L125

    Partial-Bug: #1771728
    Change-Id: I80dd6d08322bcedc8535f04baf2e96473f5e3aeb

Changed in nova:
assignee: Eric Fried (efried) → Bhagyashri Shewale (bhagyashri-shewale)
Changed in nova:
assignee: Bhagyashri Shewale (bhagyashri-shewale) → Jay Pipes (jaypipes)
Jay Pipes (jaypipes)
Changed in nova:
assignee: Jay Pipes (jaypipes) → Bhagyashri Shewale (bhagyashri-shewale)
Changed in nova:
assignee: Bhagyashri Shewale (bhagyashri-shewale) → Balazs Gibizer (balazs-gibizer)
Changed in nova:
assignee: Balazs Gibizer (balazs-gibizer) → Bhagyashri Shewale (bhagyashri-shewale)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/560459
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=7e48b227d0622b268f74d1a559aca4cd3784f7cf
Submitter: Zuul
Branch: master

commit 7e48b227d0622b268f74d1a559aca4cd3784f7cf
Author: Eric Fried <email address hidden>
Date: Wed Apr 11 09:47:49 2018 -0500

    libvirt: Don't report DISK_GB if sharing

    For libvirt, if the operator wishes to use shared storage, they must
    manually configure the sharing resource provider in placement and
    associate it via aggregate with the compute node. However, the libvirt
    driver was still reporting the (same) DISK_GB inventory in the compute
    node provider.

    With this patch, we check the provider tree to see if a sharing provider
    of DISK_GB is present. If so, we don't report that inventory - because
    it's already accounted for by the sharing provider.

    Co-Authored-By: Bhagyashri Shewale <email address hidden>
    Closes-Bug: #1771728
    Change-Id: Iea283322124cb35fc0bc6d25f35548621e8c8c2f

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.0.0.0b3

This issue was fixed in the openstack/nova 18.0.0.0b3 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.