Skip to content

Commit 6ce338c

Browse files
committed
Make attached disk logic package private
1 parent 08a69a9 commit 6ce338c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

pkg/mount-manager/safe-mounter-v1_windows.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func (mounter *CSIProxyMounterV1) Unmount(target string) error {
185185

186186
func (mounter *CSIProxyMounterV1) GetDiskNumber(deviceName string, partition string, volumeKey string) (string, error) {
187187
// First, get Google Cloud metadata to find the nvmeNamespaceIdentifier for this device
188-
googleDisks, err := AttachedDisks()
188+
googleDisks, err := attachedDisks()
189189
if err != nil {
190190
klog.V(4).Infof("Failed to get Google Cloud metadata, falling back to legacy method: %v", err)
191191
return mounter.getDiskNumberLegacy(deviceName)
@@ -337,13 +337,13 @@ func (mounter *CSIProxyMounterV1) convertEUIToDecimal(euiValue string) (uint64,
337337
}
338338

339339
// Helper function to get Google Cloud metadata
340-
func (mounter *CSIProxyMounterV1) getGoogleCloudDisks() ([]GoogleCloudDisk, error) {
340+
func (mounter *CSIProxyMounterV1) getGoogleCloudDisks() ([]googleCloudDisk, error) {
341341
disksResp, err := metadata.GetWithContext(context.Background(), "instance/disks/?recursive=true")
342342
if err != nil {
343343
return nil, fmt.Errorf("failed to get disks using metadata package: %v", err)
344344
}
345345

346-
var disks []GoogleCloudDisk
346+
var disks []googleCloudDisk
347347
if err := json.Unmarshal([]byte(disksResp), &disks); err != nil {
348348
return nil, fmt.Errorf("failed to parse JSON response: %v", err)
349349
}

pkg/mount-manager/safe-mounter-v1beta_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func (mounter *CSIProxyMounterV1Beta) Unmount(target string) error {
200200

201201
func (mounter *CSIProxyMounterV1Beta) GetDiskNumber(deviceName string, partition string, volumeKey string) (string, error) {
202202
// First, get Google Cloud metadata to find the nvmeNamespaceIdentifier for this device
203-
googleDisks, err := AttachedDisks()
203+
googleDisks, err := attachedDisks()
204204
if err != nil {
205205
klog.V(4).Infof("Failed to get Google Cloud metadata, falling back to legacy method: %v", err)
206206
return mounter.getDiskNumberLegacy(deviceName)

pkg/mount-manager/safe-mounter_windows.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func NewSafeMounter(int, time.Duration) (*mount.SafeFormatAndMount, error) {
8787
return nil, err
8888
}
8989

90-
type GoogleCloudDisk struct {
90+
type googleCloudDisk struct {
9191
DeviceName string `json:"deviceName"`
9292
Index int `json:"index"`
9393
Interface string `json:"interface"`
@@ -96,15 +96,15 @@ type GoogleCloudDisk struct {
9696
Type string `json:"type"`
9797
}
9898

99-
// AttachedDisks returns the list of disks attached to the instance from which
99+
// attachedDisks returns the list of disks attached to the instance from which
100100
// the metadata server is called.
101-
func AttachedDisks() ([]GoogleCloudDisk, error) {
101+
func attachedDisks() ([]googleCloudDisk, error) {
102102
disksResp, err := metadata.GetWithContext(context.Background(), "instance/disks/?recursive=true")
103103
if err != nil {
104104
return nil, fmt.Errorf("failed to get disks using metadata package: %v", err)
105105
}
106106

107-
var disks []GoogleCloudDisk
107+
var disks []googleCloudDisk
108108
if err := json.Unmarshal([]byte(disksResp), &disks); err != nil {
109109
return nil, fmt.Errorf("failed to parse JSON response: %v", err)
110110
}

0 commit comments

Comments
 (0)