Uploaded image for project: 'TrueNAS'
  1. TrueNAS
  2. NAS-102896

Fix traceback when creating zvol with duplicate name

    XMLWordPrintable

    Details

      Description

      zvol1 already existed. Attempting to create a second one caused a traceback with the message:

      Failed to create dataset: dataset already exists

       

      But this was a zvol, not a dataset.  This form should also check the zvol name when that field loses focus and not enable the save button if the name is already used.

       

      Traceback:

      Error: concurrent.futures.process._RemoteTraceback:
      """
      Traceback (most recent call last):
        File "/usr/local/lib/python3.7/site-packages/middlewared/plugins/zfs.py", line 533, in do_create
          pool.create(data['name'], params, fstype=getattr(libzfs.DatasetType, data['type']), sparse_vol=sparse)
        File "libzfs.pyx", line 367, in libzfs.ZFS.__exit__
        File "/usr/local/lib/python3.7/site-packages/middlewared/plugins/zfs.py", line 533, in do_create
          pool.create(data['name'], params, fstype=getattr(libzfs.DatasetType, data['type']), sparse_vol=sparse)
        File "libzfs.pyx", line 2445, in libzfs.ZFSPool.create
      libzfs.ZFSException: dataset already exists

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/usr/local/lib/python3.7/concurrent/futures/process.py", line 232, in _process_worker
          r = call_item.fn(*call_item.args, **call_item.kwargs)
        File "/usr/local/lib/python3.7/site-packages/middlewared/worker.py", line 105, in main_worker
          res = loop.run_until_complete(coro)
        File "/usr/local/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
          return future.result()
        File "/usr/local/lib/python3.7/site-packages/middlewared/worker.py", line 61, in _run
          return await self._call(name, serviceobj, methodobj, params=args, job=job)
        File "/usr/local/lib/python3.7/site-packages/middlewared/worker.py", line 53, in _call
          return methodobj(*params)
        File "/usr/local/lib/python3.7/site-packages/middlewared/worker.py", line 51, in _call
          return await methodobj(*params)
        File "/usr/local/lib/python3.7/site-packages/middlewared/service.py", line 361, in create
          f'{self._config.namespace}.create', self, self.do_create, [data]
        File "/usr/local/lib/python3.7/site-packages/middlewared/worker.py", line 53, in _call
          return methodobj(*params)
        File "/usr/local/lib/python3.7/site-packages/middlewared/worker.py", line 53, in _call
          return methodobj(*params)
        File "/usr/local/lib/python3.7/site-packages/middlewared/schema.py", line 953, in nf
          return f(*args, **kwargs)
        File "/usr/local/lib/python3.7/site-packages/middlewared/plugins/zfs.py", line 536, in do_create
          raise CallError(f'Failed to create dataset: {e}')
      middlewared.service_exception.CallError: [EFAULT] Failed to create dataset: dataset already exists
      """

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 173, in call_method
          result = await self.middleware.call_method(self, message)
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1147, in call_method
          return await self._call(message['method'], serviceobj, methodobj, params, app=app, io_thread=False)
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1095, in _call
          return await methodobj(*args)
        File "/usr/local/lib/python3.7/site-packages/middlewared/service.py", line 361, in create
          f'{self._config.namespace}.create', self, self.do_create, [data]
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1095, in _call
          return await methodobj(*args)
        File "/usr/local/lib/python3.7/site-packages/middlewared/schema.py", line 949, in nf
          return await f(*args, **kwargs)
        File "/usr/local/lib/python3.7/site-packages/middlewared/plugins/pool.py", line 2647, in do_create
          'properties': props,
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1153, in call
          app=app, pipes=pipes, job_on_progress_cb=job_on_progress_cb, io_thread=True,
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1092, in _call
          return await self._call_worker(name, *args)
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1112, in _call_worker
          return await self.run_in_proc(main_worker, name, args, job)
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1044, in run_in_proc
          return await self.run_in_executor(self.__procpool, method, *args, **kwargs)
        File "/usr/local/lib/python3.7/site-packages/middlewared/main.py", line 1018, in run_in_executor
          return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
      middlewared.service_exception.CallError: [EFAULT] Failed to create dataset: dataset already exists

       

        Attachments

          Attachments

            JEditor

              Activity

                People

                Assignee:
                dmullen Dennis Mullen
                Reporter:
                wblock Warren Block (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: