Bug 4105: Pass ModuleShardConfiguration with CreateShard 06/26806/1
authorTom Pantelis <tpanteli@brocade.com>
Mon, 17 Aug 2015 00:46:24 +0000 (20:46 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Thu, 10 Sep 2015 19:20:35 +0000 (15:20 -0400)
commit30507b196fa240a4176ba12102ac0469280feff9
tree64feef68f02da1fe08455e613b86add04061d757
parentaeb06173f489c690a9ac5bb64eb74f15faf839e8
Bug 4105: Pass ModuleShardConfiguration with CreateShard

The DistributedEntityOwnershipService first adds the
ModuleShardConfiguration to the Configuration prior to sending the
CreateShard message. However if the ModuleShardConfiguration gets
added before the ShardManager actor is created, the entity-ownership
shard is created via ShardManager.createLocalShards. This results in
the entity-ownership instantiated as Shard instead of
EntityOwnershipShard. I've seen this happen in unit tests - it's not
likely to occur in the production system b/c we wait until the
data store is ready prior to creating the
DistributedEntityOwnershipService. But we should prevent it so I
changed the DistributedEntityOwnershipService to pass the
ModuleShardConfiguration with the CreateShard message. The
ShardManager now adds the ModuleShardConfiguration to the
Configuration.

Change-Id: I9f64a27cdd8c24d31e7eb1389210b57ac7a1f604
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/config/ModuleShardConfiguration.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipService.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/CreateShard.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/config/EmptyModuleShardConfigProvider.java [new file with mode: 0644]
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/entityownership/DistributedEntityOwnershipServiceTest.java