initial rewrite

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2019-04-18 23:13:04 +03:00
commit 24f641df0d
37 changed files with 4349 additions and 0 deletions

BIN
crushmap/testdata/map.bin vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

416
crushmap/testdata/map.json vendored Normal file
View File

@@ -0,0 +1,416 @@
{
"devices": [
{
"id": 0,
"name": "osd.0"
},
{
"id": 1,
"name": "osd.1"
},
{
"id": 2,
"name": "osd.2"
},
{
"id": 3,
"name": "osd.3"
},
{
"id": 4,
"name": "osd.4"
},
{
"id": 5,
"name": "osd.5"
}
],
"types": [
{
"type_id": 0,
"name": "osd"
},
{
"type_id": 1,
"name": "host"
},
{
"type_id": 2,
"name": "chassis"
},
{
"type_id": 3,
"name": "rack"
},
{
"type_id": 4,
"name": "row"
},
{
"type_id": 5,
"name": "pdu"
},
{
"type_id": 6,
"name": "pod"
},
{
"type_id": 7,
"name": "room"
},
{
"type_id": 8,
"name": "datacenter"
},
{
"type_id": 9,
"name": "region"
},
{
"type_id": 10,
"name": "root"
},
{
"type_id": 11,
"name": "disktype"
}
],
"buckets": [
{
"id": -1,
"name": "default",
"type_id": 10,
"type_name": "root",
"weight": 109509,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": -2,
"weight": 36503,
"pos": 0
},
{
"id": -3,
"weight": 36503,
"pos": 1
},
{
"id": -4,
"weight": 36503,
"pos": 2
}
]
},
{
"id": -2,
"name": "rmosd1",
"type_id": 1,
"type_name": "host",
"weight": 36569,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": -5,
"weight": 32768,
"pos": 0
},
{
"id": -6,
"weight": 3801,
"pos": 1
}
]
},
{
"id": -3,
"name": "rmosd2",
"type_id": 1,
"type_name": "host",
"weight": 36569,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": -7,
"weight": 32768,
"pos": 0
},
{
"id": -8,
"weight": 3801,
"pos": 1
}
]
},
{
"id": -4,
"name": "rmosd3",
"type_id": 1,
"type_name": "host",
"weight": 36569,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": -9,
"weight": 32768,
"pos": 0
},
{
"id": -10,
"weight": 3801,
"pos": 1
}
]
},
{
"id": -5,
"name": "rmosd1_ssd",
"type_id": 11,
"type_name": "disktype",
"weight": 3801,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": 3,
"weight": 3801,
"pos": 0
}
]
},
{
"id": -6,
"name": "rmosd1_spinning",
"type_id": 11,
"type_name": "disktype",
"weight": 32768,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": 0,
"weight": 32768,
"pos": 0
}
]
},
{
"id": -7,
"name": "rmosd2_ssd",
"type_id": 11,
"type_name": "disktype",
"weight": 3801,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": 4,
"weight": 3801,
"pos": 0
}
]
},
{
"id": -8,
"name": "rmosd2_spinning",
"type_id": 11,
"type_name": "disktype",
"weight": 32768,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": 1,
"weight": 32768,
"pos": 0
}
]
},
{
"id": -9,
"name": "rmosd3_ssd",
"type_id": 11,
"type_name": "disktype",
"weight": 3801,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": 5,
"weight": 3801,
"pos": 0
}
]
},
{
"id": -10,
"name": "rmosd3_spinning",
"type_id": 11,
"type_name": "disktype",
"weight": 32768,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": 2,
"weight": 32768,
"pos": 0
}
]
},
{
"id": -11,
"name": "spinning",
"type_id": 10,
"type_name": "root",
"weight": 98304,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": -6,
"weight": 32768,
"pos": 0
},
{
"id": -8,
"weight": 32768,
"pos": 1
},
{
"id": -10,
"weight": 32768,
"pos": 2
}
]
},
{
"id": -12,
"name": "ssd",
"type_id": 10,
"type_name": "root",
"weight": 11403,
"alg": "straw",
"hash": "rjenkins1",
"items": [
{
"id": -5,
"weight": 3801,
"pos": 0
},
{
"id": -7,
"weight": 3801,
"pos": 1
},
{
"id": -9,
"weight": 3801,
"pos": 2
}
]
}
],
"rules": [
{
"rule_id": 0,
"rule_name": "replicated_ruleset",
"ruleset": 0,
"type": 1,
"min_size": 1,
"max_size": 10,
"steps": [
{
"op": "take",
"item": -11,
"item_name": "spinning"
},
{
"op": "chooseleaf_firstn",
"num": 0,
"type": "disktype"
},
{
"op": "emit"
}
]
},
{
"rule_id": 1,
"rule_name": "spinning",
"ruleset": 1,
"type": 3,
"min_size": 3,
"max_size": 20,
"steps": [
{
"op": "set_chooseleaf_tries",
"num": 5
},
{
"op": "take",
"item": -11,
"item_name": "spinning"
},
{
"op": "chooseleaf_indep",
"num": 0,
"type": "osd"
},
{
"op": "emit"
}
]
},
{
"rule_id": 2,
"rule_name": "ssd",
"ruleset": 2,
"type": 1,
"min_size": 1,
"max_size": 10,
"steps": [
{
"op": "take",
"item": -12,
"item_name": "ssd"
},
{
"op": "chooseleaf_firstn",
"num": 0,
"type": "disktype"
},
{
"op": "emit"
}
]
}
],
"tunables": {
"choose_local_tries": 0,
"choose_local_fallback_tries": 0,
"choose_total_tries": 50,
"chooseleaf_descend_once": 1,
"chooseleaf_vary_r": 1,
"chooseleaf_stable": 0,
"straw_calc_version": 1,
"allowed_bucket_algs": 22,
"profile": "firefly",
"optimal_tunables": 0,
"legacy_tunables": 0,
"minimum_required_version": "firefly",
"require_feature_tunables": 1,
"require_feature_tunables2": 1,
"has_v2_rules": 1,
"require_feature_tunables3": 1,
"has_v3_rules": 0,
"has_v4_buckets": 0,
"require_feature_tunables5": 0,
"has_v5_rules": 0
},
"choose_args": {}
}

151
crushmap/testdata/map.txt vendored Normal file
View File

@@ -0,0 +1,151 @@
# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1
tunable chooseleaf_vary_r 1
tunable straw_calc_version 1
# devices
device 0 osd.0
device 1 osd.1
device 2 osd.2
device 3 osd.3
device 4 osd.4
device 5 osd.5
# types
type 0 osd
type 1 host
type 2 chassis
type 3 rack
type 4 row
type 5 pdu
type 6 pod
type 7 room
type 8 datacenter
type 9 region
type 10 root
type 11 disktype
# buckets
disktype rmosd1_ssd {
id -5 # do not change unnecessarily
# weight 0.058
alg straw
hash 0 # rjenkins1
item osd.3 weight 0.058
}
disktype rmosd1_spinning {
id -6 # do not change unnecessarily
# weight 0.500
alg straw
hash 0 # rjenkins1
item osd.0 weight 0.500
}
host rmosd1 {
id -2 # do not change unnecessarily
# weight 0.557
alg straw
hash 0 # rjenkins1
item rmosd1_ssd weight 0.500
item rmosd1_spinning weight 0.058
}
disktype rmosd2_ssd {
id -7 # do not change unnecessarily
# weight 0.058
alg straw
hash 0 # rjenkins1
item osd.4 weight 0.058
}
disktype rmosd2_spinning {
id -8 # do not change unnecessarily
# weight 0.500
alg straw
hash 0 # rjenkins1
item osd.1 weight 0.500
}
host rmosd2 {
id -3 # do not change unnecessarily
# weight 0.557
alg straw
hash 0 # rjenkins1
item rmosd2_ssd weight 0.500
item rmosd2_spinning weight 0.058
}
disktype rmosd3_ssd {
id -9 # do not change unnecessarily
# weight 0.058
alg straw
hash 0 # rjenkins1
item osd.5 weight 0.058
}
disktype rmosd3_spinning {
id -10 # do not change unnecessarily
# weight 0.500
alg straw
hash 0 # rjenkins1
item osd.2 weight 0.500
}
host rmosd3 {
id -4 # do not change unnecessarily
# weight 0.557
alg straw
hash 0 # rjenkins1
item rmosd3_ssd weight 0.500
item rmosd3_spinning weight 0.058
}
root default {
id -1 # do not change unnecessarily
# weight 1.672
alg straw
hash 0 # rjenkins1
item rmosd1 weight 0.557
item rmosd2 weight 0.557
item rmosd3 weight 0.557
}
root spinning {
id -11 # do not change unnecessarily
# weight 1.500
alg straw
hash 0 # rjenkins1
item rmosd1_spinning weight 0.500
item rmosd2_spinning weight 0.500
item rmosd3_spinning weight 0.500
}
root ssd {
id -12 # do not change unnecessarily
# weight 0.174
alg straw
hash 0 # rjenkins1
item rmosd1_ssd weight 0.058
item rmosd2_ssd weight 0.058
item rmosd3_ssd weight 0.058
}
# rules
rule replicated_ruleset {
ruleset 0
type replicated
min_size 1
max_size 10
step take spinning
step chooseleaf firstn 0 type disktype
step emit
}
rule spinning {
ruleset 1
type erasure
min_size 3
max_size 20
step set_chooseleaf_tries 5
step take spinning
step chooseleaf indep 0 type osd
step emit
}
rule ssd {
ruleset 2
type replicated
min_size 1
max_size 10
step take ssd
step chooseleaf firstn 0 type disktype
step emit
}
# end crush map

151
crushmap/testdata/map.txt2 vendored Normal file
View File

@@ -0,0 +1,151 @@
# begin crush map
tunable choose_local_tries 0
tunable choose_local_fallback_tries 0
tunable choose_total_tries 50
tunable chooseleaf_descend_once 1
tunable chooseleaf_vary_r 1
tunable straw_calc_version 1
# devices
device 0 osd.0
device 1 osd.1
device 2 osd.2
device 3 osd.3
device 4 osd.4
device 5 osd.5
# types
type 0 osd
type 1 host
type 2 chassis
type 3 rack
type 4 row
type 5 pdu
type 6 pod
type 7 room
type 8 datacenter
type 9 region
type 10 root
type 11 disktype
# buckets
disktype rmosd1_ssd {
id -5 # do not change unnecessarily
# weight 0.058
alg straw2
hash 0 # rjenkins1
item osd.3 weight 0.058
}
disktype rmosd1_spinning {
id -6 # do not change unnecessarily
# weight 0.500
alg straw2
hash 0 # rjenkins1
item osd.0 weight 0.500
}
host rmosd1 {
id -2 # do not change unnecessarily
# weight 0.557
alg straw2
hash 0 # rjenkins1
item rmosd1_ssd weight 0.500
item rmosd1_spinning weight 0.058
}
disktype rmosd2_ssd {
id -7 # do not change unnecessarily
# weight 0.058
alg straw2
hash 0 # rjenkins1
item osd.4 weight 0.058
}
disktype rmosd2_spinning {
id -8 # do not change unnecessarily
# weight 0.500
alg straw2
hash 0 # rjenkins1
item osd.1 weight 0.500
}
host rmosd2 {
id -3 # do not change unnecessarily
# weight 0.557
alg straw2
hash 0 # rjenkins1
item rmosd2_ssd weight 0.500
item rmosd2_spinning weight 0.058
}
disktype rmosd3_ssd {
id -9 # do not change unnecessarily
# weight 0.058
alg straw2
hash 0 # rjenkins1
item osd.5 weight 0.058
}
disktype rmosd3_spinning {
id -10 # do not change unnecessarily
# weight 0.500
alg straw2
hash 0 # rjenkins1
item osd.2 weight 0.500
}
host rmosd3 {
id -4 # do not change unnecessarily
# weight 0.557
alg straw2
hash 0 # rjenkins1
item rmosd3_ssd weight 0.500
item rmosd3_spinning weight 0.058
}
root default {
id -1 # do not change unnecessarily
# weight 1.672
alg straw2
hash 0 # rjenkins1
item rmosd1 weight 0.557
item rmosd2 weight 0.557
item rmosd3 weight 0.557
}
root spinning {
id -11 # do not change unnecessarily
# weight 1.500
alg straw2
hash 0 # rjenkins1
item rmosd1_spinning weight 0.500
item rmosd2_spinning weight 0.500
item rmosd3_spinning weight 0.500
}
root ssd {
id -12 # do not change unnecessarily
# weight 0.174
alg straw2
hash 0 # rjenkins1
item rmosd1_ssd weight 0.058
item rmosd2_ssd weight 0.058
item rmosd3_ssd weight 0.058
}
# rules
rule replicated_ruleset {
ruleset 0
type replicated
min_size 1
max_size 10
step take spinning
step chooseleaf firstn 0 type disktype
step emit
}
rule spinning {
ruleset 1
type erasure
min_size 3
max_size 20
step set_chooseleaf_tries 5
step take spinning
step chooseleaf indep 0 type osd
step emit
}
rule ssd {
ruleset 2
type replicated
min_size 1
max_size 10
step take ssd
step chooseleaf firstn 0 type disktype
step emit
}
# end crush map