Make scheduler.utils.setup_instance_group query all cells
To check affinity and anti-affinity policies for scheduling instances,
we use the RequestSpec.instance_group.hosts field to check the hosts
that have group members on them. Access of the 'hosts' field calls
InstanceGroup.get_hosts during a lazy-load and get_hosts does a query
for all instances that are members of the group and returns their hosts
after removing duplicates. The InstanceList query isn't targeting any
cells, so it will return [] in a multi-cell environment in both the
instance create case and the instance move case. In the move case, we
do have a cell-targeted RequestContext when setup_instance_group is
called *but* the RequestSpec.instance_group object is queried early in
compute/api before we're targeted to a cell, so a call of
RequestSpec.instance_group.get_hosts() will result in [] still, even
for move operations.
This makes setup_instance_group query all cells for instances that are
members of the instance group if the RequestContext is untargeted, else
it queries the targeted cell for the instances.
Closes-Bug: #1746863
Change-Id: Ia5f5a0d75953b1154a8de3e1eaa15f8042e32d77
(cherry picked from commit 14f4c502f92b10b669044e5069ac3b3555a42ee0)
(cherry picked from commit 3051a0d5d5639b451d6da5e9f490332399b18c54)
(cherry picked from commit ab939372cd0488a0a4e2a8a1764a42eff2e329c5)
Reviewed: https:/ /review. openstack. org/599841 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=1a266633e10 77fe4a9101bb456 a69ab89689be4b
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit 1a266633e1077fe 4a9101bb456a69a b89689be4b
Author: melanie witt <email address hidden>
Date: Fri Feb 2 05:41:20 2018 +0000
Make scheduler. utils.setup_ instance_ group query all cells
To check affinity and anti-affinity policies for scheduling instances, instance_ group.hosts field to check the hosts up.get_ hosts during a lazy-load and get_hosts does a query group is instance_ group object is queried early in .instance_ group.get_ hosts() will result in [] still, even
we use the RequestSpec.
that have group members on them. Access of the 'hosts' field calls
InstanceGro
for all instances that are members of the group and returns their hosts
after removing duplicates. The InstanceList query isn't targeting any
cells, so it will return [] in a multi-cell environment in both the
instance create case and the instance move case. In the move case, we
do have a cell-targeted RequestContext when setup_instance_
called *but* the RequestSpec.
compute/api before we're targeted to a cell, so a call of
RequestSpec
for move operations.
This makes setup_instance_ group query all cells for instances that are
members of the instance group if the RequestContext is untargeted, else
it queries the targeted cell for the instances.
Closes-Bug: #1746863
Change-Id: Ia5f5a0d75953b1 154a8de3e1eaa15 f8042e32d77 669044e5069ac3b 3555a42ee0) 51d6da5e9f49033 2399b18c54) 0a4e2a8a1764a42 eff2e329c5)
(cherry picked from commit 14f4c502f92b10b
(cherry picked from commit 3051a0d5d5639b4
(cherry picked from commit ab939372cd0488a