Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PartitionDisk doesn't work with GPT volumes #144

Closed
wongma7 opened this issue Jun 1, 2021 · 1 comment · Fixed by #145
Closed

PartitionDisk doesn't work with GPT volumes #144

wongma7 opened this issue Jun 1, 2021 · 1 comment · Fixed by #145

Comments

@wongma7
Copy link
Contributor

wongma7 commented Jun 1, 2021

What happened: #128 (comment) (default to GPT instead of MBR) breaks PartitionDisk

klog.V(4).Infof("Checking if disk %s is partitioned", diskID)
because PartitionDisk naively checks if any partition exists and erroneously detects the GPT 16MB reserved partition as one such partition. Result is that the UseMaximumSize partition doesn't get created and ListVolumeondisk unexpectedly returns one entry with empty string.

I0601 19:05:14.144201    5564 server.go:123] calling ListDiskIDs
I0601 19:05:16.365505    5564 server.go:122] calling PathExists with path "c:\\var\\lib\\kubelet\\plugins\\kubernetes.io\\csi\\pv\\pvc-ece81bd9-b1ed-4830-98ea-bf27958ef4bd\\globalmount"
I0601 19:05:16.366181    5564 server.go:238] calling GetVolumeFromMount with request &{Mount:c:\var\lib\kubelet\plugins\kubernetes.io\csi\pv\pvc-ece81bd9-b1ed-4830-98ea-bf27958ef4bd\globalmount}
E0601 19:05:16.694188    5564 server.go:251] failed GetVolumeFromMount error getting the volume for the mount c:\var\lib\kubelet\plugins\kubernetes.io\csi\pv\pvc-ece81bd9-b1ed-4830-98ea-bf27958ef4bd\globalmount, internal error error getting volume from mount. cmd: (Get-Item -Path c:\var\lib\kubelet\plugins\kubernetes.io\csi\pv\pvc-ece81bd9-b1ed-4830-98ea-bf27958ef4bd\globalmount).Target, output: , error: <nil>
I0601 19:05:16.694464    5564 server.go:59] calling PartitionDisk with diskID "5"
I0601 19:05:18.923412    5564 server.go:69] Initializing disk 5
I0601 19:05:21.396159    5564 server.go:79] Checking if disk 5 is partitioned
I0601 19:05:23.877015    5564 server.go:93] Disk 5 already partitioned
I0601 19:05:26.353187    5564 server.go:109] calling IsVolumeFormatted with request: &{VolumeId:}
E0601 19:05:26.353187    5564 server.go:114] volume id empty

What you expected to happen: PartitionDisk works, volume gets found, formatted, and mounted, and my Pod using the volume runs.

How to reproduce it:

use latest csi-proxy with a csi driver

Anything else we need to know?:

Environment:

  • CSI Driver version:
  • Kubernetes version (use kubectl version):
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:
@wongma7
Copy link
Contributor Author

wongma7 commented Jun 1, 2021

Could I simply filter out * Reserved partitions here?

cmd := fmt.Sprintf("Get-Partition | Where DiskNumber -eq %s", diskID)

Get-Partition | Where DiskNumber -eq 4 | Where Type -ne Reserved

I'm trying it out now, I will create a PR if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant