Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scheduler: Don't modify RequestSpec.numa_topology
The 'NUMATopologyFilter' makes a call to 'numa_fit_instance_to_host' in order to determine whether an instance with a sample topology could fit on a given host. This function is provided with an InstanceNUMATopology object, which was extracted from the RequestSpec provided to the filter. However, the 'numa_fit_instance_to_host' call has the side effect of modifying a couple of fields on this InstanceNUMATopology object, most notably the pinning information, and these changes are then propagated to subsequent calls of the filter. The reason for this propagation is presumably Python's "call-by-object" model [1]. While this doesn't cause any issues currently, it is a latent bug that has caused issues downstream. Resolve the issue by copying the entire RequestSpec object, thus ensuring any changes to this or the contained NUMA topology are not stored and cannot affect future calls to this or other filters. [1] https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/ Change-Id: If26cbdd5189c53891554c8d128be9b90578616aa Closes-Bug: #1655979
- Loading branch information