Skip to content

Commit 41ed087

Browse files
doc: document API group interface methods
1 parent 3db4149 commit 41ed087

File tree

6 files changed

+96
-1
lines changed

6 files changed

+96
-1
lines changed

pkg/disk/disk.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,28 @@ type Interface interface {
1717
DiskStats(context.Context, *DiskStatsRequest) (*DiskStatsResponse, error)
1818
GetAttachState(context.Context, *GetAttachStateRequest) (*GetAttachStateResponse, error)
1919
GetDiskNumberByName(context.Context, *GetDiskNumberByNameRequest) (*GetDiskNumberByNameResponse, error)
20+
// GetDiskState gets the offline/online state of a disk.
2021
GetDiskState(context.Context, *GetDiskStateRequest) (*GetDiskStateResponse, error)
22+
23+
// GetDiskStats returns the stats of a disk (currently it returns the disk size).
2124
GetDiskStats(context.Context, *GetDiskStatsRequest) (*GetDiskStatsResponse, error)
25+
26+
// ListDiskIDs returns a map of DiskID objects where the key is the disk number.
2227
ListDiskIDs(context.Context, *ListDiskIDsRequest) (*ListDiskIDsResponse, error)
28+
29+
// ListDiskLocations returns locations <Adapter, Bus, Target, LUN ID> of all
30+
// disk devices enumerated by the host.
2331
ListDiskLocations(context.Context, *ListDiskLocationsRequest) (*ListDiskLocationsResponse, error)
32+
33+
// PartitionDisk initializes and partitions a disk device with the GPT partition style
34+
// (if the disk has not been partitioned already) and returns the resulting volume device ID.
2435
PartitionDisk(context.Context, *PartitionDiskRequest) (*PartitionDiskResponse, error)
36+
37+
// Rescan refreshes the host's storage cache.
2538
Rescan(context.Context, *RescanRequest) (*RescanResponse, error)
2639
SetAttachState(context.Context, *SetAttachStateRequest) (*SetAttachStateResponse, error)
40+
41+
// SetDiskState sets the offline/online state of a disk.
2742
SetDiskState(context.Context, *SetDiskStateRequest) (*SetDiskStateResponse, error)
2843
}
2944

pkg/filesystem/filesystem.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,31 @@ type Filesystem struct {
1212
}
1313

1414
type Interface interface {
15+
// CreateSymlink creates a symbolic link called target_path that points to source_path
16+
// in the host filesystem (target_path is the name of the symbolic link created,
17+
// source_path is the existing path).
1518
CreateSymlink(context.Context, *CreateSymlinkRequest) (*CreateSymlinkResponse, error)
1619
IsMountPoint(context.Context, *IsMountPointRequest) (*IsMountPointResponse, error)
20+
21+
// IsSymlink checks if a given path is a symlink.
1722
IsSymlink(context.Context, *IsSymlinkRequest) (*IsSymlinkResponse, error)
1823
LinkPath(context.Context, *LinkPathRequest) (*LinkPathResponse, error)
24+
25+
// Mkdir creates a directory at the requested path in the host filesystem.
1926
Mkdir(context.Context, *MkdirRequest) (*MkdirResponse, error)
27+
28+
// PathExists checks if the requested path exists in the host filesystem.
2029
PathExists(context.Context, *PathExistsRequest) (*PathExistsResponse, error)
30+
31+
// PathValid checks if the given path is accessible.
2132
PathValid(context.Context, *PathValidRequest) (*PathValidResponse, error)
33+
34+
// Rmdir removes the directory at the requested path in the host filesystem.
35+
// This may be used for unlinking a symlink created through CreateSymlink.
2236
Rmdir(context.Context, *RmdirRequest) (*RmdirResponse, error)
37+
38+
// RmdirContents removes the contents of a directory in the host filesystem.
39+
// Unlike Rmdir it won't delete the requested path, it'll only delete its contents.
2340
RmdirContents(context.Context, *RmdirContentsRequest) (*RmdirContentsResponse, error)
2441
}
2542

@@ -50,7 +67,6 @@ func (f *Filesystem) PathExists(ctx context.Context, request *PathExistsRequest)
5067
}, err
5168
}
5269

53-
// PathValid checks if the given path is accessible.
5470
func (f *Filesystem) PathValid(ctx context.Context, request *PathValidRequest) (*PathValidResponse, error) {
5571
klog.V(2).Infof("Request: PathValid with path %q", request.Path)
5672
valid, err := f.hostAPI.PathValid(request.Path)

pkg/iscsi/iscsi.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,39 @@ type IsCSI struct {
1515
}
1616

1717
type Interface interface {
18+
// AddTargetPortal registers an iSCSI target network address for later
19+
// discovery.
20+
// AddTargetPortal currently does not support selecting different NICs or
21+
// a different iSCSI initiator (e.g a hardware initiator). This means that
22+
// Windows will select the initiator NIC and instance on its own.
1823
AddTargetPortal(context.Context, *AddTargetPortalRequest) (*AddTargetPortalResponse, error)
24+
25+
// ConnectTarget connects to an iSCSI Target
1926
ConnectTarget(context.Context, *ConnectTargetRequest) (*ConnectTargetResponse, error)
27+
28+
// DisconnectTarget disconnects from an iSCSI Target
2029
DisconnectTarget(context.Context, *DisconnectTargetRequest) (*DisconnectTargetResponse, error)
30+
31+
// DiscoverTargetPortal initiates discovery on an iSCSI target network address
32+
// and returns discovered IQNs.
2133
DiscoverTargetPortal(context.Context, *DiscoverTargetPortalRequest) (*DiscoverTargetPortalResponse, error)
34+
35+
// GetTargetDisks returns the disk addresses that correspond to an iSCSI
36+
// target
2237
GetTargetDisks(context.Context, *GetTargetDisksRequest) (*GetTargetDisksResponse, error)
38+
39+
// ListTargetPortal lists all currently registered iSCSI target network
40+
// addresses.
2341
ListTargetPortals(context.Context, *ListTargetPortalsRequest) (*ListTargetPortalsResponse, error)
42+
43+
// RemoveTargetPortal removes an iSCSI target network address registration.
2444
RemoveTargetPortal(context.Context, *RemoveTargetPortalRequest) (*RemoveTargetPortalResponse, error)
45+
46+
// SetMutualChapSecret sets the default CHAP secret that all initiators on
47+
// this machine (node) use to authenticate the target on mutual CHAP
48+
// authentication.
49+
// NOTE: This method affects global node state and should only be used
50+
// with consideration to other CSI drivers that run concurrently.
2551
SetMutualChapSecret(context.Context, *SetMutualChapSecretRequest) (*SetMutualChapSecretResponse, error)
2652
}
2753

pkg/smb/smb.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ type Smb struct {
1616
}
1717

1818
type Interface interface {
19+
// NewSmbGlobalMapping creates an SMB mapping on the SMB client to an SMB share.
1920
NewSmbGlobalMapping(context.Context, *NewSmbGlobalMappingRequest) (*NewSmbGlobalMappingResponse, error)
21+
22+
// RemoveSmbGlobalMapping removes the SMB mapping to an SMB share.
2023
RemoveSmbGlobalMapping(context.Context, *RemoveSmbGlobalMappingRequest) (*RemoveSmbGlobalMappingResponse, error)
2124
}
2225

pkg/system/system.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,20 @@ type System struct {
1212
}
1313

1414
type Interface interface {
15+
// GetBIOSSerialNumber returns the device's serial number
1516
GetBIOSSerialNumber(context.Context, *GetBIOSSerialNumberRequest) (*GetBIOSSerialNumberResponse, error)
17+
18+
// GetService queries a Windows service state
1619
GetService(context.Context, *GetServiceRequest) (*GetServiceResponse, error)
20+
21+
// StartService starts a Windows service
22+
// NOTE: This method affects global node state and should only be used
23+
// with consideration to other CSI drivers that run concurrently.
1724
StartService(context.Context, *StartServiceRequest) (*StartServiceResponse, error)
25+
26+
// StopService stops a Windows service
27+
// NOTE: This method affects global node state and should only be used
28+
// with consideration to other CSI drivers that run concurrently.
1829
StopService(context.Context, *StopServiceRequest) (*StopServiceResponse, error)
1930
}
2031

pkg/volume/volume.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,43 @@ type Volume struct {
1515

1616
type Interface interface {
1717
DismountVolume(context.Context, *DismountVolumeRequest) (*DismountVolumeResponse, error)
18+
// FormatVolume formats a volume with NTFS.
1819
FormatVolume(context.Context, *FormatVolumeRequest) (*FormatVolumeResponse, error)
20+
21+
// GetClosestVolumeIDFromTargetPath gets the closest volume id for a given target path
22+
// by following symlinks and moving up in the filesystem, if after moving up in the filesystem
23+
// we get to a DriveLetter then the volume corresponding to this drive letter is returned instead.
1924
GetClosestVolumeIDFromTargetPath(context.Context, *GetClosestVolumeIDFromTargetPathRequest) (*GetClosestVolumeIDFromTargetPathResponse, error)
25+
26+
// GetDiskNumberFromVolumeID gets the disk number of the disk where the volume is located.
2027
GetDiskNumberFromVolumeID(context.Context, *GetDiskNumberFromVolumeIDRequest) (*GetDiskNumberFromVolumeIDResponse, error)
2128
GetVolumeDiskNumber(context.Context, *VolumeDiskNumberRequest) (*VolumeDiskNumberResponse, error)
2229
GetVolumeIDFromMount(context.Context, *VolumeIDFromMountRequest) (*VolumeIDFromMountResponse, error)
30+
31+
// GetVolumeIDFromTargetPath gets the volume id for a given target path.
2332
GetVolumeIDFromTargetPath(context.Context, *GetVolumeIDFromTargetPathRequest) (*GetVolumeIDFromTargetPathResponse, error)
33+
34+
// GetVolumeStats gathers total bytes and used bytes for a volume.
2435
GetVolumeStats(context.Context, *GetVolumeStatsRequest) (*GetVolumeStatsResponse, error)
36+
37+
// IsVolumeFormatted checks if a volume is formatted.
2538
IsVolumeFormatted(context.Context, *IsVolumeFormattedRequest) (*IsVolumeFormattedResponse, error)
39+
40+
// ListVolumesOnDisk returns the volume IDs (in \\.\Volume{GUID} format) for all volumes from a
41+
// given disk number and partition number (optional)
2642
ListVolumesOnDisk(context.Context, *ListVolumesOnDiskRequest) (*ListVolumesOnDiskResponse, error)
43+
44+
// MountVolume mounts the volume at the requested global staging path.
2745
MountVolume(context.Context, *MountVolumeRequest) (*MountVolumeResponse, error)
46+
47+
// ResizeVolume performs resizing of the partition and file system for a block based volume.
2848
ResizeVolume(context.Context, *ResizeVolumeRequest) (*ResizeVolumeResponse, error)
49+
50+
// UnmountVolume flushes data cache to disk and removes the global staging path.
2951
UnmountVolume(context.Context, *UnmountVolumeRequest) (*UnmountVolumeResponse, error)
3052
VolumeStats(context.Context, *VolumeStatsRequest) (*VolumeStatsResponse, error)
53+
54+
// WriteVolumeCache write volume cache to disk.
3155
WriteVolumeCache(context.Context, *WriteVolumeCacheRequest) (*WriteVolumeCacheResponse, error)
3256
}
3357

0 commit comments

Comments
 (0)