mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 10:53:34 +00:00
vendor update for CSI 0.3.0
This commit is contained in:
9
vendor/k8s.io/kubernetes/pkg/volume/host_path/host_path.go
generated
vendored
9
vendor/k8s.io/kubernetes/pkg/volume/host_path/host_path.go
generated
vendored
@ -265,7 +265,11 @@ type hostPathProvisioner struct {
|
||||
|
||||
// Create for hostPath simply creates a local /tmp/hostpath_pv/%s directory as a new PersistentVolume.
|
||||
// This Provisioner is meant for development and testing only and WILL NOT WORK in a multi-node cluster.
|
||||
func (r *hostPathProvisioner) Provision() (*v1.PersistentVolume, error) {
|
||||
func (r *hostPathProvisioner) Provision(selectedNode *v1.Node, allowedTopologies []v1.TopologySelectorTerm) (*v1.PersistentVolume, error) {
|
||||
if util.CheckPersistentVolumeClaimModeBlock(r.options.PVC) {
|
||||
return nil, fmt.Errorf("%s does not support block volume provisioning", r.plugin.GetPluginName())
|
||||
}
|
||||
|
||||
fullpath := fmt.Sprintf("/tmp/hostpath_pv/%s", uuid.NewUUID())
|
||||
|
||||
capacity := r.options.PVC.Spec.Resources.Requests[v1.ResourceName(v1.ResourceStorage)]
|
||||
@ -350,7 +354,8 @@ type fileTypeChecker struct {
|
||||
}
|
||||
|
||||
func (ftc *fileTypeChecker) Exists() bool {
|
||||
return ftc.mounter.ExistsPath(ftc.path)
|
||||
exists, err := ftc.mounter.ExistsPath(ftc.path)
|
||||
return exists && err == nil
|
||||
}
|
||||
|
||||
func (ftc *fileTypeChecker) IsFile() bool {
|
||||
|
35
vendor/k8s.io/kubernetes/pkg/volume/host_path/host_path_test.go
generated
vendored
35
vendor/k8s.io/kubernetes/pkg/volume/host_path/host_path_test.go
generated
vendored
@ -17,6 +17,7 @@ limitations under the License.
|
||||
package host_path
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
@ -177,7 +178,7 @@ func TestProvisioner(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Errorf("Failed to make a new Provisioner: %v", err)
|
||||
}
|
||||
pv, err := creater.Provision()
|
||||
pv, err := creater.Provision(nil, nil)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error creating volume: %v", err)
|
||||
}
|
||||
@ -368,14 +369,42 @@ func (fftc *fakeFileTypeChecker) MakeDir(pathname string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) ExistsPath(pathname string) bool {
|
||||
return true
|
||||
func (fftc *fakeFileTypeChecker) ExistsPath(pathname string) (bool, error) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) GetFileType(_ string) (utilmount.FileType, error) {
|
||||
return utilmount.FileType(fftc.desiredType), nil
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) PrepareSafeSubpath(subPath utilmount.Subpath) (newHostPath string, cleanupAction func(), err error) {
|
||||
return "", nil, nil
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) CleanSubPaths(_, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) SafeMakeDir(_, _ string, _ os.FileMode) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) GetMountRefs(pathname string) ([]string, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) GetFSGroup(pathname string) (int64, error) {
|
||||
return -1, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) GetSELinuxSupport(pathname string) (bool, error) {
|
||||
return false, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (fftc *fakeFileTypeChecker) GetMode(pathname string) (os.FileMode, error) {
|
||||
return 0, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func setUp() error {
|
||||
err := os.MkdirAll("/tmp/ExistingFolder", os.FileMode(0755))
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user