Skip to content

Commit

Permalink
[Datastorage] Device Not found in Cache Issue
Browse files Browse the repository at this point in the history
Signed-off-by: Nitu Sajjanlal Gupta <nitu.gupta@samsung.com>
  • Loading branch information
nitu-s-gupta committed Oct 13, 2021
1 parent fb76bf6 commit 998a86e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 5 additions & 5 deletions configs/datastorage/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
LogLevel = 'DEBUG'

[Service]
Host = 'localhost'
Host = '172.17.0.1'
Port = 49986
ConnectRetries = 20
Labels = []
Expand All @@ -12,7 +12,7 @@ EnableAsyncReadings = true
AsyncBufferSize = 16

[Registry]
Host = 'localhost'
Host = '172.17.0.1'
Port = 8500
Type = "consul"
CheckInterval = "10s"
Expand All @@ -22,19 +22,19 @@ FailWaitTime = 10
[Clients]
[Clients.Data]
Protocol = "http"
Host = "localhost"
Host = '172.17.0.1'
Port = 48080
Timeout = 5000

[Clients.Metadata]
Protocol = "http"
Host = "localhost"
Host = '172.17.0.1'
Port = 48081
Timeout = 5000

[Clients.Logging]
Protocol = "http"
Host = "localhost"
Host = '172.17.0.1'
Port = 48061

[Device]
Expand Down
11 changes: 9 additions & 2 deletions internal/controller/storagemgr/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/edgexfoundry/device-sdk-go"
"github.com/edgexfoundry/device-sdk-go/pkg/startup"
"github.com/lf-edge/edge-home-orchestration-go/internal/common/logmgr"
networkhelper "github.com/lf-edge/edge-home-orchestration-go/internal/common/networkhelper"
"github.com/lf-edge/edge-home-orchestration-go/internal/controller/storagemgr/config"
"github.com/lf-edge/edge-home-orchestration-go/internal/controller/storagemgr/storagedriver"
"github.com/lf-edge/edge-home-orchestration-go/internal/restinterface/resthelper"
Expand Down Expand Up @@ -57,6 +58,7 @@ type StorageImpl struct {

var (
deviceName string
ipv4 string
storageIns *StorageImpl
helper resthelper.RestHelper
log = logmgr.GetInstance()
Expand Down Expand Up @@ -100,8 +102,13 @@ func checkMetadataStatus() bool {

// StartStorage starts a server in terms of DataStorage
func (s *StorageImpl) StartStorage(host string) (err error) {
//Getting the Edge-Orchestration IP
ipv4, err = networkhelper.GetInstance().GetOutboundIP()
if err != nil {
return errors.New("could not initiate storageManager,err=" + err.Error())
}
if checkServiceInEnv() {
if err = s.BuildConfiguration("127.0.0.1"); err != nil {
if err = s.BuildConfiguration(ipv4); err != nil {
return
}
} else if len(host) > 0 {
Expand Down Expand Up @@ -139,7 +146,7 @@ func checkServiceInEnv() bool {

func saveToml(host string) (err error) {
config.SetWritable("DEBUG")
config.SetService("", 49986, nil)
config.SetService(ipv4, 49986, nil)
config.SetRegistry(host, 8500)
config.SetDevice(true, "", "", 128, 256, "", "", "./res")
config.SetDeviceList(deviceName, deviceName, "RESTful Device", []string{"rest", "json"})
Expand Down

0 comments on commit 998a86e

Please sign in to comment.