phillxnet
(Philip Guyton)
February 4, 2019, 7:08pm
2
3.9.2-39
Merged and released Sep 2018
Thanks to forum member @Flox for this one:
" Briefly, this PR adds support for a new “devices” object in Rockons’ json definition files …"
I.e. a potentially far reaching enhancement to our currently constrained Rock-on system and enables Rock-on definitions to encompass such things as hardware transcoding configurations.
Issue:
opened 07:49PM - 31 Aug 18 UTC
closed 11:52AM - 22 Sep 18 UTC
I've been interested in trying to help improving the functionalities of the Rock… on system following several obstacles I've encountered (multiple containers, custom `docker run` command argument, other `docker run` options) for a while now, but never dared digging through the code.
Recently, however, I started looking into taking advantage of a new functionality of the EmbyServer container: hardware transcoding. Unfortunately, this would require the RockOn to support the `--device` option to `docker run`.
As mentioned in the corresponding issue (https://github.com/rockstor/rockon-registry/issues/152), I was thus thinking to implement support for a new _**Devices**_ object in the JSON files. This object would follow the same structure as the _**Environment**_ object, with `"description"` and `"label"` fields in the JSON file triggering a new page in the Rockon install wizard for the user to input a custom device path (`/dev/dri/renderD128` for instance).
```
{
"description": "path to hardware transcoding device (/dev/dri/renderD128)",
"label": "VAAPI device"
}
```
I started working on it and modify the files I believe are involved in such a process (https://github.com/FroggyFlox/rockstor-core/tree/RockOn_device_option), but am hitting an obstacle in figuring out what's wrong. The problem I'm facing is that I do not get the Rockon install wizard to open a new page related to the _**Devices**_ object I'm trying to implement.
While I can read and understand more or less the intent behind the Python code, I am not familiar enough with Javascript to even understand whether my issue lies first in the frontend or backend.
Would anyone be kind enough to offer some pointer(s)?
I've been testing the following changes:
https://github.com/FroggyFlox/rockstor-core/tree/RockOn_device_option
With the following JSON file:
https://github.com/FroggyFlox/rockon-registry/blob/emby_dotNET/embyserver.json
Code changes:
rockstor:master
← FroggyFlox:RockOn_device_option
opened 06:41PM - 12 Sep 18 UTC
Fixes #1957
Add support for the docker run `--device` option to Rockons to all… ow users to add custom device(s) to their Rockon(s), based on the existing support for the docker run 'environment' variables. This PR is now functional and ready for feedback and review.
Briefly, this PR adds support for a new **"devices"** object in Rockons' json definition files, following the same structure as for the **"environment"** variables with "description" and "label" fields in the JSON file (see below).
```
{
"description": "path to hardware transcoding device (/dev/dri/renderD128)",
"label": "VAAPI device"
}
```
This, in turn, triggers the Rockon install wizard to create a new **Device Choice** page, with as many free text input fields as devices listed in the JSON file. The text input in these fields is then validated under the following rules:
1. optional: if blank, validate.
2. if filled, the input must begin with '/dev/' and only contain alphanumerical characters (thanks @phillxnet for your regex definition).
Testing:
All changes in python files pass Flake8.
The style of the `rockon.js` file was fixed by ESLint following style settings described in the `.eslintrc.js` file in the rockstor-core repo.
The JSON file used for testing is the following, with 3 optional devices listed:
https://github.com/FroggyFlox/rockon-registry/blob/emby_dotNET/embyserver3devices.json