qubesutils.py: pass readonly mode to libvirt

Fixes QubesOS/qubes-issues#2255
This commit is contained in:
Rusty Bird 2016-08-18 12:54:26 +00:00
parent 4c1c57bcb7
commit 3606fe64a4
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -424,6 +424,8 @@ def block_attach(qvmc, vm, device, frontend=None, mode="w", auto_detach=False, w
SubElement(disk, 'target').set('dev', frontend)
if backend_vm.qid != 0:
SubElement(disk, 'backenddomain').set('name', device['vm'])
if mode == "r":
SubElement(disk, 'readonly')
vm.libvirt_domain.attachDevice(etree.tostring(disk, encoding='utf-8'))
try:
# trigger watches to update device status