Skip to content

Commit c94885a

Browse files
yunmingyangmartinpitt
authored andcommitted
Fix domainDetachHostDevice() for running VMs
Add missing `await`. This previously caused an error: > call is not a function or its return value is not iterable https://issues.redhat.com/browse/RHEL-31082 Co-Authored-By: Martin Pitt <[email protected]>
1 parent 8bbb1e1 commit c94885a

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/libvirtApi/domain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ export async function domainDetachHostDevice({ connectionName, vmId, live, dev }
515515
await call(connectionName, vmId, 'org.libvirt.Domain', 'DetachDevice', [hostdevInactiveXML, Enum.VIR_DOMAIN_AFFECT_CONFIG], { timeout, type: 'su' });
516516

517517
if (live) {
518-
const [domXml] = call(connectionName, vmId, 'org.libvirt.Domain', 'GetXMLDesc', [0], { timeout, type: 'u' });
518+
const [domXml] = await call(connectionName, vmId, 'org.libvirt.Domain', 'GetXMLDesc', [0], { timeout, type: 'u' });
519519
const hostdevXML = getHostDevElemBySource(domXml, source);
520520

521521
await call(connectionName, vmId, 'org.libvirt.Domain', 'DetachDevice', [hostdevXML, Enum.VIR_DOMAIN_AFFECT_LIVE], { timeout, type: 'su' });

test/check-machines-hostdevs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ class TestMachinesHostDevs(machineslib.VirtualMachinesCase):
261261
self.goToVmPage("subVmTest1")
262262
b.wait_visible("#vm-subVmTest1-hostdevs")
263263

264+
# Add USB devices when the VM is running
265+
b.wait_in_text("#vm-subVmTest1-system-state", "Running")
266+
if has_usb:
267+
HostDevAddDialog(self, "system", dev_type="usb_device").execute()
268+
264269
# Check the error if selecting no devices when the VM is running
265270
dialog = HostDevAddDialog(self, "system", fail_message="No host device selected")
266271
dialog.open()

0 commit comments

Comments
 (0)