New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qvm-block persistent config is too fragile #3437

Open
zander opened this Issue Jan 1, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@zander

zander commented Jan 1, 2018

Qubes OS version:

Qubes 4.0RC3

Steps to reproduce the behavior:

Using qvm-block shows output like this;

dom0:dm-32    Slow-bulk
dom0:sdb1     ST1352DL001 (homes)
dom0:sdc      STORAGE_DEVICE ()

Using qvm-block add with the persistent flag will alter qubes.xml and the 'sdb1' or similar would be the part that is stored in there.
This is a design issue because drive numbers change.

In my own setup I used a new drive created inside of an already existing LVM thin-pool and called it 'bulk' (in pool "Slow"), for some reason qvm-block shows this as dm-32.
When I rebooted this showed up as dm-40, another time as 35.

Expected behavior:

Most distros switched to using UUID based mounting configuration files.
I think its time for Qubes to follow and make sure that in the qubes.xml we no longer have an 'id' attribute that is a not-unique identification number.

  <devices class="block">
    <device backend-domain="dom0" id="dm-35">
      <option="frontend-dev">xvdi</option>
      <option name="read-only">no</option>
    </device>
   </devices>

Please consider dropping the 'id' and adding the 'uuid' attribute. See sudo blkid.

Actual behavior:

Starting a qube where its persistent disk ID could not be found gives a traceback in the journal;

dom0 qubesd[8007]: unhandled exception while calling src=b'dom0' meth=b'admin.vm.Start' dest=b'Work' arg=b'' len(untrusted_payload)=0
dom0 qubesd[8007]: Traceback (most recent call last):
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/qubes/api/__init__.py", line 262, in respond
dom0 qubesd[8007]:     untrusted_payload=untrusted_payload)
dom0 qubesd[8007]:   File "/usr/lib64/python3.5/asyncio/futures.py", line 381, in __iter__
dom0 qubesd[8007]:     yield self  # This tells Task to wait for completion.
dom0 qubesd[8007]:   File "/usr/lib64/python3.5/asyncio/tasks.py", line 310, in _wakeup
dom0 qubesd[8007]:     future.result()
dom0 qubesd[8007]:   File "/usr/lib64/python3.5/asyncio/futures.py", line 294, in result
dom0 qubesd[8007]:     raise self._exception
dom0 qubesd[8007]:   File "/usr/lib64/python3.5/asyncio/tasks.py", line 240, in _step
dom0 qubesd[8007]:     result = coro.send(None)
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/qubes/api/admin.py", line 772, in vm_start
dom0 qubesd[8007]:     yield from self.dest.start()
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/qubes/vm/qubesvm.py", line 895, in start
dom0 qubesd[8007]:     self._update_libvirt_domain()
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/qubes/vm/qubesvm.py", line 1866, in _update_libvirt_domain
dom0 qubesd[8007]:     domain_config = self.create_config_file()
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/qubes/vm/__init__.py", line 468, in create_config_file
dom0 qubesd[8007]:     ]).render(vm=self)
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/jinja2/environment.py", line 989, in render
dom0 qubesd[8007]:     return self.environment.handle_exception(exc_info, True)
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/jinja2/environment.py", line 754, in handle_exception
dom0 qubesd[8007]:     reraise(exc_type, exc_value, tb)
dom0 qubesd[8007]:   File "/usr/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
dom0 qubesd[8007]:     raise value.with_traceback(tb)
dom0 qubesd[8007]:   File "/usr/share/qubes/templates/libvirt/xen.xml", line 93, in top-level template code
dom0 qubesd[8007]:     {% block devices %}
dom0 qubesd[8007]:   File "/usr/share/qubes/templates/libvirt/xen.xml", line 135, in block "devices"
dom0 qubesd[8007]:     {% include 'libvirt/devices/block.xml' %}
dom0 qubesd[8007]:   File "/usr/share/qubes/templates/libvirt/devices/block.xml", line 3, in top-level template code
dom0 qubesd[8007]:     <source dev="{{ device.device_node }}" />
dom0 qubesd[8007]: jinja2.exceptions.UndefinedError: 'qubes.devices.UnknownDevice object' has no attribute 'device_node'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment