Revision 1325da74 doc/examples/dumb-allocator
b/doc/examples/dumb-allocator | ||
---|---|---|
74 | 74 |
nodes = data["nodes"] |
75 | 75 |
request = data["request"] |
76 | 76 |
req_type = request["type"] |
77 |
offline_nodes = [name for name in nodes if nodes[name]["offline"]] |
|
77 | 78 |
if req_type == "allocate": |
78 |
forbidden_nodes = []
|
|
79 |
forbidden_nodes = offline_nodes
|
|
79 | 80 |
inst_data = request |
80 | 81 |
elif req_type == "relocate": |
81 | 82 |
idict = data["instances"][request["name"]] |
82 |
forbidden_nodes = idict["nodes"] |
|
83 |
forbidden_nodes = idict["nodes"] + offline_nodes
|
|
83 | 84 |
inst_data = idict |
84 | 85 |
inst_data["disk_space_total"] = request["disk_space_total"] |
85 | 86 |
else: |
Also available in: Unified diff