func (s *StorageImpl) StartStorage(host string) (err error) {
	ipv4, err = networkhelper.GetInstance().GetOutboundIP()
	if err != nil {
		return errors.New("could not initiate storageManager,err=" + err.Error())
	}
	if checkServiceInEnv() {
		if err = s.BuildConfiguration(ipv4); err != nil {
			return
		}
	} else if len(host) > 0 {
		if err = s.BuildConfiguration(host); err != nil {
			return
		}
	}
	if _, err := os.Stat(dataStorageConfFolder + "/configuration.toml"); err == nil {
		if s.status < 2 && checkMetadataStatus() {
			go startup.Bootstrap(dataStorageService, device.Version, &storageIns.sd)
			s.status = 2
			return nil
		}
	}
	return errors.New("could not initiate storageManager")
}
StartStorage starts a server in terms of DataStorage
package storagemgr
import (
	"errors"
	"io/ioutil"
	"os"
	"strings"
	"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"
)
const (
	dataStorageService    = "datastorage"
	dataStorageConfFolder = "res"
	deviceIDFilePath      = "/var/edge-orchestration/device/orchestration_deviceID.txt"
	pingAPI               = "/api/v1/ping"
	logPrefix             = "[storagemgr]"
)
type Storage interface {
	GetStatus() int
	StartStorage(host string) error
	BuildConfiguration(host string) error
}
type StorageImpl struct {
	sd     storagedriver.StorageDriver
	status int
}
var (
	deviceName string
	ipv4       string
	storageIns *StorageImpl
	helper     resthelper.RestHelper
	log        = logmgr.GetInstance()
)
func init() {
	deviceID, _ := getDeviceID()
	deviceName = "edge-orchestration-" + deviceID
	storageIns = &StorageImpl{
		sd:     storagedriver.StorageDriver{},
		status: 0,
	}
	helper = resthelper.GetHelper()
}
func GetInstance() Storage {
	return storageIns
}
func (s *StorageImpl) GetStatus() int {
	return s.status
}
func checkMetadataStatus() bool {
	metadataIP, metadataPort, err := config.GetMetadataServerIP(dataStorageConfFolder + "/configuration.toml")
	if err != nil {
		log.Warn("Error", err)
		return false
	}
	targetURL := helper.MakeTargetURL(metadataIP, metadataPort, pingAPI)
	_, statusCode, err := helper.DoGet(targetURL)
	if err == nil && statusCode == 200 {
		return true
	}
	log.Warn("Metadata is not running!!")
	return false
}