Committed by
Gerrit Code Review
Clean up references to the deprecated p0 storage partition
Change-Id: Ifdab952d2bef30104f57aff3cab342df99a20571
Showing
4 changed files
with
6 additions
and
19 deletions
... | @@ -71,14 +71,12 @@ public class DefaultClusterMetadataProvider implements ClusterMetadataProvider { | ... | @@ -71,14 +71,12 @@ public class DefaultClusterMetadataProvider implements ClusterMetadataProvider { |
71 | String localIp = getSiteLocalAddress(); | 71 | String localIp = getSiteLocalAddress(); |
72 | ControllerNode localNode = | 72 | ControllerNode localNode = |
73 | new DefaultControllerNode(new NodeId(localIp), IpAddress.valueOf(localIp), DEFAULT_ONOS_PORT); | 73 | new DefaultControllerNode(new NodeId(localIp), IpAddress.valueOf(localIp), DEFAULT_ONOS_PORT); |
74 | - // p0 partition | 74 | + // partition 1 |
75 | - Partition basePartition = new DefaultPartition(PartitionId.from(0), ImmutableSet.of(localNode.id())); | 75 | + Partition partition = new DefaultPartition(PartitionId.from(1), ImmutableSet.of(localNode.id())); |
76 | - // p1 partition | ||
77 | - Partition extendedPartition = new DefaultPartition(PartitionId.from(1), ImmutableSet.of(localNode.id())); | ||
78 | ClusterMetadata metadata = new ClusterMetadata(PROVIDER_ID, | 76 | ClusterMetadata metadata = new ClusterMetadata(PROVIDER_ID, |
79 | "default", | 77 | "default", |
80 | ImmutableSet.of(localNode), | 78 | ImmutableSet.of(localNode), |
81 | - ImmutableSet.of(basePartition, extendedPartition)); | 79 | + ImmutableSet.of(partition)); |
82 | long version = System.currentTimeMillis(); | 80 | long version = System.currentTimeMillis(); |
83 | cachedMetadata.set(new Versioned<>(metadata, version)); | 81 | cachedMetadata.set(new Versioned<>(metadata, version)); |
84 | providerRegistry.register(this); | 82 | providerRegistry.register(this); | ... | ... |
... | @@ -90,7 +90,6 @@ public class PartitionManager extends AbstractListenerManager<PartitionEvent, Pa | ... | @@ -90,7 +90,6 @@ public class PartitionManager extends AbstractListenerManager<PartitionEvent, Pa |
90 | currentClusterMetadata.get() | 90 | currentClusterMetadata.get() |
91 | .getPartitions() | 91 | .getPartitions() |
92 | .stream() | 92 | .stream() |
93 | - .filter(partition -> !partition.getId().equals(PartitionId.from(0))) // exclude p0 | ||
94 | .forEach(partition -> partitions.put(partition.getId(), new StoragePartition(partition, | 93 | .forEach(partition -> partitions.put(partition.getId(), new StoragePartition(partition, |
95 | messagingService, | 94 | messagingService, |
96 | clusterService, | 95 | clusterService, | ... | ... |
... | @@ -151,7 +151,7 @@ cat > $STAGE/config/cluster.json <<EOF | ... | @@ -151,7 +151,7 @@ cat > $STAGE/config/cluster.json <<EOF |
151 | { | 151 | { |
152 | "name": "default", | 152 | "name": "default", |
153 | "nodes": [ {"id": "$IP", "ip": "$IP", "port": 9876 } ], | 153 | "nodes": [ {"id": "$IP", "ip": "$IP", "port": 9876 } ], |
154 | - "partitions": [ { "id": 0, "members": [ "$IP" ] }, { "id": 1, "members": [ "$IP" ] } ] | 154 | + "partitions": [ { "id": 1, "members": [ "$IP" ] } ] |
155 | } | 155 | } |
156 | EOF | 156 | EOF |
157 | 157 | ... | ... |
... | @@ -29,13 +29,7 @@ def get_nodes(ips=None, port=9876): | ... | @@ -29,13 +29,7 @@ def get_nodes(ips=None, port=9876): |
29 | ips = [ environ[v] for v in get_OC_vars() ] | 29 | ips = [ environ[v] for v in get_OC_vars() ] |
30 | return [ node(v) for v in ips ] | 30 | return [ node(v) for v in ips ] |
31 | 31 | ||
32 | -def generate_base_partition(nodes): | 32 | +def generate_partitions(nodes, k): |
33 | - return { | ||
34 | - 'id': 0, | ||
35 | - 'members': nodes | ||
36 | - } | ||
37 | - | ||
38 | -def generate_extended_partitions(nodes, k): | ||
39 | l = deque(nodes) | 33 | l = deque(nodes) |
40 | perms = [] | 34 | perms = [] |
41 | for i in range(1, len(nodes)+1): | 35 | for i in range(1, len(nodes)+1): |
... | @@ -49,11 +43,7 @@ def generate_extended_partitions(nodes, k): | ... | @@ -49,11 +43,7 @@ def generate_extended_partitions(nodes, k): |
49 | 43 | ||
50 | if __name__ == '__main__': | 44 | if __name__ == '__main__': |
51 | nodes = get_nodes(sys.argv[2:]) | 45 | nodes = get_nodes(sys.argv[2:]) |
52 | - base_partition = generate_base_partition([v.get('id') for v in nodes]) | 46 | + partitions = generate_partitions([v.get('id') for v in nodes], 3) |
53 | - extended_partitions = generate_extended_partitions([v.get('id') for v in nodes], 3) | ||
54 | - partitions = [] | ||
55 | - partitions.append(base_partition) | ||
56 | - partitions.extend(extended_partitions) | ||
57 | m = hashlib.sha256() | 47 | m = hashlib.sha256() |
58 | for node in nodes: | 48 | for node in nodes: |
59 | m.update(node['ip']) | 49 | m.update(node['ip']) | ... | ... |
-
Please register or login to post a comment