From 447f41a40f0c83da1b0add53459cf8adb6cfb39e Mon Sep 17 00:00:00 2001 From: wanyaoqi Date: Thu, 9 Jul 2020 14:51:56 +0800 Subject: [PATCH] fix set storage info bind mount --- pkg/hostman/storageman/storage_base.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/hostman/storageman/storage_base.go b/pkg/hostman/storageman/storage_base.go index 1c3a4295ad..621e62e5d4 100644 --- a/pkg/hostman/storageman/storage_base.go +++ b/pkg/hostman/storageman/storage_base.go @@ -227,6 +227,9 @@ func (s *SBaseStorage) SetStorageInfo(storageId, storageName string, conf jsonut if dconf, ok := conf.(*jsonutils.JSONDict); ok { s.StorageConf = dconf } + if strings.HasPrefix(s.Path, "/opt/cloud") { + return nil + } if !s.isSetStorageInfo && options.HostOptions.EnableRemoteExecutor { err := s.bindMountTo(s.Path) if err == nil { @@ -245,18 +248,18 @@ func (s *SBaseStorage) bindMountTo(sPath string) error { } out, err = procutils.NewCommand("mkdir", "-p", sPath).Output() if err != nil { - errors.Errorf("mkdir mount path %s failed %s", sPath, out) + return errors.Errorf("mkdir mount path %s failed %s", sPath, out) } if procutils.NewCommand("mountpoint", tempPath).Run() != nil { out, err = procutils.NewRemoteCommandAsFarAsPossible("mount", "--bind", sPath, tempPath).Output() if err != nil { - errors.Errorf("bind mount to temp path failed %s", out) + return errors.Errorf("bind mount to temp path failed %s", out) } } if procutils.NewCommand("mountpoint", sPath).Run() != nil { out, err = procutils.NewCommand("mount", "--bind", tempPath, sPath).Output() if err != nil { - errors.Errorf("bind mount temp path to local image path failed %s", out) + return errors.Errorf("bind mount temp path to local image path failed %s", out) } } return nil