percent must be escaped in live_migration_uri

Bug #1677913 reported by Oliver Walsh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
In Progress
Low
Stephen Finucane

Bug Description

The libvirt uris allow extra parameters to be specified in the query sting. More info here https://libvirt.org/guide/html/Application_Development_Guide-Architecture-Remote_URIs.html

However nova interprets live_migration_uri using python string formatting - https://github.com/openstack/nova/blob/83256b7c789700ce837f4d136bc6ab8811f2d505/nova/virt/libvirt/driver.py#L675

This can result in a "TypeError: not enough arguments for format string" as the query string will be url escaped (lot of % chars).

Revision history for this message
Oliver Walsh (owalsh) wrote :
Revision history for this message
John Garbutt (johngarbutt) wrote :

To be clear, this is needed because we get the destination host, and then substitute that into the locally configured URL pattern.

This is largely why the live_migration_uri is now deprecated in favor of several specific configuration options, that makes this all more discoverable.

I don't believe this is new behaviour as such, but I could be very wrong on that. I am curious if it is a change.

Maybe the "fix" here is to warn users in the configuration description?

Revision history for this message
Oliver Walsh (owalsh) wrote :

Yes, doc fix is the only option I can see. I raised this mostly just to highlight the issue. Fixing this would break any workarounds in place so it's best to continue with the deprecation of this config param.

Andrey Volkov (avolkov)
Changed in nova:
status: New → Confirmed
importance: Undecided → Low
tags: added: doc
Revision history for this message
Sean Dague (sdague) wrote :

Found open reviews for this bug in gerrit, setting to In Progress.

review: https://review.openstack.org/456571 in branch: master

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
sean mooney (sean-k-mooney) wrote :

as noted in https://review.opendev.org/#/c/456571/12
i am not sure this bug was ever valid.
i think the real issue was ooo url encoding extra params incorrectly.

from the libvirt docs at https://libvirt.org/uri.html#Remote_URI_parameters

"Extra parameters can be added to remote URIs as part of the query string (the part following "?"). Remote URIs understand the extra parameters shown below. Any others are passed unmodified through to the back end. Note that parameter values must be URI-escaped."

ooo should only have been url encoding partater not understood by libvirt which i dont think they should have been using to start with. ignoring that point for a moment i suspect that ooo just url encoded the entire sting not understanding that that woudl be invalid and that they need to url encode each parmater indigivuly if its not one of the supported set and then do s replce of % with %% because nova requires this to be a vaild python format string.

we have some patches up to adress this now so i guess the deprecation of live_migration_uri
and its replacment is gong to continue but as someone who never was in foavor of that direction im kind of sad to find that the bug that one of the related bugs that caused it is likely not correct.

Changed in nova:
assignee: nobody → Stephen Finucane (stephenfinucane)
Revision history for this message
Oliver Walsh (owalsh) wrote :

FWIW https://libvirt.org/uri.html says it's RFC 2396 URIs, so ooo was correctly encoding it.

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.