exc/block: fix attaching block device exposed by dom0

Don't set <backenddomain> element in libvirt XML when device is provided
by dom0.
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-03 23:42:39 +02:00
parent 75608795b0
commit 2dbb51a38d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 5 additions and 5 deletions

View File

@ -345,7 +345,6 @@ class TC_00_Block(qubes.tests.QubesTestCase):
' <driver name="phy" />\n'
' <source dev="/dev/sda" />\n'
' <target dev="xvdi" />\n'
'\n'
' <backenddomain name="sys-usb" />\n'
'</disk>')
vm.libvirt_domain.attachDevice.assert_called_once_with(device_xml)
@ -366,7 +365,6 @@ class TC_00_Block(qubes.tests.QubesTestCase):
' <driver name="phy" />\n'
' <source dev="/dev/sda" />\n'
' <target dev="xvdj" />\n'
'\n'
' <backenddomain name="sys-usb" />\n'
'</disk>')
vm.libvirt_domain.attachDevice.assert_called_once_with(device_xml)
@ -387,7 +385,7 @@ class TC_00_Block(qubes.tests.QubesTestCase):
' <driver name="phy" />\n'
' <source dev="/dev/sda" />\n'
' <target dev="xvdi" />\n'
' <readonly />\n\n'
' <readonly />\n'
' <backenddomain name="sys-usb" />\n'
'</disk>')
vm.libvirt_domain.attachDevice.assert_called_once_with(device_xml)
@ -462,7 +460,7 @@ class TC_00_Block(qubes.tests.QubesTestCase):
' <driver name="phy" />\n'
' <source dev="/dev/sda" />\n'
' <target dev="xvdi" />\n'
' <readonly />\n\n'
' <readonly />\n'
' <backenddomain name="sys-usb" />\n'
'</disk>')
vm.libvirt_domain.attachDevice.assert_called_once_with(device_xml)
@ -479,7 +477,7 @@ class TC_00_Block(qubes.tests.QubesTestCase):
' <driver name="phy" />\n'
' <source dev="/dev/sda" />\n'
' <target dev="xvdi" />\n'
' <readonly />\n\n'
' <readonly />\n'
' <backenddomain name="sys-usb" />\n'
'</disk>')
vm = TestVM({}, domain_xml=domain_xml_template.format(device_xml))

View File

@ -12,5 +12,7 @@
<readonly />
{%- endif %}
{%- if device.backend_domain.name != 'dom0' %}
<backenddomain name="{{ device.backend_domain.name }}" />
{%- endif %}
</disk>