mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-18 22:14:29 +00:00
issue 8960: implement PodVolume exposer for PVB/PVR
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
@@ -80,8 +80,6 @@ const (
|
||||
// files will be written to
|
||||
defaultCredentialsDirectory = "/tmp/credentials"
|
||||
|
||||
defaultHostPodsPath = "/host_pods"
|
||||
|
||||
defaultResourceTimeout = 10 * time.Minute
|
||||
defaultDataMoverPrepareTimeout = 30 * time.Minute
|
||||
defaultDataPathConcurrentNum = 1
|
||||
@@ -416,10 +414,10 @@ func (s *nodeAgentServer) waitCacheForResume() error {
|
||||
// validatePodVolumesHostPath validates that the pod volumes path contains a
|
||||
// directory for each Pod running on this node
|
||||
func (s *nodeAgentServer) validatePodVolumesHostPath(client kubernetes.Interface) error {
|
||||
files, err := s.fileSystem.ReadDir(defaultHostPodsPath)
|
||||
files, err := s.fileSystem.ReadDir(nodeagent.HostPodVolumeMountPath())
|
||||
if err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
s.logger.Warnf("Pod volumes host path [%s] doesn't exist, fs-backup is disabled", defaultHostPodsPath)
|
||||
s.logger.Warnf("Pod volumes host path [%s] doesn't exist, fs-backup is disabled", nodeagent.HostPodVolumeMountPath())
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "could not read pod volumes host path")
|
||||
@@ -452,7 +450,7 @@ func (s *nodeAgentServer) validatePodVolumesHostPath(client kubernetes.Interface
|
||||
valid = false
|
||||
s.logger.WithFields(logrus.Fields{
|
||||
"pod": fmt.Sprintf("%s/%s", pod.GetNamespace(), pod.GetName()),
|
||||
"path": defaultHostPodsPath + "/" + dirName,
|
||||
"path": nodeagent.HostPodVolumeMountPath() + "/" + dirName,
|
||||
}).Debug("could not find volumes for pod in host path")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ func Test_validatePodVolumesHostPath(t *testing.T) {
|
||||
|
||||
for _, dir := range tt.dirs {
|
||||
if tt.createDir {
|
||||
err := fs.MkdirAll(filepath.Join(defaultHostPodsPath, dir), os.ModePerm)
|
||||
err := fs.MkdirAll(filepath.Join(nodeagent.HostPodVolumeMountPath(), dir), os.ModePerm)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user