/* VNC autoport cleanup */
if ((vm->def->ngraphics == 1) &&
vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- if (virPortAllocatorRelease(driver->remotePorts,
- vm->def->graphics[0]->data.vnc.port) < 0) {
+ if (virPortAllocatorRelease(vm->def->graphics[0]->data.vnc.port) < 0) {
VIR_WARN("Failed to release VNC port for '%s'",
vm->def->name);
}
vm->def->graphics[0]->data.vnc.autoport) {
vnc_port = vm->def->graphics[0]->data.vnc.port;
if (vnc_port >= LIBXL_VNC_PORT_MIN) {
- if (virPortAllocatorRelease(driver->reservedGraphicsPorts,
- vnc_port) < 0)
+ if (virPortAllocatorRelease(vnc_port) < 0)
VIR_DEBUG("Could not mark port %d as unused", vnc_port);
}
}
}
VIR_FREE(socks);
virObjectUnref(args);
- virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
+ virPortAllocatorRelease(priv->migrationPort);
priv->migrationPort = 0;
/* Remove virDomainObj from domain list */
virObjectEventPtr event = NULL;
virDomainPtr dom = NULL;
- virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
+ virPortAllocatorRelease(priv->migrationPort);
priv->migrationPort = 0;
if (cancelled)
cleanup:
VIR_FREE(diskAlias);
if (ret < 0 && nbdPort == 0)
- virPortAllocatorRelease(driver->migrationPorts, port);
+ virPortAllocatorRelease(port);
return ret;
exit_monitor:
if (qemuDomainObjExitMonitor(driver, vm) < 0)
return -1;
- virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
+ virPortAllocatorRelease(priv->nbdPort);
priv->nbdPort = 0;
return 0;
}
qemuDomainJobTypeToString(priv->job.active),
qemuDomainAsyncJobTypeToString(priv->job.asyncJob));
- virPortAllocatorRelease(driver->migrationPorts, priv->migrationPort);
+ virPortAllocatorRelease(priv->migrationPort);
priv->migrationPort = 0;
if (!qemuMigrationJobIsActive(vm, QEMU_ASYNC_JOB_MIGRATION_IN))
* it is given in parameters
*/
if (nbdPort == 0)
- virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
+ virPortAllocatorRelease(priv->nbdPort);
priv->nbdPort = 0;
virDomainObjRemoveTransientDef(vm);
qemuDomainRemoveInactiveJob(driver, vm);
if (ret != 0) {
VIR_FREE(*uri_out);
if (autoPort)
- virPortAllocatorRelease(driver->migrationPorts, port);
+ virPortAllocatorRelease(port);
}
return ret;
}
cleanup:
VIR_FREE(jobInfo);
- virPortAllocatorRelease(driver->migrationPorts, port);
+ virPortAllocatorRelease(port);
if (priv->mon)
qemuMonitorSetDomainLog(priv->mon, NULL, NULL, NULL);
VIR_FREE(priv->origname);
}
}
- virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
+ virPortAllocatorRelease(priv->nbdPort);
priv->nbdPort = 0;
if (priv->agent) {
virDomainGraphicsDefPtr graphics = vm->def->graphics[i];
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
if (graphics->data.vnc.autoport) {
- virPortAllocatorRelease(driver->remotePorts,
- graphics->data.vnc.port);
+ virPortAllocatorRelease(graphics->data.vnc.port);
} else if (graphics->data.vnc.portReserved) {
virPortAllocatorSetUsed(graphics->data.spice.port, false);
graphics->data.vnc.portReserved = false;
}
if (graphics->data.vnc.websocketGenerated) {
- virPortAllocatorRelease(driver->webSocketPorts,
- graphics->data.vnc.websocket);
+ virPortAllocatorRelease(graphics->data.vnc.websocket);
graphics->data.vnc.websocketGenerated = false;
graphics->data.vnc.websocket = -1;
} else if (graphics->data.vnc.websocket) {
}
if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
if (graphics->data.spice.autoport) {
- virPortAllocatorRelease(driver->remotePorts,
- graphics->data.spice.port);
- virPortAllocatorRelease(driver->remotePorts,
- graphics->data.spice.tlsPort);
+ virPortAllocatorRelease(graphics->data.spice.port);
+ virPortAllocatorRelease(graphics->data.spice.tlsPort);
} else {
if (graphics->data.spice.portReserved) {
virPortAllocatorSetUsed(graphics->data.spice.port, false);
}
int
-virPortAllocatorRelease(virPortAllocatorRangePtr range,
- unsigned short port)
+virPortAllocatorRelease(unsigned short port)
{
int ret = -1;
virPortAllocatorPtr pa = virPortAllocatorGet();
virObjectLock(pa);
- if (port < range->start ||
- port > range->end) {
- virReportInvalidArg(port, "port %d must be in range (%d, %d)",
- port, range->start, range->end);
- goto cleanup;
- }
-
if (virBitmapClearBit(pa->bitmap, port) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to release port %d"),
int virPortAllocatorAcquire(virPortAllocatorRangePtr range,
unsigned short *port);
-int virPortAllocatorRelease(virPortAllocatorRangePtr range,
- unsigned short port);
+int virPortAllocatorRelease(unsigned short port);
int virPortAllocatorSetUsed(unsigned short port, bool value);
vmdef->ngraphics == 1 &&
vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
if (vmdef->graphics[0]->data.vnc.autoport)
- virPortAllocatorRelease(gports, vmdef->graphics[0]->data.vnc.port);
+ virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
else
virPortAllocatorSetUsed(vmdef->graphics[0]->data.vnc.port, false);
}
vmdef->ngraphics == 1 &&
vmdef->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
if (vmdef->graphics[0]->data.vnc.autoport)
- virPortAllocatorRelease(gports, vmdef->graphics[0]->data.vnc.port);
+ virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port);
else
virPortAllocatorSetUsed(vmdef->graphics[0]->data.vnc.port, false);
}
ret = 0;
cleanup:
- virPortAllocatorRelease(ports, p1);
- virPortAllocatorRelease(ports, p2);
- virPortAllocatorRelease(ports, p3);
- virPortAllocatorRelease(ports, p4);
- virPortAllocatorRelease(ports, p5);
- virPortAllocatorRelease(ports, p6);
- virPortAllocatorRelease(ports, p7);
+ virPortAllocatorRelease(p1);
+ virPortAllocatorRelease(p2);
+ virPortAllocatorRelease(p3);
+ virPortAllocatorRelease(p4);
+ virPortAllocatorRelease(p5);
+ virPortAllocatorRelease(p6);
+ virPortAllocatorRelease(p7);
virPortAllocatorRangeFree(ports);
return ret;
goto cleanup;
}
-
- if (virPortAllocatorRelease(ports, p2) < 0)
+ if (virPortAllocatorRelease(p2) < 0)
goto cleanup;
if (virPortAllocatorAcquire(ports, &p4) < 0)
ret = 0;
cleanup:
- virPortAllocatorRelease(ports, p1);
- virPortAllocatorRelease(ports, p3);
- virPortAllocatorRelease(ports, p4);
+ virPortAllocatorRelease(p1);
+ virPortAllocatorRelease(p3);
+ virPortAllocatorRelease(p4);
virPortAllocatorRangeFree(ports);
return ret;