Project

General

Profile

Bug #41598

Validate zvol while creating a VM

Added by William Grzybowski over 1 year ago. Updated over 1 year ago.

Status:
Done
Priority:
No priority
Assignee:
William Grzybowski
Category:
Middleware
Target version:
Seen in:
Severity:
Medium
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

We need to make sure the pool for the zvol exists.

[2018/08/14 11:59:59] (WARNING) application.call_method():181 - Exception while calling vm.create(*[{'vm_type': 'Bhyve', 'memory': 512, 'name': 'Test', 'vcpus': 1, 'bootloader': 'UEFI_CSM', 'autostart': True, 'devices': [{'dtype': 'NIC', 'attributes': {'type': 'E1000', 'mac': '00:a0:98:2c:8f:c1', 'nic_attach': 'hn0'}}, {'dtype': 'DISK', 'attributes': {'path': '/dev/zvol//mnt/Test-htm7kd', 'type': 'AHCI', 'sectorsize': 0, 'create_zvol': True, 'zvol_name': '/mnt/Test-htm7kd', 'zvol_type': 'VOLUME', 'zvol_volsize': 4096000000}}, {'dtype': 'CDROM', 'attributes': {'path': '/mnt/KS-LEO BETA V1.41.9 (Leo) - CENTOS7.iso'}}, {'dtype': 'VNC', 'attributes': {'wait': True, 'vnc_port': '6543', 'vnc_resolution': '1024x768', 'vnc_bind': '172.22.100.42', 'vnc_password': '', 'vnc_web': True}}]}])
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 154, in call_method
    result = await self.middleware.call_method(self, message)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1013, in call_method
    return await self._call(message['method'], serviceobj, methodobj, params, app=app, io_thread=False)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 953, in _call
    return await methodobj(*args)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/service.py", line 277, in create
    f'{self._config.namespace}.create', self, self.do_create, [data]
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 953, in _call
    return await methodobj(*args)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/schema.py", line 658, in nf
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/vm.py", line 933, in do_create
    ds_options['name'].split('/', 1)[0]
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1017, in call
    return await self._call(name, serviceobj, methodobj, params, app=app, pipes=pipes, io_thread=True)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 953, in _call
    return await methodobj(*args)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/schema.py", line 658, in nf
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/pool.py", line 866, in recommended_zvol_blocksize
    pool = await self.middleware.call('pool.query', [['name', '=', pool]], {'get': True})
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 1017, in call
    return await self._call(name, serviceobj, methodobj, params, app=app, pipes=pipes, io_thread=True)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 953, in _call
    return await methodobj(*args)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/schema.py", line 658, in nf
    return await f(*args, **kwargs)
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/service.py", line 268, in query
    filter_list, result, filters, options
  File "/usr/local/lib/python3.6/asyncio/coroutines.py", line 129, in throw
    return self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.6/site-packages/middlewared/main.py", line 913, in run_in_io_thread
    return await self.loop.run_in_executor(executor, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/middlewared/utils/__init__.py", line 174, in filter_list
    return rv[0]
IndexError: list index out of range

Acceptance Criteria
Trying to create a VM specifying a nonexistent pool should show a descriptive error from middleware. (Note: This ticket is not about UI showing a pretty error message, if it is not a related ticket may be created)

Risk
Low, bugfix

https://sentry.ixsystems.com/ixsystems/freenas-middleware/issues/12566/

VM Error Msg.png (47.4 KB) VM Error Msg.png Jeff Ervin, 08/29/2018 12:13 PM
26860

Associated revisions

Revision 79705494 (diff)
Added by William Grzybowski over 1 year ago

fix(middlewared/vm): validate DISK device Ticket: #41598

Revision db829880 (diff)
Added by William Grzybowski over 1 year ago

fix(middlewared/vm): validate DISK device Ticket: #41598

History

#1 Updated by Bug Clerk over 1 year ago

  • Status changed from Unscreened to In Progress

#2 Updated by Bug Clerk over 1 year ago

  • Status changed from In Progress to Ready for Testing

#3 Updated by Dru Lavigne over 1 year ago

  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#4 Updated by Jeff Ervin over 1 year ago

26860

Test Passes FreeNAS-11.2-MASTER-201808220903

#5 Updated by Dru Lavigne over 1 year ago

  • Status changed from Passed Testing to Done

Also available in: Atom PDF