Openstack: CapacityWeigher は、Cinder スケジューラが選択するストレージ プールにどのような影響を与えますか?
環境
OpenStack
回答
複数のシンプロビジョニングされたストレージプールが利用可能な場合、Cinder ドライバーは CapacityWeigher を活用して、どのストレージプールにプロビジョニングするかを決定します。
CapacityWeigherの仕組み
CapacityWeigher の仕組みをよりよく理解するには、次の情報が重要です。
- Cinder Scheduler Weights の公式ドキュメントによると:
シンプロビジョニングの場合、ホストの仮想空き容量を、総容量に最大オーバーサブスクリプション比率を掛けて算出し、プロビジョニングされた容量を差し引いて計算します。
使用される計算式は次のとおりです: total_capacity_gb x max_over_subscription_ratio - provisioned_capacity_gb
- プロビジョニングされた容量は次のように定義されます ( Queen で導入されたプロビジョニングの改善より抜粋)。
Cinder が使用しているストレージアレイのプール内の全ボリュームが完全に満杯になった場合に、そのプールで使用される容量の量
CapacityWeigher の動作例
上記の式と情報を使用することで、Cinder スケジューラ ログから次のイベントを取得し、そこに含まれる値を使用して、各ストレージ プールの重みがどのように決定されるかをよりよく理解できます。
Jul 26 21:10:40 xxx-cinder-api-container-3af405ad cinder-scheduler[34121]: 2022-07-26 21:10:40.353 34121 DEBUG cinder.scheduler.filter_scheduler [req-xxxx] Filtered [host 'xxx@xxx#vol01':free_capacity_gb: 10239.99, total_capacity_gb: 10240.0,allocated_capacity_gb: 0, max_over_subscription_ratio: 3.0,reserved_percentage: 0, provisioned_capacity_gb: 0,thin_provisioning_support: True, thick_provisioning_support: False,pools: None,updated at: 2022-07-26 21:10:30.459300, host 'xxx@xxx#vol02':free_capacity_gb: 10239.99, total_capacity_gb: 10240.0,allocated_capacity_gb: 0, max_over_subscription_ratio: 3.0,reserved_percentage: 0, provisioned_capacity_gb: 0,thin_provisioning_support: True, thick_provisioning_support: False,pools: None,updated at: 2022-07-26 21:10:30.459300, host 'xxx@xxx#vol03':free_capacity_gb: 26258.57, total_capacity_gb: 92160.0,allocated_capacity_gb: 90463, max_over_subscription_ratio: 3.0,reserved_percentage: 0, provisioned_capacity_gb: 90463,thin_provisioning_support: True, thick_provisioning_support: False,pools: None,updated at: 2022-07-26 21:10:30.459300, host 'xxx@xxx#vol04':free_capacity_gb: 2948.08, total_capacity_gb: 99804.03,allocated_capacity_gb: 99118, max_over_subscription_ratio: 3.0,reserved_percentage: 0, provisioned_capacity_gb: 99118,thin_provisioning_support: True, thick_provisioning_support: False,pools: None,updated at: 2022-07-26 21:10:30.459300] _get_weighted_candidates
上記のイベントでは、Cinder スケジューラで使用できるボリュームは次の 4 つになります。
vol01:
free_capacity_gb: 10239.99
total_capacity_gb: 10240.0
allocated_capacity_gb: 0
max_over_subscription_ratio: 3.0
provisioned_capacity_gb: 0
vol02:
free_capacity_gb: 10239.99
total_capacity_gb: 10240.0
allocated_capacity_gb: 0
max_over_subscription_ratio: 3.0
provisioned_capacity_gb: 0
vol03:
free_capacity_gb: 26258.57
total_capacity_gb: 92160.0
allocated_capacity_gb: 90463
max_over_subscription_ratio: 3.0
provisioned_capacity_gb: 90463
vol04:
free_capacity_gb: 2948.08
total_capacity_gb: 99804.03
allocated_capacity_gb: 99118
max_over_subscription_ratio: 3.0
reserved_percentage: 0
provisioned_capacity_gb: 99118
上記のボリュームから次のことがわかります。
- vol01とvol02は空です。 使用可能な容量は10TBです
- 。vol03はかなり大きく、 空き容量は26TBあります。 合計容量は92TBです
- 。vol04はほぼ空き容量がありません。3TB の空き容量があります。 合計容量は100TBです。
vol04 の容量がほとんどなくなっているにもかかわらず、Cinder スケジューラは Cinder ボリュームのプロビジョニング中にそれを選択します。
Jul 26 21:10:40 xxx-cinder-api-container-3af405ad cinder-scheduler[34121]: 2022-07-26 21:10:40.355 34121 DEBUG cinder.scheduler.host_manager [req-xxx] Weighed [WeighedHost [host: xxx@xxx#vol04, weight: 1.0], WeighedHost [host: xxx@xxx#vol03, weight: 0.9158061824185525], WeighedHost [host: xxx@xxx#vol01, weight: 0.0], WeighedHost [host: xxx@xxx#vol02, weight: 0.0]] get_weighed_backends
これを理解するために、CapacityWeigher 計算 ( total_capacity_gb x max_over_subscription_ratio - provisioned_capacity_gb) を実行できます。
vol01:
10240 x 3 - 0 = 30720
vol02:
10240 x 3 - 0 = 30720
vol03:
92160 x 3 - 90463 = 186017
vol04:
99804 x 3 - 99118 = 200294
上記の計算から、total_capacity_gb
重み付けが高くなっています。 他のボリュームの空き容量がかなり大きいにもかかわらず、vol04の重み付けは依然として最も高くなっています。
vol03のサイズを大きくしたらどうなるでしょうか?
vol03':free_capacity_gb: 36605.8, total_capacity_gb: 102400.0,allocated_capacity_gb: 90563, max_over_subscription_ratio: 3.0,reserved_percentage: 0, provisioned_capacity_gb: 90563
新しい大きなvol03で重みを再計算します。
vol03:
102400 x 3 - 90563 = 216637
vol04:
99804 x 3 - 99113 = 200299
vol03の重みが上がっていることがわかります。 その結果、選択されたストレージプールは次のようになります。
Jul 26 21:58:46 usw1infr001-cinder-api-container-3af405ad cinder-scheduler[34121]: 2022-07-26 21:58:46.259 34121 DEBUG cinder.scheduler.host_manager [req-xxx] Weighed [WeighedHost [host: xxx@xxx#vol03, weight: 1.0], WeighedHost [host: xxx@xxx#vol04, weight: 0.9121225600671266], WeighedHost [host: xxx@xxx#vol01, weight: 0.0], WeighedHost [host: xxx@xxx#vol02, weight: 0.0]] get_weighed_backends
最大オーバーサブスクリプション比率=自動
CapacityWeigher が max_over_subscription_ratio
をどのように扱うかを Cinder が調整できるようにする、設定可能なオプションがあります。 total_capacity_gb
、設定できるものよりもmax_over_subscription_ratio = auto
cinder.conf で。 シンプロビジョニングのオーバーサブスクリプションに関するドキュメントによると、
自動設定の場合、Cinderは自動的に計算します。
max_over_subscription_ratio
プロビジョニングされた容量と使用済み領域に基づいてボリューム数を決定します。これにより、プールの使用開始時にはより多くのボリュームを作成できますが、空き容量が0または予約済み容量の上限に近づくにつれて、作成が制限されます。
まとめ / 結論
-
total_capacity_gb
はCapacityWeigherの計算において重要な要素です - 。シンプロビジョニングボリュームを扱う場合、
free_capacity_gb
評価されない - Cinderバックエンドの各バッキングストレージプールを同様の
total_capacity_gb
これは、より大きなストレージプールがCinderスケジューラによって常に選択されないようにするための重要な要素です。 上記の例が示すように、ほぼ満杯の100TBボリュームと空の10TBボリュームを扱う場合、100TBボリュームは、以下の理由により、より高い重み付けが継続されます。total_capacity_gb
- 各ストレージ・プールのサイズを同じにできない場合は、
max_over_subscription_ratio = auto
の使用を検討してください。Cinderはmax_over_subscription_ratio
プロビジョニングされた容量と使用済み領域に基づいて計算されます。 これにより、CapacityWeigherの計算が変更され、より小さなストレージプールが優先されるようになります。
追加情報
AdditionalInformation_text