Skip to content

Commit

Permalink
Fix domainDetachHostDevice() for running VMs
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
2 people authored and jelly committed Apr 10, 2024
1 parent 8bbb1e1 commit c94885a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/libvirtApi/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ export async function domainDetachHostDevice({ connectionName, vmId, live, dev }
await call(connectionName, vmId, 'org.libvirt.Domain', 'DetachDevice', [hostdevInactiveXML, Enum.VIR_DOMAIN_AFFECT_CONFIG], { timeout, type: 'su' });

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

await call(connectionName, vmId, 'org.libvirt.Domain', 'DetachDevice', [hostdevXML, Enum.VIR_DOMAIN_AFFECT_LIVE], { timeout, type: 'su' });
Expand Down
5 changes: 5 additions & 0 deletions test/check-machines-hostdevs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ class TestMachinesHostDevs(machineslib.VirtualMachinesCase):
self.goToVmPage("subVmTest1")
b.wait_visible("#vm-subVmTest1-hostdevs")

# Add USB devices when the VM is running
b.wait_in_text("#vm-subVmTest1-system-state", "Running")
if has_usb:
HostDevAddDialog(self, "system", dev_type="usb_device").execute()

# Check the error if selecting no devices when the VM is running
dialog = HostDevAddDialog(self, "system", fail_message="No host device selected")
dialog.open()
Expand Down

0 comments on commit c94885a

Please sign in to comment.