[VOL-1667] Fix instance Id and other minor fixes
This commit fixes the following:
1) Remove the instance ID as an input parameter and let the code
sets it to hostname
2) Removes logs settings in the rw_core that were overwriting the
input parameter setting
3) Removes unnecessary device loading at creation time (applies to
the core in a core-pair that is only monitoring the transaction).
The device ID is not know by that Core at that time.
4) Some minor cleanups
Change-Id: If781103bfb449dcae5421284456c4b0fe67704fd
diff --git a/rw_core/core/device_ownership.go b/rw_core/core/device_ownership.go
index 49d860a..6efbdb8 100644
--- a/rw_core/core/device_ownership.go
+++ b/rw_core/core/device_ownership.go
@@ -47,10 +47,10 @@
deviceMgr *DeviceManager
logicalDeviceMgr *LogicalDeviceManager
deviceMap map[string]*ownership
- deviceMapLock *sync.RWMutex
+ deviceMapLock sync.RWMutex
deviceToKeyMap map[string]string
- deviceToKeyMapLock *sync.RWMutex
- ownershipLock *sync.RWMutex
+ deviceToKeyMapLock sync.RWMutex
+ ownershipLock sync.RWMutex
}
func NewDeviceOwnership(id string, kvClient kvstore.Client, deviceMgr *DeviceManager, logicalDeviceMgr *LogicalDeviceManager, ownershipPrefix string, reservationTimeout int64) *DeviceOwnership {
@@ -63,10 +63,10 @@
deviceOwnership.ownershipPrefix = ownershipPrefix
deviceOwnership.reservationTimeout = reservationTimeout
deviceOwnership.deviceMap = make(map[string]*ownership)
- deviceOwnership.deviceMapLock = &sync.RWMutex{}
+ deviceOwnership.deviceMapLock = sync.RWMutex{}
deviceOwnership.deviceToKeyMap = make(map[string]string)
- deviceOwnership.deviceToKeyMapLock = &sync.RWMutex{}
- deviceOwnership.ownershipLock = &sync.RWMutex{}
+ deviceOwnership.deviceToKeyMapLock = sync.RWMutex{}
+ deviceOwnership.ownershipLock = sync.RWMutex{}
return &deviceOwnership
}