xapi_vif: Guarantee the device parameter is an unsigned decimal integer #6495
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has been always true as xapi will call valid_device on VIF creation to
make sure device is an integer, but the datamodel type of 'device' is string,
without any such guarantees.
Specify the guarantee in the documentation and make the check stricter
(int_of_string will accept "0x9fe" as an integer, for example), making sure
that the device is specifically a decimal unsigned integer. allowed_VIF_devices
has already enforced the unsigned decimal integer limitation on compliant clients.
This could be helpful in ensuring that the clients will always be right in
sorting devices as numbers, not as strings (so that "2" follows "1" instead of
the string order of "1"->"10"->"11", etc.).