add metrics to cinder
cd -> r fix
This commit is contained in:
		| @@ -79,6 +79,10 @@ const ( | |||||||
| 	cinderVolumePluginName = "kubernetes.io/cinder" | 	cinderVolumePluginName = "kubernetes.io/cinder" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | func getPath(uid types.UID, volName string, host volume.VolumeHost) string { | ||||||
|  | 	return host.GetPodVolumeDir(uid, kstrings.EscapeQualifiedNameForDisk(cinderVolumePluginName), volName) | ||||||
|  | } | ||||||
|  |  | ||||||
| func (plugin *cinderPlugin) Init(host volume.VolumeHost) error { | func (plugin *cinderPlugin) Init(host volume.VolumeHost) error { | ||||||
| 	plugin.host = host | 	plugin.host = host | ||||||
| 	plugin.volumeLocks = keymutex.NewKeyMutex() | 	plugin.volumeLocks = keymutex.NewKeyMutex() | ||||||
| @@ -141,6 +145,7 @@ func (plugin *cinderPlugin) newMounterInternal(spec *volume.Spec, podUID types.U | |||||||
| 			mounter:         mounter, | 			mounter:         mounter, | ||||||
| 			manager:         manager, | 			manager:         manager, | ||||||
| 			plugin:          plugin, | 			plugin:          plugin, | ||||||
|  | 			MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, spec.Name(), plugin.host)), | ||||||
| 		}, | 		}, | ||||||
| 		fsType:             fsType, | 		fsType:             fsType, | ||||||
| 		readOnly:           readOnly, | 		readOnly:           readOnly, | ||||||
| @@ -159,6 +164,7 @@ func (plugin *cinderPlugin) newUnmounterInternal(volName string, podUID types.UI | |||||||
| 			manager:         manager, | 			manager:         manager, | ||||||
| 			mounter:         mounter, | 			mounter:         mounter, | ||||||
| 			plugin:          plugin, | 			plugin:          plugin, | ||||||
|  | 			MetricsProvider: volume.NewMetricsStatFS(getPath(podUID, volName, plugin.host)), | ||||||
| 		}}, nil | 		}}, nil | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -303,7 +309,7 @@ type cinderVolume struct { | |||||||
| 	// diskMounter provides the interface that is used to mount the actual block device. | 	// diskMounter provides the interface that is used to mount the actual block device. | ||||||
| 	blockDeviceMounter mount.Interface | 	blockDeviceMounter mount.Interface | ||||||
| 	plugin             *cinderPlugin | 	plugin             *cinderPlugin | ||||||
| 	volume.MetricsNil | 	volume.MetricsProvider | ||||||
| } | } | ||||||
|  |  | ||||||
| func (b *cinderVolumeMounter) GetAttributes() volume.Attributes { | func (b *cinderVolumeMounter) GetAttributes() volume.Attributes { | ||||||
| @@ -397,8 +403,7 @@ func makeGlobalPDName(host volume.VolumeHost, devName string) string { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (cd *cinderVolume) GetPath() string { | func (cd *cinderVolume) GetPath() string { | ||||||
| 	name := cinderVolumePluginName | 	return getPath(cd.podUID, cd.volName, cd.plugin.host) | ||||||
| 	return cd.plugin.host.GetPodVolumeDir(cd.podUID, kstrings.EscapeQualifiedNameForDisk(name), cd.volName) |  | ||||||
| } | } | ||||||
|  |  | ||||||
| type cinderVolumeUnmounter struct { | type cinderVolumeUnmounter struct { | ||||||
| @@ -484,8 +489,7 @@ type cinderVolumeDeleter struct { | |||||||
| var _ volume.Deleter = &cinderVolumeDeleter{} | var _ volume.Deleter = &cinderVolumeDeleter{} | ||||||
|  |  | ||||||
| func (r *cinderVolumeDeleter) GetPath() string { | func (r *cinderVolumeDeleter) GetPath() string { | ||||||
| 	name := cinderVolumePluginName | 	return getPath(r.podUID, r.volName, r.plugin.host) | ||||||
| 	return r.plugin.host.GetPodVolumeDir(r.podUID, kstrings.EscapeQualifiedNameForDisk(name), r.volName) |  | ||||||
| } | } | ||||||
|  |  | ||||||
| func (r *cinderVolumeDeleter) Delete() error { | func (r *cinderVolumeDeleter) Delete() error { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jesse Haka
					Jesse Haka