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
Conflicts:
nova/objects/instance_group.py
NOTE(melwitt): The conflict was from oslo_utils jsonutils not being
used in Queens.
Change-Id: Ia5f5a0d75953b1154a8de3e1eaa15f8042e32d77
(cherry picked from commit 14f4c502f92b10b669044e5069ac3b3555a42ee0)
(cherry picked from commit 3051a0d5d5639b451d6da5e9f490332399b18c54)
Reviewed: https:/ /review. openstack. org/599766 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=ab939372cd0 488a0a4e2a8a176 4a42eff2e329c5
Committed: https:/
Submitter: Zuul
Branch: stable/queens
commit ab939372cd0488a 0a4e2a8a1764a42 eff2e329c5
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
Conflicts: objects/ instance_ group.py
nova/
NOTE(melwitt): The conflict was from oslo_utils jsonutils not being
used in Queens.
Change-Id: Ia5f5a0d75953b1 154a8de3e1eaa15 f8042e32d77 669044e5069ac3b 3555a42ee0) 51d6da5e9f49033 2399b18c54)
(cherry picked from commit 14f4c502f92b10b
(cherry picked from commit 3051a0d5d5639b4