Uploaded image for project: 'FreeNAS / TrueNAS'
  1. FreeNAS / TrueNAS
  2. NAS-108351

Error (traceback) when editing unrelated properties on dataset with certain zstd (zstandard) compression levels



    • Impact:


      The TrueNAS 12.0 WebUI allows a user to choose from 3-4 different levels of zstd compression on a dataset, but ZFS itself offers many more. A dataset might have a zstd compression level set on it that isn't offered by the WebUI, whether set through the command line or set on a different system and then imported into TrueNAS.

      When a dataset has a zstd compression level set that isn't available in the WebUI, it becomes impossible to edit any of the dataset's properties in the WebUI, even if those properties are completely unrelated to compression. TrueNAS throws an error, does not save any changes made in the WebUI, and displays the following traceback:

      Error: Traceback (most recent call last):
        File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 137, in call_method
          result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,
        File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1191, in _call
          return await methodobj(*prepared_call.args)
        File "/usr/local/lib/python3.8/site-packages/middlewared/service.py", line 463, in update
          rv = await self.middleware._call(
        File "/usr/local/lib/python3.8/site-packages/middlewared/main.py", line 1191, in _call
          return await methodobj(*prepared_call.args)
        File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 972, in nf
          args, kwargs = clean_and_validate_args(args, kwargs)
        File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 930, in clean_and_validate_args
          value = attr.clean(args[args_index + i])
        File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 607, in clean
          data[key] = attr.clean(value)
        File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 167, in clean
          value = super(Str, self).clean(value)
        File "/usr/local/lib/python3.8/site-packages/middlewared/schema.py", line 53, in clean
          raise Error(self.name, f'Invalid choice: {value}')
      middlewared.schema.Error: [compression] Invalid choice: ZSTD-19

      Steps to reproduce:

      1. Create a new dataset in the WebUI using default values
      2. At the commandline, set a zstd compression level not available in the WebUI. For example:
        zfs set compression=zstd-19 testPool/zstd-test
      1. Back in the WebUI, select "Edit Options" on the dataset
      2. Change a property unrelated to compression, e.g. change "Enable atime" to "off"
      3. Attempt to save the changes

      Observed results:
      The WebUI pops up with a traceback error and the change to the dataset is not saved.

      Expected results:
      The change to the dataset is saved without error. Even if the WebUI does not offer a particular compression setting, it shouldn't choke on saving completely unrelated changes to the dataset when such a compression setting happens to already exist on a dataset.




              Issue Links



                  waqar Waqar Ahmed
                  blkeller Brett Keller
                  0 Vote for this issue
                  4 Start watching this issue