Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataStorage] Device Not found in Cache Issue #396

Merged
merged 1 commit into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add code comments briefing the rationale behind using values 16 , 20 , 10s etc ..for future maintainability

[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