メインコンテンツへスキップ

Openstack:CapacityWeigher は Cinder スケジューラが選択するストレージプールにどのような影響を与えますか?

Views:
180
Visibility:
Public
Votes:
0
Category:
openstack
Specialty:
virt
Last Updated:

環境

OpenStack

回答

複数のシンプロビジョニングストレージプールが利用可能な場合、Cinder ドライバーはCapacityWeigherを活用して、どのストレージプールにプロビジョニングするかを決定します。 

  • CapacityWeigherの仕組み

CapacityWeigherの仕組みをよりよく理解するには、次の情報が重要です:

  1. Cinder Scheduler Weights の公式ドキュメントによると:

シンプロビジョニングの場合、ホストの仮想空き容量(総容量に最大オーバーサブスクリプション比率を掛け、プロビジョニングされた容量を差し引いて計算)に基づいてホストを評価します。

使用される計算式は次のとおりです: total_capacity_gb x max_over_subscription_ratio - provisioned_capacity_gb

  1. プロビジョニングされた容量は次のように定義されます(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

 

max_over_subscription_ratio=auto

Cinder がCapacityWeigherの処理方法を調整できる設定オプションがありますmax_over_subscription_ratio。  例えば、同じtotal_capacity_gbのストレージプールをすべて使用できない場合は、cinder.conf で max_over_subscription_ratio = autoを設定できます。  シンプロビジョニングにおけるオーバーサブスクリプションのドキュメントによると:

auto を使用すると、Cinder は max_over_subscription_ratio をプロビジョニングされた容量と使用済み領域に基づいて自動的に計算します。これにより、プールの使用開始時にはより多くのボリュームを作成できますが、空き領域が 0 または予約済み容量の上限に近づくにつれて、作成が制限されます。

要点 / 結論
  1.  total_capacity_gb はCapacityWeigher計算において重要な要素です
  2. シンプロビジョニングボリュームを使用する場合、free_capacity_gbは評価されません
  3. Cinderバックエンドの各バッキングストレージプールを同様の total_capacity_gb に設定することは、より大きなストレージプールが常にCinderスケジューラによって選択されるわけではないことを保証する重要な要素となる可能性があります。  上記の例が示すように、ほぼいっぱいの100TBのボリュームと別の空の10TBのボリュームを使用する場合、 total_capacity_gbにより、100TBのボリュームは引き続き高く重み付けされます
  4. 各ストレージプールのサイズを同じにできない場合は、 max_over_subscription_ratio = autoの使用を検討してください。これにより、Cinderは max_over_subscription_ratio をプロビジョニングされた容量と使用済み領域に基づいて調整できます。  これによりCapacityWeigher計算が変わり、より小さなストレージプールが優先されるようになります。 
NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.