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

Error when adding devices /dev/disk/by-id/* #427

Closed
hans-fischer opened this issue Feb 1, 2021 · 3 comments · Fixed by #428
Closed

Error when adding devices /dev/disk/by-id/* #427

hans-fischer opened this issue Feb 1, 2021 · 3 comments · Fixed by #428

Comments

@hans-fischer
Copy link

hans-fischer commented Feb 1, 2021

Hello together!

I tried to add my devices by-id because it's consistent when rebooting the cluster.

My command I execute is:
kubectl kadalu storage-add storage-pool-1 --device node2:/dev/disk/by-id/usb-SanDisk_Ultra_4C530001061023116262-0:0

The error:

The following nodes are available:
  node1, node2, node3, node4, node5, node6

Traceback (most recent call last):
  File "/Users/hfi/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/hfi/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/bin/kubectl-kadalu/__main__.py", line 58, in <module>
  File "/usr/local/bin/kubectl-kadalu/__main__.py", line 47, in main
  File "/usr/local/bin/kubectl-kadalu/storage_add.py", line 231, in run
  File "/usr/local/bin/kubectl-kadalu/storage_add.py", line 189, in storage_add_data
ValueError: too many values to unpack (expected 2)

The problem is that the device-id contains a ':'.

In my opinion the fix would be:
File: cli/kubectl_kadalu/storage_add.py
by changing line: 190
FROM: .split(":")
TO: .split(":", 1)

Is that a valid solution?

@aravindavk
Copy link
Member

Is that a valid solution?

Yes, That will fix the issue. Thanks for sharing.

@hans-fischer
Copy link
Author

Are there any other parsings doing this?

aravindavk added a commit that referenced this issue Feb 2, 2021
If device path contains `:` character then parsing was failing.

```
$ kubectl kadalu storage-add storage-pool-1 \
    --device node2:/dev/disk/by-id/usb-SanDisk_Ultra_4C530001061023116262-0:0
```

Error:

```
The following nodes are available:
  node1, node2, node3, node4, node5, node6

Traceback (most recent call last):
  File "/Users/hfi/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/hfi/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/bin/kubectl-kadalu/__main__.py", line 58, in <module>
  File "/usr/local/bin/kubectl-kadalu/__main__.py", line 47, in main
  File "/usr/local/bin/kubectl-kadalu/storage_add.py", line 231, in run
  File "/usr/local/bin/kubectl-kadalu/storage_add.py", line 189, in storage_add_data
ValueError: too many values to unpack (expected 2)
```

Added fix to handle the parsing.

Credits: Hans Fischer (https://github.com/hans-fischer)
Fixes: #427
Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.io>
@aravindavk
Copy link
Member

Sent PR to fix the issue. #428

Thanks

amarts pushed a commit that referenced this issue Feb 2, 2021
If device path contains `:` character then parsing was failing.

```
$ kubectl kadalu storage-add storage-pool-1 \
    --device node2:/dev/disk/by-id/usb-SanDisk_Ultra_4C530001061023116262-0:0
```

Error:

```
The following nodes are available:
  node1, node2, node3, node4, node5, node6

Traceback (most recent call last):
  File "/Users/hfi/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/hfi/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/bin/kubectl-kadalu/__main__.py", line 58, in <module>
  File "/usr/local/bin/kubectl-kadalu/__main__.py", line 47, in main
  File "/usr/local/bin/kubectl-kadalu/storage_add.py", line 231, in run
  File "/usr/local/bin/kubectl-kadalu/storage_add.py", line 189, in storage_add_data
ValueError: too many values to unpack (expected 2)
```

Added fix to handle the parsing.

Credits: Hans Fischer (https://github.com/hans-fischer)
Fixes: #427
Signed-off-by: Aravinda Vishwanathapura <aravinda@kadalu.io>
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.

2 participants