Пример #1
0
func (kl *Kubelet) newVolumeCleanerFromPlugins(kind string, name string, podUID types.UID) (volume.Cleaner, error) {
	plugName := volume.UnescapePluginName(kind)
	plugin, err := kl.volumePluginMgr.FindPluginByName(plugName)
	if err != nil {
		// TODO: Maybe we should launch a cleanup of this dir?
		return nil, fmt.Errorf("can't use volume plugins for %s/%s: %v", podUID, kind, err)
	}
	if plugin == nil {
		// Not found but not an error.
		return nil, nil
	}
	cleaner, err := plugin.NewCleaner(name, podUID)
	if err != nil {
		return nil, fmt.Errorf("failed to instantiate volume plugin for %s/%s: %v", podUID, kind, err)
	}
	glog.V(3).Infof("Used volume plugin %q for %s/%s", plugin.Name(), podUID, kind)
	return cleaner, nil
}
Пример #2
0
func (kl *Kubelet) newVolumeCleanerFromPlugins(kind string, name string, podUID types.UID) volume.Cleaner {
	plugName := volume.UnescapePluginName(kind)
	plugin, err := kl.volumePluginMgr.FindPluginByName(plugName)
	if err != nil {
		// TODO: Maybe we should launch a cleanup of this dir?
		glog.Warningf("Can't use volume plugins for %s/%s: %v", podUID, kind, err)
		return nil
	}
	if plugin == nil {
		glog.Errorf("No error, but nil volume plugin for %s/%s", podUID, kind)
		return nil
	}
	cleaner, err := plugin.NewCleaner(name, podUID)
	if err != nil {
		glog.Warningf("Error instantiating volume plugin for %s/%s: %v", podUID, kind, err)
		return nil
	}
	glog.V(3).Infof("Used volume plugin %q for %s/%s", plugin.Name(), podUID, kind)
	return cleaner
}