VM resize and confirm on the same host fails with custom resources

Bug #1713739 reported by Lajos Katona
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Unassigned

Bug Description

VM resize and confirm on the same host fails with custom resources, as the old resources are not deallocated after 'confirmResize'.
Steps to reproduce:
- boot a VM with old_flavor
- resize to new_flavor to the same host
- send confirmResize
- check usages and compare with new_flavor, and there will be double allocations (old_flavor + new_flavor)

Related Nova log:
2017-08-29 16:22:22,666 INFO [nova.api.openstack.placement.requestlog] 127.0.0.1 "GET /placement/allocations/8d989deb-860e-4ade-a581-a01b819b6297" status: 200 len: 326 microversion: 1.0
    2017-08-29 16:22:22,666 DEBUG [nova.scheduler.client.report] Current allocations for instance: {u'5f7fdb12-9866-4534-b0ce-ba60b14f37cb': {u'resources': {u'CUSTOM_MAGIC': 256}, u'generation': 4}, u'
60b3f076-ebd9-499e-a9d0-83013320505c': {u'resources': {u'MEMORY_MB': 3072, u'DISK_GB': 60, u'VCPU': 2}, u'generation': 3}, u'c522247d-e8ee-4f6c-848d-367eb99885d6': {u'resources': {u'CUSTOM_MAGIC': 256}
, u'generation': 4}}
    2017-08-29 16:22:22,666 DEBUG [nova.scheduler.client.report] Instance 8d989deb-860e-4ade-a581-a01b819b6297 has resources on 1 compute nodes
    2017-08-29 16:22:22,666 DEBUG [nova.scheduler.client.report] Original resources from same-host allocation: {u'MEMORY_MB': 3072, u'DISK_GB': 60, u'VCPU': 2}
    2017-08-29 16:22:22,667 DEBUG [nova.scheduler.client.report] Subtracting old resources from same-host allocation: {u'MEMORY_MB': 1024, u'DISK_GB': 40, u'VCPU': 1, u'CUSTOM_MAGIC': -256}
    2017-08-29 16:22:22,667 DEBUG [nova.scheduler.client.report] Sending updated allocation [{'resource_provider': {'uuid': u'5f7fdb12-9866-4534-b0ce-ba60b14f37cb'}, 'resources': {u'CUSTOM_MAGIC': 256}
}, {'resource_provider': {'uuid': u'c522247d-e8ee-4f6c-848d-367eb99885d6'}, 'resources': {u'CUSTOM_MAGIC': 256}}, {'resource_provider': {'uuid': '60b3f076-ebd9-499e-a9d0-83013320505c'}, 'resources': {u
'MEMORY_MB': 1024, u'DISK_GB': 40, u'VCPU': 1, u'CUSTOM_MAGIC': -256}}] for instance 8d989deb-860e-4ade-a581-a01b819b6297 after removing resources for 60b3f076-ebd9-499e-a9d0-83013320505c.
    2017-08-29 16:22:22,667 DEBUG [nova.api.openstack.placement.requestlog] Starting request: 127.0.0.1 "PUT /placement/allocations/8d989deb-860e-4ade-a581-a01b819b6297"
    2017-08-29 16:22:22,670 DEBUG [nova.api.openstack.placement.wsgi_wrapper] Placement API returning an error response: JSON does not validate: -256 is less than the minimum of 1

    Failed validating 'minimum' in schema['properties']['allocations']['items']['properties']['resources']['patternProperties']['^[0-9A-Z_]+$']:
        {'minimum': 1, 'type': 'integer'}

    On instance['allocations'][2]['resources'][u'CUSTOM_MAGIC']:
        -256
    2017-08-29 16:22:22,671 INFO [nova.api.openstack.placement.requestlog] 127.0.0.1 "PUT /placement/allocations/8d989deb-860e-4ade-a581-a01b819b6297" status: 400 len: 532 microversion: 1.10
    2017-08-29 16:22:22,671 WARNING [nova.scheduler.client.report] Failed to save allocation for 8d989deb-860e-4ade-a581-a01b819b6297. Got HTTP 400: <html>
     <head>
      <title>400 Bad Request</title>
     </head>
     <body>
      <h1>400 Bad Request</h1>
      The server could not comply with the request since it is either malformed or otherwise incorrect.<br /><br />
    JSON does not validate: -256 is less than the minimum of 1

    Failed validating 'minimum' in schema['properties']['allocations']['items']['properties']['resources']['patternProperties']['^[0-9A-Z_]+$']:
        {'minimum': 1, 'type': 'integer'}

    On instance['allocations'][2]['resources'][u'CUSTOM_MAGIC']:
        -256

     </body>
    </html>

tags: added: custom-resource-class placement resize
Chris Dent (cdent)
tags: added: resource-tracker scheduler
Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

Lajos has a regression test for it as well and he will push that up soon.

Revision history for this message
Lajos Katona (lajos-katona) wrote :

I uploaded the patch, which extends the server moving testcase class with custom resources (WIP actually, but good enough for reproduction now):
https://review.openstack.org/497399

Revision history for this message
Lajos Katona (lajos-katona) wrote :

Yeah, and the test actually which shows the trouble:
nova.tests.functional.test_servers.ServerMovingTestsWithCustomResources.test_resize_confirm_same_host

Sean Dague (sdague)
Changed in nova:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

This was fixed as part of the fix for bug 1707252

Changed in nova:
status: Confirmed → Fix Released
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.