mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
Return -1 in virPortAllocatorAcquire if all ports are used
Report the error in virPortAllocatorAcquire instead of doing it in every caller. The error contains the port range name instead of the intended use for the port, e.g.: Unable to find an unused port in range 'display' (65534-65535) instead of: Unable to find an unused port for SPICE This also adds error reporting when the QEMU driver could not find an unused port for VNC, VNC WebSockets or NBD migration.
This commit is contained in:
1 parent
d16d90fd40
commit
8c41794af8
5 files changed
+10
-35
No files matched your search
@@ -118,11 +118,9 @@ static int testAllocAll(const void *args ATTRIBUTE_UNUSED)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virPortAllocatorAcquire(alloc, &p7) < 0)
|
||||
goto cleanup;
|
||||
if (p7 != 0) {
|
||||
if (virPortAllocatorAcquire(alloc, &p7) == 0) {
|
||||
if (virTestGetDebug())
|
||||
fprintf(stderr, "Expected 0, got %d", p7);
|
||||
fprintf(stderr, "Expected error, got %d", p7);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user