summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchengz <cheng.zhang@citrix.com>2016-04-25 07:51:54 +0000
committerchengz <cheng.zhang@citrix.com>2016-04-25 07:51:54 +0000
commite1986cb6bd305641606cb23f02119c4a12e23a45 (patch)
treeb6b45d55470c3a99fb29d76fd920efa37402b73e
parentf60e2a13174ec8705831cdaaf44b1b83efceeb61 (diff)
downloadvyos-xe-guest-utilities-e1986cb6bd305641606cb23f02119c4a12e23a45.tar.gz
vyos-xe-guest-utilities-e1986cb6bd305641606cb23f02119c4a12e23a45.zip
CP-16739: Fix compile error of logger points
Signed-off-by: chengz <cheng.zhang@citrix.com>
-rw-r--r--xenstoreclient/xenstore.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/xenstoreclient/xenstore.go b/xenstoreclient/xenstore.go
index 7b61670..77126f0 100644
--- a/xenstoreclient/xenstore.go
+++ b/xenstoreclient/xenstore.go
@@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"sync"
+ "time"
)
type Permission int
@@ -375,7 +376,7 @@ func (xs *XenStore) UnWatch(path string, token string) (err error) {
func (xs *XenStore) Watch(path string, token string) error {
watcher := func() {
- logger.Printf("Watch: Start")
+ xs.logger.Printf("Watch: Start")
type XSData struct {
*Packet
Error error
@@ -404,13 +405,13 @@ func (xs *XenStore) Watch(path string, token string) error {
for {
select {
case <-xs.watchStopChan:
- logger.Printf("Watch: receive stop signal, quit.\n")
+ xs.logger.Printf("Watch: receive stop signal, quit.\n")
xs.watchStoppedChan <- struct{}{}
xsReadStop <- true
return
case xsdata := <-xsDataChan:
if xsdata.Error != nil {
- logger.Printf("Watch: receive error: %#v", xsdata.Error)
+ xs.logger.Printf("Watch: receive error: %#v", xsdata.Error)
return
}
switch xsdata.Packet.OpCode {
@@ -418,10 +419,10 @@ func (xs *XenStore) Watch(path string, token string) error {
parts := strings.SplitN(string(xsdata.Value), "\x00", 2)
path := parts[0]
token := parts[1]
- logger.Printf("Get XS_WATCH_EVENT key:%s, token:%s\n", path, token)
+ xs.logger.Printf("Get XS_WATCH_EVENT key:%s, token:%s\n", path, token)
xs.watchQueue.SetEventByKey(path, token)
default:
- logger.Printf("Get non watch event %#v\n", xsdata.Packet.OpCode)
+ xs.logger.Printf("Get non watch event %#v\n", xsdata.Packet.OpCode)
var b bytes.Buffer
xsdata.Packet.Write(&b)
xs.nonWatchQueue <- b.Bytes()
@@ -441,7 +442,7 @@ func (xs *XenStore) Watch(path string, token string) error {
}
_, err := xs.DO(req)
if err != nil {
- logger.Errorf("Watch failed with error %#v\n", err)
+ xs.logger.Printf("Watch failed with error %#v\n", err)
return err
}
xs.watchQueue.AddChanByKey(path)
@@ -542,5 +543,5 @@ func getDevPath() (devPath string, err error) {
return devPath, err
}
}
- return "", logger.Errorf("Cannot locate xenbus dev path in %v", devPaths)
+ return "", fmt.Errorf("Cannot locate xenbus dev path in %v", devPaths)
}