Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PreferSameShardOnResizeWeigher. #316

Merged
merged 1 commit into from
Apr 6, 2022

Conversation

kpawar-sap
Copy link

This filter enable to select same host-aggregate/shard/VC for instance
resize because it could take more time to migrate the volumes over other
shards.

Copy link

@joker-at-work joker-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename to shard, as it doesn't allow to configure the aggregate and thus the more generic "PreferSameAggregate" is not telling the story correctly.

@kpawar-sap kpawar-sap force-pushed the resize_prefer_local_vc branch 2 times, most recently from e0d116c to 89d5b25 Compare March 11, 2022 14:06
@kpawar-sap kpawar-sap changed the title Add PreferSameAggregateOnResizeWeigher. Add PreferSameShardOnResizeWeigher. Mar 11, 2022
@kpawar-sap
Copy link
Author

Please rename to shard, as it doesn't allow to configure the aggregate and thus the more generic "PreferSameAggregate" is not telling the story correctly.

Done. Tested on qa-de-1.

@kpawar-sap kpawar-sap closed this Mar 14, 2022
@kpawar-sap kpawar-sap reopened this Mar 14, 2022
nova/conf/scheduler.py Outdated Show resolved Hide resolved
Copy link
Member

@fwiesel fwiesel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise, it looks good to me

Copy link

@joker-at-work joker-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a test missing that actually tests the same shard part of the weigher. Please add an additional host to your tests that's in the same shard as one of the existing hosts. This host should have the same weight given by the weigher as the other host in that shard in every test.

I assume this test with then show a bug in your weigher, as the weigher returns 0.0 if the instance is not on the currently-checked host through the first if.

nova/conf/scheduler.py Outdated Show resolved Hide resolved
nova/scheduler/weights/resize_same_shard.py Outdated Show resolved Hide resolved
nova/scheduler/weights/resize_same_shard.py Outdated Show resolved Hide resolved
nova/scheduler/weights/resize_same_shard.py Outdated Show resolved Hide resolved
group='filter_scheduler')
request_spec = objects.RequestSpec(
instance_uuid=uuids.fake_new_instance,
scheduler_hints={'_nova_check_type': ['resize']})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does a new instance have _nova_check_type: ['resize'] set?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to tell that even if resize is triggered with new instance it wont work since instance is new and "source_host" is missing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not clear from the code, as a new instance normally wouldn't have resize set. Please add a comment that explains why, so anybody reading the code later on can understand it.

Comment on lines 66 to 67
host_shard_hosts = set(host for host in host_shard_aggr.hosts)
if instance_host in host_shard_hosts:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a set() here?
Why do we need the iterator here instead of directly using host_shard_aggr.host?
Wouldn't if instance_host in host_shard_aggr.hosts: do the same in just one line with the same readability?

group='filter_scheduler')
request_spec = objects.RequestSpec(
instance_uuid=uuids.fake_new_instance,
scheduler_hints={'_nova_check_type': ['resize']})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not clear from the code, as a new instance normally wouldn't have resize set. Please add a comment that explains why, so anybody reading the code later on can understand it.

This filter enable to select same host-aggregate/shard/VC for instance
resize because it could take more time to migrate the volumes over other
shards.
@kpawar-sap kpawar-sap merged commit f648b9b into stable/rocky-m3 Apr 6, 2022
@kpawar-sap kpawar-sap deleted the resize_prefer_local_vc branch April 6, 2022 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants