char *type;
int nparams;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (!(type = virDomainGetSchedulerType(dom, &nparams)))
virTypedParameterPtr params = NULL;
int nparams = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetSchedulerParameters(dom, params, &nparams) < 0)
virTypedParameterPtr params = NULL;
int nparams = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetSchedulerParametersFlags(dom, params, &nparams,
int nr_stats;
size_t i;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->maxStats > REMOTE_DOMAIN_MEMORY_STATS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
goto cleanup;
}
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
/* Allocate stats array for making dispatch call */
size_t size;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
path = args->path;
offset = args->offset;
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
flags = args->flags;
size_t size;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
offset = args->offset;
size = args->size;
virDomainPtr dom = NULL;
virSecurityLabelPtr seclabel = NULL;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (VIR_ALLOC(seclabel) < 0)
virSecurityLabelPtr seclabels = NULL;
int len, rv = -1;
size_t i;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if ((len = virDomainGetSecurityLabelList(dom, &seclabels)) < 0) {
{
virSecurityModel secmodel;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
memset(&secmodel, 0, sizeof(secmodel));
- if (virNodeGetSecurityModel(priv->conn, &secmodel) < 0)
+ if (virNodeGetSecurityModel(conn, &secmodel) < 0)
goto cleanup;
ret->model.model_len = strlen(secmodel.model) + 1;
unsigned char *cpumaps = NULL;
int num;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (args->ncpumaps > REMOTE_VCPUINFO_MAX) {
{
int rv = -1;
virDomainPtr dom = NULL;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainPinEmulator(dom,
unsigned char *cpumaps = NULL;
int r;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
/* Allocate buffers to take the results */
int info_len;
size_t i;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
{
int rv = -1;
size_t i;
- struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
virDomainIOThreadInfoPtr *info = NULL;
virDomainPtr dom = NULL;
remote_domain_iothread_info *dst;
int ninfo = 0;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if ((ninfo = virDomainGetIOThreadInfo(dom, &info, args->flags)) < 0)
char **uri_out;
char *dname;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
uri_in = args->uri_in == NULL ? NULL : *args->uri_in;
dname = args->dname == NULL ? NULL : *args->dname;
if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- if (virDomainMigratePrepare(priv->conn, &cookie, &cookielen,
+ if (virDomainMigratePrepare(conn, &cookie, &cookielen,
uri_in, uri_out,
args->flags, dname, args->resource) < 0)
goto cleanup;
char **uri_out;
char *dname;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
uri_in = args->uri_in == NULL ? NULL : *args->uri_in;
dname = args->dname == NULL ? NULL : *args->dname;
if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- if (virDomainMigratePrepare2(priv->conn, &cookie, &cookielen,
+ if (virDomainMigratePrepare2(conn, &cookie, &cookielen,
uri_in, uri_out,
args->flags, dname, args->resource,
args->dom_xml) < 0)
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetMemoryParameters(dom, params, &nparams, flags) < 0)
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetNumaParameters(dom, params, &nparams, flags) < 0)
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetBlkioParameters(dom, params, &nparams, flags) < 0)
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (virNodeGetCPUStats(priv->conn, cpuNum, params, &nparams, flags) < 0)
+ if (virNodeGetCPUStats(conn, cpuNum, params, &nparams, flags) < 0)
goto cleanup;
/* In this case, we need to send back the number of stats
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (virNodeGetMemoryStats(priv->conn, cellNum, params, &nparams, flags) < 0)
+ if (virNodeGetMemoryStats(conn, cellNum, params, &nparams, flags) < 0)
goto cleanup;
/* In this case, we need to send back the number of parameters
virTypedParameterPtr params = NULL;
int nparams = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetLaunchSecurityInfo(dom, ¶ms, &nparams, args->flags) < 0)
virTypedParameterPtr params = NULL;
int nparams = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetPerfEvents(dom, ¶ms, &nparams, args->flags) < 0)
virDomainPtr dom = NULL;
virDomainBlockJobInfo tmp;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
rv = virDomainGetBlockJobInfo(dom, args->path, &tmp, args->flags);
int rv = -1;
virTypedParameterPtr params = NULL;
int nparams = 0;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->nparams > REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetBlockIoTune(dom, args->disk ? *args->disk : NULL,
virNodeDevicePtr dev = NULL;
const char *parent = NULL;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetNodeDevConn(client);
- if (!priv->nodedevConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dev = virNodeDeviceLookupByName(priv->nodedevConn, args->name)))
+ if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
parent = virNodeDeviceGetParent(dev);
int rv = -1;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (virConnectRegisterCloseCallback(priv->conn,
+ if (virConnectRegisterCloseCallback(conn,
remoteRelayConnectionClosedEvent,
client, NULL) < 0)
goto cleanup;
int rv = -1;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (virConnectUnregisterCloseCallback(priv->conn,
+ if (virConnectUnregisterCloseCallback(conn,
remoteRelayConnectionClosedEvent) < 0)
goto cleanup;
daemonClientEventCallbackPtr ref;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
/* If we call register first, we could append a complete callback
* to our array, but on OOM append failure, we'd have to then hope
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectDomainEventRegisterAny(priv->conn,
+ if ((callbackID = virConnectDomainEventRegisterAny(conn,
NULL,
VIR_DOMAIN_EVENT_ID_LIFECYCLE,
VIR_DOMAIN_EVENT_CALLBACK(remoteRelayDomainEventLifecycle),
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->ndomainEventCallbacks; i++) {
if (priv->domainEventCallbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE) {
goto cleanup;
}
- if (virConnectDomainEventDeregisterAny(priv->conn, callbackID) < 0)
+ if (virConnectDomainEventDeregisterAny(conn, callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->domainEventCallbacks, i,
size_t value_size;
unsigned char *value;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetSecretConn(client);
- if (!priv->secretConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(secret = get_nonnull_secret(priv->secretConn, args->secret)))
+ if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (!(value = virSecretGetValue(secret, &value_size, args->flags)))
{
virDomainPtr dom = NULL;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetState(dom, &ret->state, &ret->reason, args->flags) < 0)
daemonClientEventCallbackPtr ref;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
/* We intentionally do not use VIR_DOMAIN_EVENT_ID_LAST here; any
* new domain events added after this point should only use the
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectDomainEventRegisterAny(priv->conn,
+ if ((callbackID = virConnectDomainEventRegisterAny(conn,
NULL,
args->eventID,
domainEventCallbacks[args->eventID],
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
virDomainPtr dom = NULL;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->dom &&
- !(dom = get_nonnull_domain(priv->conn, *args->dom)))
+ !(dom = get_nonnull_domain(conn, *args->dom)))
goto cleanup;
if (args->eventID >= VIR_DOMAIN_EVENT_ID_LAST || args->eventID < 0) {
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectDomainEventRegisterAny(priv->conn,
+ if ((callbackID = virConnectDomainEventRegisterAny(conn,
dom,
args->eventID,
domainEventCallbacks[args->eventID],
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
/* We intentionally do not use VIR_DOMAIN_EVENT_ID_LAST here; any
* new domain events added after this point should only use the
goto cleanup;
}
- if (virConnectDomainEventDeregisterAny(priv->conn, callbackID) < 0)
+ if (virConnectDomainEventDeregisterAny(conn, callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->domainEventCallbacks, i,
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->ndomainEventCallbacks; i++) {
if (priv->domainEventCallbacks[i]->callbackID == args->callbackID)
goto cleanup;
}
- if (virConnectDomainEventDeregisterAny(priv->conn, args->callbackID) < 0)
+ if (virConnectDomainEventDeregisterAny(conn, args->callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->domainEventCallbacks, i,
{
virDomainPtr dom = NULL;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainQemuMonitorCommand(dom, args->cmd, &ret->result,
char *cookieout = NULL;
int cookieoutlen = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
xmlin = args->xmlin == NULL ? NULL : *args->xmlin;
char **uri_out;
char *dname;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
uri_in = args->uri_in == NULL ? NULL : *args->uri_in;
dname = args->dname == NULL ? NULL : *args->dname;
if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- if (virDomainMigratePrepare3(priv->conn,
+ if (virDomainMigratePrepare3(conn,
args->cookie_in.cookie_in_val,
args->cookie_in.cookie_in_len,
&cookieout, &cookieoutlen,
char *cookieout = NULL;
int cookieoutlen = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
xmlin = args->xmlin == NULL ? NULL : *args->xmlin;
char *uri;
char *dconnuri;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
uri = args->uri == NULL ? NULL : *args->uri;
dconnuri = args->dconnuri == NULL ? NULL : *args->dconnuri;
- if (!(dom = virDomainMigrateFinish3(priv->conn, args->dname,
+ if (!(dom = virDomainMigrateFinish3(conn, args->dname,
args->cookie_in.cookie_in_val,
args->cookie_in.cookie_in_len,
&cookieout, &cookieoutlen,
{
virDomainPtr dom = NULL;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateConfirm3(dom,
{
int rv = -1;
int supported = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = NULL;
/* This feature is checked before opening the connection, thus we must
* check it first.
goto done;
}
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ conn = remoteGetHypervisorConn(client);
+
+ if (!conn)
goto cleanup;
- }
switch ((virDrvFeature) args->feature) {
case VIR_DRV_FEATURE_FD_PASSING:
case VIR_DRV_FEATURE_MIGRATION_OFFLINE:
case VIR_DRV_FEATURE_MIGRATION_PARAMS:
default:
- if ((supported = virConnectSupportsFeature(priv->conn, args->feature)) < 0)
+ if ((supported = virConnectSupportsFeature(conn, args->feature)) < 0)
goto cleanup;
break;
case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE:
virDomainPtr dom = NULL;
int rv = -1;
int fd = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if ((fd = virNetMessageDupFD(msg, 0)) < 0)
virDomainPtr dom = NULL;
int rv = -1;
int fd = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if ((fd = virDomainOpenGraphicsFD(dom,
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetInterfaceParameters(dom, device, params, &nparams, flags) < 0)
remote_domain_get_cpu_stats_ret *ret)
{
virDomainPtr dom = NULL;
- struct daemonClientPrivate *priv;
virTypedParameterPtr params = NULL;
int rv = -1;
int percpu_len = 0;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- priv = virNetServerClientGetPrivateData(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->nparams > REMOTE_NODE_CPU_STATS_MAX) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
VIR_ALLOC_N(params, args->ncpus * args->nparams) < 0)
goto cleanup;
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
percpu_len = virDomainGetCPUStats(dom, params, args->nparams,
virDomainPtr dom = NULL;
virDomainDiskErrorPtr errors = NULL;
int len = 0;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (args->maxerrors > REMOTE_DOMAIN_DISK_ERRORS_MAX) {
virTypedParameterPtr params = NULL;
int nparams = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (virNodeGetSEVInfo(priv->conn, ¶ms, &nparams, args->flags) < 0)
+ if (virNodeGetSEVInfo(conn, ¶ms, &nparams, args->flags) < 0)
goto cleanup;
if (nparams > REMOTE_NODE_SEV_INFO_MAX) {
int nparams = 0;
unsigned int flags;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
goto cleanup;
nparams = args->nparams;
- if (virNodeGetMemoryParameters(priv->conn, params, &nparams, flags) < 0)
+ if (virNodeGetMemoryParameters(conn, params, &nparams, flags) < 0)
goto cleanup;
/* In this case, we need to send back the number of parameters
unsigned int flags;
int cpunum;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
flags = args->flags;
- cpunum = virNodeGetCPUMap(priv->conn, args->need_map ? &cpumap : NULL,
+ cpunum = virNodeGetCPUMap(conn, args->need_map ? &cpumap : NULL,
args->need_online ? &online : NULL, flags);
if (cpunum < 0)
goto cleanup;
lxc_domain_open_namespace_args *args)
{
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
int *fdlist = NULL;
int ret;
virDomainPtr dom = NULL;
size_t i;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
ret = virDomainLxcOpenNamespace(dom,
virTypedParameterPtr params = NULL;
int nparams = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetJobStats(dom, &ret->type, ¶ms,
char *cookieout = NULL;
int cookieoutlen = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) {
virReportError(VIR_ERR_RPC,
goto cleanup;
}
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val,
int cookieoutlen = 0;
char **uri_out;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) {
virReportError(VIR_ERR_RPC,
if (VIR_ALLOC(uri_out) < 0)
goto cleanup;
- if (virDomainMigratePrepare3Params(priv->conn, params, nparams,
+ if (virDomainMigratePrepare3Params(conn, params, nparams,
args->cookie_in.cookie_in_val,
args->cookie_in.cookie_in_len,
&cookieout, &cookieoutlen,
char *cookieout = NULL;
int cookieoutlen = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
virStreamPtr st = NULL;
daemonClientStreamPtr stream = NULL;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) {
virReportError(VIR_ERR_RPC,
0, ¶ms, &nparams) < 0)
goto cleanup;
- if (!(st = virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) ||
+ if (!(st = virStreamNew(conn, VIR_STREAM_NONBLOCK)) ||
!(stream = daemonCreateClientStream(client, st, remoteProgram,
&msg->header, false)))
goto cleanup;
- if (virDomainMigratePrepareTunnel3Params(priv->conn, st, params, nparams,
+ if (virDomainMigratePrepareTunnel3Params(conn, st, params, nparams,
args->cookie_in.cookie_in_val,
args->cookie_in.cookie_in_len,
&cookieout, &cookieoutlen,
int cookieoutlen = 0;
char *dconnuri;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) {
virReportError(VIR_ERR_RPC,
goto cleanup;
}
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val,
char *cookieout = NULL;
int cookieoutlen = 0;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) {
virReportError(VIR_ERR_RPC,
0, ¶ms, &nparams) < 0)
goto cleanup;
- dom = virDomainMigrateFinish3Params(priv->conn, params, nparams,
+ dom = virDomainMigrateFinish3Params(conn, params, nparams,
args->cookie_in.cookie_in_val,
args->cookie_in.cookie_in_len,
&cookieout, &cookieoutlen,
int nparams = 0;
virDomainPtr dom = NULL;
int rv = -1;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->params.params_len > REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX) {
virReportError(VIR_ERR_RPC,
goto cleanup;
}
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virTypedParamsDeserialize((virTypedParameterRemotePtr) args->params.params_val,
{
int len, rv = -1;
char **models = NULL;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- len = virConnectGetCPUModelNames(priv->conn, args->arch,
+ len = virConnectGetCPUModelNames(conn, args->arch,
args->need_results ? &models : NULL,
args->flags);
if (len < 0)
{
int rv = -1;
virDomainPtr dom = NULL;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
int *files = NULL;
unsigned int nfiles = 0;
size_t i;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (VIR_ALLOC_N(files, msg->nfds) < 0)
goto cleanup;
nfiles++;
}
- if ((dom = virDomainCreateXMLWithFiles(priv->conn, args->xml_desc,
+ if ((dom = virDomainCreateXMLWithFiles(conn, args->xml_desc,
nfiles, files,
args->flags)) == NULL)
goto cleanup;
{
int rv = -1;
virDomainPtr dom = NULL;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
int *files = NULL;
unsigned int nfiles = 0;
size_t i;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (VIR_ALLOC_N(files, msg->nfds) < 0)
goto cleanup;
nfiles++;
}
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCreateWithFiles(dom,
int rv = -1;
daemonClientEventCallbackPtr callback = NULL;
daemonClientEventCallbackPtr ref;
+ virNetworkPtr net = NULL;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
- virNetworkPtr net = NULL;
+ virConnectPtr conn = remoteGetNetworkConn(client);
virMutexLock(&priv->lock);
- if (!priv->networkConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->net &&
- !(net = get_nonnull_network(priv->networkConn, *args->net)))
+ !(net = get_nonnull_network(conn, *args->net)))
goto cleanup;
if (args->eventID >= VIR_NETWORK_EVENT_ID_LAST || args->eventID < 0) {
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectNetworkEventRegisterAny(priv->networkConn,
+ if ((callbackID = virConnectNetworkEventRegisterAny(conn,
net,
args->eventID,
networkEventCallbacks[args->eventID],
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetNetworkConn(client);
virMutexLock(&priv->lock);
- if (!priv->networkConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->nnetworkEventCallbacks; i++) {
if (priv->networkEventCallbacks[i]->callbackID == args->callbackID)
goto cleanup;
}
- if (virConnectNetworkEventDeregisterAny(priv->networkConn, args->callbackID) < 0)
+ if (virConnectNetworkEventDeregisterAny(conn, args->callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->networkEventCallbacks, i,
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
virStoragePoolPtr pool = NULL;
+ virConnectPtr conn = remoteGetStorageConn(client);
virMutexLock(&priv->lock);
- if (!priv->storageConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->pool &&
- !(pool = get_nonnull_storage_pool(priv->storageConn, *args->pool)))
+ !(pool = get_nonnull_storage_pool(conn, *args->pool)))
goto cleanup;
if (args->eventID >= VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID < 0) {
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectStoragePoolEventRegisterAny(priv->storageConn,
+ if ((callbackID = virConnectStoragePoolEventRegisterAny(conn,
pool,
args->eventID,
storageEventCallbacks[args->eventID],
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetStorageConn(client);
virMutexLock(&priv->lock);
- if (!priv->storageConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->nstorageEventCallbacks; i++) {
if (priv->storageEventCallbacks[i]->callbackID == args->callbackID)
goto cleanup;
}
- if (virConnectStoragePoolEventDeregisterAny(priv->storageConn, args->callbackID) < 0)
+ if (virConnectStoragePoolEventDeregisterAny(conn, args->callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->storageEventCallbacks, i,
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
virNodeDevicePtr dev = NULL;
+ virConnectPtr conn = remoteGetNodeDevConn(client);
virMutexLock(&priv->lock);
- if (!priv->nodedevConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->dev &&
- !(dev = get_nonnull_node_device(priv->nodedevConn, *args->dev)))
+ !(dev = get_nonnull_node_device(conn, *args->dev)))
goto cleanup;
if (args->eventID >= VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID < 0) {
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectNodeDeviceEventRegisterAny(priv->nodedevConn,
+ if ((callbackID = virConnectNodeDeviceEventRegisterAny(conn,
dev,
args->eventID,
nodeDeviceEventCallbacks[args->eventID],
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetNodeDevConn(client);
virMutexLock(&priv->lock);
- if (!priv->nodedevConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->nnodeDeviceEventCallbacks; i++) {
if (priv->nodeDeviceEventCallbacks[i]->callbackID == args->callbackID)
goto cleanup;
}
- if (virConnectNodeDeviceEventDeregisterAny(priv->nodedevConn, args->callbackID) < 0)
+ if (virConnectNodeDeviceEventDeregisterAny(conn, args->callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->nodeDeviceEventCallbacks, i,
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
virSecretPtr secret = NULL;
+ virConnectPtr conn = remoteGetSecretConn(client);
virMutexLock(&priv->lock);
- if (!priv->secretConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->secret &&
- !(secret = get_nonnull_secret(priv->secretConn, *args->secret)))
+ !(secret = get_nonnull_secret(conn, *args->secret)))
goto cleanup;
if (args->eventID >= VIR_SECRET_EVENT_ID_LAST || args->eventID < 0) {
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectSecretEventRegisterAny(priv->secretConn,
+ if ((callbackID = virConnectSecretEventRegisterAny(conn,
secret,
args->eventID,
secretEventCallbacks[args->eventID],
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetSecretConn(client);
virMutexLock(&priv->lock);
- if (!priv->secretConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->nsecretEventCallbacks; i++) {
if (priv->secretEventCallbacks[i]->callbackID == args->callbackID)
goto cleanup;
}
- if (virConnectSecretEventDeregisterAny(priv->secretConn, args->callbackID) < 0)
+ if (virConnectSecretEventDeregisterAny(conn, args->callbackID) < 0)
goto cleanup;
VIR_DELETE_ELEMENT(priv->secretEventCallbacks, i,
virNetServerClientGetPrivateData(client);
virDomainPtr dom = NULL;
const char *event = args->event ? *args->event : NULL;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->dom &&
- !(dom = get_nonnull_domain(priv->conn, *args->dom)))
+ !(dom = get_nonnull_domain(conn, *args->dom)))
goto cleanup;
/* If we call register first, we could append a complete callback
callback) < 0)
goto cleanup;
- if ((callbackID = virConnectDomainQemuMonitorEventRegister(priv->conn,
+ if ((callbackID = virConnectDomainQemuMonitorEventRegister(conn,
dom,
event,
remoteRelayDomainQemuMonitorEvent,
size_t i;
struct daemonClientPrivate *priv =
virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
virMutexLock(&priv->lock);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
for (i = 0; i < priv->nqemuEventCallbacks; i++) {
if (priv->qemuEventCallbacks[i]->callbackID == args->callbackID)
goto cleanup;
}
- if (virConnectDomainQemuMonitorEventDeregister(priv->conn,
+ if (virConnectDomainQemuMonitorEventDeregister(conn,
args->callbackID) < 0)
goto cleanup;
virDomainPtr dom = NULL;
long long seconds;
unsigned int nseconds;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainGetTime(dom, &seconds, &nseconds, args->flags) < 0)
{
int rv = -1;
int len;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->pages.pages_len * args->cellCount > REMOTE_NODE_MAX_CELLS) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
args->pages.pages_len * args->cellCount) < 0)
goto cleanup;
- if ((len = virNodeGetFreePages(priv->conn,
+ if ((len = virNodeGetFreePages(conn,
args->pages.pages_len,
args->pages.pages_val,
args->startCell,
{
int rv = -1;
size_t i;
- struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
virNetworkDHCPLeasePtr *leases = NULL;
virNetworkPtr net = NULL;
int nleases = 0;
+ virConnectPtr conn = remoteGetNetworkConn(client);
- if (!priv->networkConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(net = get_nonnull_network(priv->networkConn, args->net)))
+ if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if ((nleases = virNetworkGetDHCPLeases(net,
{
int rv = -1;
size_t i;
- struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
virDomainStatsRecordPtr *retStats = NULL;
int nrecords = 0;
virDomainPtr *doms = NULL;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
if (args->doms.doms_len) {
if (VIR_ALLOC_N(doms, args->doms.doms_len + 1) < 0)
goto cleanup;
for (i = 0; i < args->doms.doms_len; i++) {
- if (!(doms[i] = get_nonnull_domain(priv->conn, args->doms.doms_val[i])))
+ if (!(doms[i] = get_nonnull_domain(conn, args->doms.doms_val[i])))
goto cleanup;
}
args->flags)) < 0)
goto cleanup;
} else {
- if ((nrecords = virConnectGetAllDomainStats(priv->conn,
+ if ((nrecords = virConnectGetAllDomainStats(conn,
args->stats,
&retStats,
args->flags)) < 0)
{
int rv = -1;
int len;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if ((len = virNodeAllocPages(priv->conn,
+ if ((len = virNodeAllocPages(conn,
args->pageSizes.pageSizes_len,
args->pageSizes.pageSizes_val,
(unsigned long long *) args->pageCounts.pageCounts_val,
{
int rv = -1;
size_t i, j;
- struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
virDomainFSInfoPtr *info = NULL;
virDomainPtr dom = NULL;
remote_domain_fsinfo *dst;
int ninfo = 0;
size_t ndisk;
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if ((ninfo = virDomainGetFSInfo(dom, &info, args->flags)) < 0)
virDomainPtr dom = NULL;
virDomainInterfacePtr *ifaces = NULL;
int ifaces_count = 0;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetHypervisorConn(client);
- if (!priv->conn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if ((ifaces_count = virDomainInterfaceAddresses(dom, &ifaces, args->source, args->flags)) < 0)
int rv = -1;
virStorageVolPtr vol = NULL;
virStorageVolInfo tmp;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetStorageConn(client);
- if (!priv->storageConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(vol = get_nonnull_storage_vol(priv->storageConn, args->vol)))
+ if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolGetInfoFlags(vol, &tmp, args->flags) < 0)
virNetworkPortPtr port = NULL;
virTypedParameterPtr params = NULL;
int nparams = 0;
- struct daemonClientPrivate *priv =
- virNetServerClientGetPrivateData(client);
+ virConnectPtr conn = remoteGetNetworkConn(client);
- if (!priv->networkConn) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ if (!conn)
goto cleanup;
- }
- if (!(port = get_nonnull_network_port(priv->networkConn, args->port)))
+ if (!(port = get_nonnull_network_port(conn, args->port)))
goto cleanup;
if (virNetworkPortGetParameters(port, ¶ms, &nparams, args->flags) < 0)