From d34ec40378a76b82a9a980d3f1904f8fb82f2e83 Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Wed, 8 May 2019 16:54:08 +0800 Subject: [PATCH] fix get storage by access path --- pkg/compute/models/hosts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index 02d36dc207..337bbdceeb 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -623,7 +623,7 @@ func (self *SHost) GetStorageByFilePath(path string) *SStorage { return nil } for i := 0; i < len(hoststorages); i += 1 { - if strings.HasPrefix(path, hoststorages[i].MountPoint) { + if len(hoststorages[i].MountPoint) > 0 && strings.HasPrefix(path, hoststorages[i].MountPoint) { return hoststorages[i].GetStorage() } }