Looking at this again, this statement in the description is not accurate:
> we get the request spec with the group plus the current hosts/members of the group.
The RequestSpec will load the InstanceGroup by uuid but the InstanceGroup.hosts field is not loaded:
https://github.com/openstack/nova/blob/c7e9e667426a6d88d396a59cb40d30763a3265f9/nova/objects/instance_group.py#L177
That's why we have this check in setup_instance_group so we load the InstanceGroup.hosts from the correct cell(s) based on where the member instances are:
https://github.com/openstack/nova/blob/c7e9e667426a6d88d396a59cb40d30763a3265f9/nova/scheduler/utils.py#L989
I still think it likely means, however, that this code is redundant:
https://github.com/openstack/nova/blob/c7e9e667426a6d88d396a59cb40d30763a3265f9/nova/scheduler/utils.py#L944-L950
I'm not sure in what case user_group_hosts would be different from group_hosts.
Looking at this again, this statement in the description is not accurate:
> we get the request spec with the group plus the current hosts/members of the group.
The RequestSpec will load the InstanceGroup by uuid but the InstanceGroup.hosts field is not loaded:
https:/ /github. com/openstack/ nova/blob/ c7e9e667426a6d8 8d396a59cb40d30 763a3265f9/ nova/objects/ instance_ group.py# L177
That's why we have this check in setup_instance_ group so we load the InstanceGroup.hosts from the correct cell(s) based on where the member instances are:
https:/ /github. com/openstack/ nova/blob/ c7e9e667426a6d8 8d396a59cb40d30 763a3265f9/ nova/scheduler/ utils.py# L989
I still think it likely means, however, that this code is redundant:
https:/ /github. com/openstack/ nova/blob/ c7e9e667426a6d8 8d396a59cb40d30 763a3265f9/ nova/scheduler/ utils.py# L944-L950
I'm not sure in what case user_group_hosts would be different from group_hosts.