labgrid
labgrid copied to clipboard
driver/usbstoragedriver: Accept `dd` options as `write_image()` arguments
Allow to set currently used arguments (conv, status, oflag, bs, skip, seek) through kwargs instead of hardcoding the defaults. This allows to set them to custom values while allowing to keep the defaults for consistent and backwards-compatible behavior. This also makes place for adding more arguments if needed.
Describe what your pull request does: Adds a possiblity to set currently hardcoded dd arguments to USBMassStorage.write_image() function
Reasons behind the change: When using other dd implementation (BusyBox) currently hardcoded arguments were not supported. This change will allow to avoid such cases and also set custom arguments if needed.
Checklist
- [x] Documentation for the feature Adjust function docstring
- [ ] Tests for the feature
- [ ] The arguments and description in doc/configuration.rst have been updated No need for update here
- [x] CHANGES.rst has been updated
- [x] PR has been tested Verify whether dd arguments are properly set by printing the list with different input arguments. Use feature to write_image to sd card with different arguments.
Added sign-off and changes.rst line
Regarding your use-case (busybox's dd): this should not need to be handled at the user/test-case level. How would the user know which dd version is installed, especially when you have a lab with many exporters?
I'd argue that you'd probably want to use the full dd, as these options are there to ensure the data is full written and the page cache is not influenced by image writing.
Hey, sorry for the the late response but here it is:
Regarding your use-case (busybox's dd): this should not need to be handled at the user/test-case level. How would the user know which dd version is installed, especially when you have a lab with many exporters?
User still could want to set preferred bs or status for example, since he know he uses Mode.DD. I used it as a 'hack' to overcome busybox limitations, but thinking more about that, someone could want to remove progress output, as example, regardless of dd version.
I'd argue that you'd probably want to use the full dd, as these options are there to ensure the data is full written and the page cache is not influenced by image writing.
Still busybox dd works just fine by removing status=progress and changing conv=fdatasync to conv=fsync. That case could be easily supported. This is the first and only time that we found some limitation while running labgrid plugin on such systems.
Concluding - I'd suggest to still make the arguments more flexible while running from plugin. I could work on that. That's not that necessary for me though, so can be as well closed for now too.