util: virtypedparam: Remove return values from virTypedParamListAdd* APIs
The function now return always 0. Refactor the code and remove return values. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
29dd390ea6
commit
f9f40a6d4b
@ -89,29 +89,12 @@ adminServerGetThreadPoolParameters(virNetServer *srv,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist, minWorkers,
|
virTypedParamListAddUInt(paramlist, minWorkers, VIR_THREADPOOL_WORKERS_MIN);
|
||||||
"%s", VIR_THREADPOOL_WORKERS_MIN) < 0)
|
virTypedParamListAddUInt(paramlist, maxWorkers, VIR_THREADPOOL_WORKERS_MAX);
|
||||||
return -1;
|
virTypedParamListAddUInt(paramlist, nWorkers, VIR_THREADPOOL_WORKERS_CURRENT);
|
||||||
|
virTypedParamListAddUInt(paramlist, freeWorkers, VIR_THREADPOOL_WORKERS_FREE);
|
||||||
if (virTypedParamListAddUInt(paramlist, maxWorkers,
|
virTypedParamListAddUInt(paramlist, nPrioWorkers, VIR_THREADPOOL_WORKERS_PRIORITY);
|
||||||
"%s", VIR_THREADPOOL_WORKERS_MAX) < 0)
|
virTypedParamListAddUInt(paramlist, jobQueueDepth, VIR_THREADPOOL_JOB_QUEUE_DEPTH);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist, nWorkers,
|
|
||||||
"%s", VIR_THREADPOOL_WORKERS_CURRENT) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist, freeWorkers,
|
|
||||||
"%s", VIR_THREADPOOL_WORKERS_FREE) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist, nPrioWorkers,
|
|
||||||
"%s", VIR_THREADPOOL_WORKERS_PRIORITY) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist, jobQueueDepth,
|
|
||||||
"%s", VIR_THREADPOOL_JOB_QUEUE_DEPTH) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListSteal(paramlist, params, nparams) < 0)
|
if (virTypedParamListSteal(paramlist, params, nparams) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -211,74 +194,54 @@ adminClientGetInfo(virNetServerClient *client,
|
|||||||
&sock_addr, &identity) < 0)
|
&sock_addr, &identity) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virTypedParamListAddBoolean(paramlist, readonly,
|
virTypedParamListAddBoolean(paramlist, readonly, VIR_CLIENT_INFO_READONLY);
|
||||||
"%s", VIR_CLIENT_INFO_READONLY) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((rc = virIdentityGetSASLUserName(identity, &attr)) < 0)
|
if ((rc = virIdentityGetSASLUserName(identity, &attr)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddString(paramlist, attr,
|
virTypedParamListAddString(paramlist, attr, VIR_CLIENT_INFO_SASL_USER_NAME);
|
||||||
"%s", VIR_CLIENT_INFO_SASL_USER_NAME) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!virNetServerClientIsLocal(client)) {
|
if (!virNetServerClientIsLocal(client)) {
|
||||||
if (virTypedParamListAddString(paramlist, sock_addr,
|
virTypedParamListAddString(paramlist, sock_addr, VIR_CLIENT_INFO_SOCKET_ADDR);
|
||||||
"%s", VIR_CLIENT_INFO_SOCKET_ADDR) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((rc = virIdentityGetX509DName(identity, &attr)) < 0)
|
if ((rc = virIdentityGetX509DName(identity, &attr)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddString(paramlist, attr,
|
virTypedParamListAddString(paramlist, attr, VIR_CLIENT_INFO_X509_DISTINGUISHED_NAME);
|
||||||
"%s", VIR_CLIENT_INFO_X509_DISTINGUISHED_NAME) < 0)
|
|
||||||
return -1;
|
|
||||||
} else {
|
} else {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
gid_t gid;
|
gid_t gid;
|
||||||
if ((rc = virIdentityGetUNIXUserID(identity, &uid)) < 0)
|
if ((rc = virIdentityGetUNIXUserID(identity, &uid)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddInt(paramlist, uid,
|
virTypedParamListAddInt(paramlist, uid, VIR_CLIENT_INFO_UNIX_USER_ID);
|
||||||
"%s", VIR_CLIENT_INFO_UNIX_USER_ID) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((rc = virIdentityGetUserName(identity, &attr)) < 0)
|
if ((rc = virIdentityGetUserName(identity, &attr)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddString(paramlist, attr,
|
virTypedParamListAddString(paramlist, attr, VIR_CLIENT_INFO_UNIX_USER_NAME);
|
||||||
"%s", VIR_CLIENT_INFO_UNIX_USER_NAME) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((rc = virIdentityGetUNIXGroupID(identity, &gid)) < 0)
|
if ((rc = virIdentityGetUNIXGroupID(identity, &gid)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddInt(paramlist, gid,
|
virTypedParamListAddInt(paramlist, gid, VIR_CLIENT_INFO_UNIX_GROUP_ID);
|
||||||
"%s", VIR_CLIENT_INFO_UNIX_GROUP_ID) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((rc = virIdentityGetGroupName(identity, &attr)) < 0)
|
if ((rc = virIdentityGetGroupName(identity, &attr)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddString(paramlist, attr,
|
virTypedParamListAddString(paramlist, attr, VIR_CLIENT_INFO_UNIX_GROUP_NAME);
|
||||||
"%s", VIR_CLIENT_INFO_UNIX_GROUP_NAME) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((rc = virIdentityGetProcessID(identity, &pid)) < 0)
|
if ((rc = virIdentityGetProcessID(identity, &pid)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddInt(paramlist, pid,
|
virTypedParamListAddInt(paramlist, pid, VIR_CLIENT_INFO_UNIX_PROCESS_ID);
|
||||||
"%s", VIR_CLIENT_INFO_UNIX_PROCESS_ID) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc = virIdentityGetSELinuxContext(identity, &attr)) < 0)
|
if ((rc = virIdentityGetSELinuxContext(identity, &attr)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (rc == 1 &&
|
if (rc == 1)
|
||||||
virTypedParamListAddString(paramlist, attr,
|
virTypedParamListAddString(paramlist, attr, VIR_CLIENT_INFO_SELINUX_CONTEXT);
|
||||||
"%s", VIR_CLIENT_INFO_SELINUX_CONTEXT) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListSteal(paramlist, params, nparams) < 0)
|
if (virTypedParamListSteal(paramlist, params, nparams) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@ -305,25 +268,10 @@ adminServerGetClientLimits(virNetServer *srv,
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist,
|
virTypedParamListAddUInt(paramlist, virNetServerGetMaxClients(srv), VIR_SERVER_CLIENTS_MAX);
|
||||||
virNetServerGetMaxClients(srv),
|
virTypedParamListAddUInt(paramlist, virNetServerGetCurrentClients(srv), VIR_SERVER_CLIENTS_CURRENT);
|
||||||
"%s", VIR_SERVER_CLIENTS_MAX) < 0)
|
virTypedParamListAddUInt(paramlist, virNetServerGetMaxUnauthClients(srv), VIR_SERVER_CLIENTS_UNAUTH_MAX);
|
||||||
return -1;
|
virTypedParamListAddUInt(paramlist, virNetServerGetCurrentUnauthClients(srv), VIR_SERVER_CLIENTS_UNAUTH_CURRENT);
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist,
|
|
||||||
virNetServerGetCurrentClients(srv),
|
|
||||||
"%s", VIR_SERVER_CLIENTS_CURRENT) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist,
|
|
||||||
virNetServerGetMaxUnauthClients(srv),
|
|
||||||
"%s", VIR_SERVER_CLIENTS_UNAUTH_MAX) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(paramlist,
|
|
||||||
virNetServerGetCurrentUnauthClients(srv),
|
|
||||||
"%s", VIR_SERVER_CLIENTS_UNAUTH_CURRENT) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListSteal(paramlist, params, nparams) < 0)
|
if (virTypedParamListSteal(paramlist, params, nparams) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -480,47 +480,26 @@ qemuDomainBackupJobDataToParams(virDomainJobData *jobData,
|
|||||||
qemuDomainBackupStats *stats = &priv->stats.backup;
|
qemuDomainBackupStats *stats = &priv->stats.backup;
|
||||||
g_autoptr(virTypedParamList) par = virTypedParamListNew();
|
g_autoptr(virTypedParamList) par = virTypedParamListNew();
|
||||||
|
|
||||||
if (virTypedParamListAddInt(par, jobData->operation,
|
virTypedParamListAddInt(par, jobData->operation, VIR_DOMAIN_JOB_OPERATION);
|
||||||
VIR_DOMAIN_JOB_OPERATION) < 0)
|
virTypedParamListAddULLong(par, jobData->timeElapsed, VIR_DOMAIN_JOB_TIME_ELAPSED);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(par, jobData->timeElapsed,
|
|
||||||
VIR_DOMAIN_JOB_TIME_ELAPSED) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (stats->transferred > 0 || stats->total > 0) {
|
if (stats->transferred > 0 || stats->total > 0) {
|
||||||
if (virTypedParamListAddULLong(par, stats->total,
|
virTypedParamListAddULLong(par, stats->total, VIR_DOMAIN_JOB_DISK_TOTAL);
|
||||||
VIR_DOMAIN_JOB_DISK_TOTAL) < 0)
|
virTypedParamListAddULLong(par, stats->transferred, VIR_DOMAIN_JOB_DISK_PROCESSED);
|
||||||
return -1;
|
virTypedParamListAddULLong(par, stats->total - stats->transferred, VIR_DOMAIN_JOB_DISK_REMAINING);
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(par, stats->transferred,
|
|
||||||
VIR_DOMAIN_JOB_DISK_PROCESSED) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(par, stats->total - stats->transferred,
|
|
||||||
VIR_DOMAIN_JOB_DISK_REMAINING) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stats->tmp_used > 0 || stats->tmp_total > 0) {
|
if (stats->tmp_used > 0 || stats->tmp_total > 0) {
|
||||||
if (virTypedParamListAddULLong(par, stats->tmp_used,
|
virTypedParamListAddULLong(par, stats->tmp_used, VIR_DOMAIN_JOB_DISK_TEMP_USED);
|
||||||
VIR_DOMAIN_JOB_DISK_TEMP_USED) < 0)
|
virTypedParamListAddULLong(par, stats->tmp_total, VIR_DOMAIN_JOB_DISK_TEMP_TOTAL);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(par, stats->tmp_total,
|
|
||||||
VIR_DOMAIN_JOB_DISK_TEMP_TOTAL) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jobData->status != VIR_DOMAIN_JOB_STATUS_ACTIVE &&
|
if (jobData->status != VIR_DOMAIN_JOB_STATUS_ACTIVE)
|
||||||
virTypedParamListAddBoolean(par,
|
virTypedParamListAddBoolean(par, jobData->status == VIR_DOMAIN_JOB_STATUS_COMPLETED,
|
||||||
jobData->status == VIR_DOMAIN_JOB_STATUS_COMPLETED,
|
VIR_DOMAIN_JOB_SUCCESS);
|
||||||
VIR_DOMAIN_JOB_SUCCESS) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (jobData->errmsg &&
|
if (jobData->errmsg)
|
||||||
virTypedParamListAddString(par, jobData->errmsg, VIR_DOMAIN_JOB_ERRMSG) < 0)
|
virTypedParamListAddString(par, jobData->errmsg, VIR_DOMAIN_JOB_ERRMSG);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListSteal(par, params, nparams) < 0)
|
if (virTypedParamListSteal(par, params, nparams) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -16507,11 +16507,8 @@ qemuDomainGetStatsState(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
virTypedParamList *params,
|
virTypedParamList *params,
|
||||||
unsigned int privflags G_GNUC_UNUSED)
|
unsigned int privflags G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
if (virTypedParamListAddInt(params, dom->state.state, "state.state") < 0)
|
virTypedParamListAddInt(params, dom->state.state, "state.state");
|
||||||
return -1;
|
virTypedParamListAddInt(params, dom->state.reason, "state.reason");
|
||||||
|
|
||||||
if (virTypedParamListAddInt(params, dom->state.reason, "state.reason") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -16670,33 +16667,16 @@ qemuDomainGetStatsMemoryBandwidth(virQEMUDriver *driver,
|
|||||||
if (nresdata == 0)
|
if (nresdata == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, nresdata,
|
virTypedParamListAddUInt(params, nresdata, "memory.bandwidth.monitor.count");
|
||||||
"memory.bandwidth.monitor.count") < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (i = 0; i < nresdata; i++) {
|
for (i = 0; i < nresdata; i++) {
|
||||||
if (virTypedParamListAddString(params, resdata[i]->name,
|
virTypedParamListAddString(params, resdata[i]->name, "memory.bandwidth.monitor.%zu.name", i);
|
||||||
"memory.bandwidth.monitor.%zu.name",
|
virTypedParamListAddString(params, resdata[i]->vcpus, "memory.bandwidth.monitor.%zu.vcpus", i);
|
||||||
i) < 0)
|
virTypedParamListAddUInt(params, resdata[i]->nstats, "memory.bandwidth.monitor.%zu.node.count", i);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virTypedParamListAddString(params, resdata[i]->vcpus,
|
|
||||||
"memory.bandwidth.monitor.%zu.vcpus",
|
|
||||||
i) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, resdata[i]->nstats,
|
|
||||||
"memory.bandwidth.monitor.%zu.node.count",
|
|
||||||
i) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
|
|
||||||
for (j = 0; j < resdata[i]->nstats; j++) {
|
for (j = 0; j < resdata[i]->nstats; j++) {
|
||||||
if (virTypedParamListAddUInt(params, resdata[i]->stats[j]->id,
|
virTypedParamListAddUInt(params, resdata[i]->stats[j]->id,
|
||||||
"memory.bandwidth.monitor.%zu."
|
"memory.bandwidth.monitor.%zu.node.%zu.id", i, j);
|
||||||
"node.%zu.id",
|
|
||||||
i, j) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
|
|
||||||
features = resdata[i]->stats[j]->features;
|
features = resdata[i]->stats[j]->features;
|
||||||
@ -16704,23 +16684,15 @@ qemuDomainGetStatsMemoryBandwidth(virQEMUDriver *driver,
|
|||||||
if (STREQ(features[k], "mbm_local_bytes")) {
|
if (STREQ(features[k], "mbm_local_bytes")) {
|
||||||
/* The accumulative data passing through local memory
|
/* The accumulative data passing through local memory
|
||||||
* controller is recorded with 64 bit counter. */
|
* controller is recorded with 64 bit counter. */
|
||||||
if (virTypedParamListAddULLong(params,
|
virTypedParamListAddULLong(params, resdata[i]->stats[j]->vals[k],
|
||||||
resdata[i]->stats[j]->vals[k],
|
"memory.bandwidth.monitor.%zu.node.%zu.bytes.local", i, j);
|
||||||
"memory.bandwidth.monitor."
|
|
||||||
"%zu.node.%zu.bytes.local",
|
|
||||||
i, j) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STREQ(features[k], "mbm_total_bytes")) {
|
if (STREQ(features[k], "mbm_total_bytes")) {
|
||||||
/* The accumulative data passing through local and remote
|
/* The accumulative data passing through local and remote
|
||||||
* memory controller is recorded with 64 bit counter. */
|
* memory controller is recorded with 64 bit counter. */
|
||||||
if (virTypedParamListAddULLong(params,
|
virTypedParamListAddULLong(params, resdata[i]->stats[j]->vals[k],
|
||||||
resdata[i]->stats[j]->vals[k],
|
"memory.bandwidth.monitor.%zu.node.%zu.bytes.total", i, j);
|
||||||
"memory.bandwidth.monitor."
|
|
||||||
"%zu.node.%zu.bytes.total",
|
|
||||||
i, j) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16753,26 +16725,16 @@ qemuDomainGetStatsCpuCache(virQEMUDriver *driver,
|
|||||||
VIR_RESCTRL_MONITOR_TYPE_CACHE) < 0)
|
VIR_RESCTRL_MONITOR_TYPE_CACHE) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, nresdata, "cpu.cache.monitor.count") < 0)
|
virTypedParamListAddUInt(params, nresdata, "cpu.cache.monitor.count");
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (i = 0; i < nresdata; i++) {
|
for (i = 0; i < nresdata; i++) {
|
||||||
if (virTypedParamListAddString(params, resdata[i]->name,
|
virTypedParamListAddString(params, resdata[i]->name, "cpu.cache.monitor.%zu.name", i);
|
||||||
"cpu.cache.monitor.%zu.name", i) < 0)
|
virTypedParamListAddString(params, resdata[i]->vcpus, "cpu.cache.monitor.%zu.vcpus", i);
|
||||||
goto cleanup;
|
virTypedParamListAddUInt(params, resdata[i]->nstats, "cpu.cache.monitor.%zu.bank.count", i);
|
||||||
|
|
||||||
if (virTypedParamListAddString(params, resdata[i]->vcpus,
|
|
||||||
"cpu.cache.monitor.%zu.vcpus", i) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, resdata[i]->nstats,
|
|
||||||
"cpu.cache.monitor.%zu.bank.count", i) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (j = 0; j < resdata[i]->nstats; j++) {
|
for (j = 0; j < resdata[i]->nstats; j++) {
|
||||||
if (virTypedParamListAddUInt(params, resdata[i]->stats[j]->id,
|
virTypedParamListAddUInt(params, resdata[i]->stats[j]->id,
|
||||||
"cpu.cache.monitor.%zu.bank.%zu.id", i, j) < 0)
|
"cpu.cache.monitor.%zu.bank.%zu.id", i, j);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
/* 'resdata[i]->stats[j]->vals[0]' keeps the value of how many last
|
/* 'resdata[i]->stats[j]->vals[0]' keeps the value of how many last
|
||||||
* level cache in bank j currently occupied by the vcpus listed in
|
* level cache in bank j currently occupied by the vcpus listed in
|
||||||
@ -16783,11 +16745,8 @@ qemuDomainGetStatsCpuCache(virQEMUDriver *driver,
|
|||||||
* than 4G bytes in size, to keep the 'domstats' interface
|
* than 4G bytes in size, to keep the 'domstats' interface
|
||||||
* historically consistent, it is safe to report the value with a
|
* historically consistent, it is safe to report the value with a
|
||||||
* truncated 'UInt' data type here. */
|
* truncated 'UInt' data type here. */
|
||||||
if (virTypedParamListAddUInt(params,
|
virTypedParamListAddUInt(params, (unsigned int)resdata[i]->stats[j]->vals[0],
|
||||||
(unsigned int)resdata[i]->stats[j]->vals[0],
|
"cpu.cache.monitor.%zu.bank.%zu.bytes", i, j);
|
||||||
"cpu.cache.monitor.%zu.bank.%zu.bytes",
|
|
||||||
i, j) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16808,20 +16767,17 @@ qemuDomainGetStatsCpuCgroup(virDomainObj *dom,
|
|||||||
unsigned long long cpu_time = 0;
|
unsigned long long cpu_time = 0;
|
||||||
unsigned long long user_time = 0;
|
unsigned long long user_time = 0;
|
||||||
unsigned long long sys_time = 0;
|
unsigned long long sys_time = 0;
|
||||||
int err = 0;
|
|
||||||
|
|
||||||
if (!priv->cgroup)
|
if (!priv->cgroup)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err = virCgroupGetCpuacctUsage(priv->cgroup, &cpu_time);
|
if (virCgroupGetCpuacctUsage(priv->cgroup, &cpu_time) == 0)
|
||||||
if (!err && virTypedParamListAddULLong(params, cpu_time, "cpu.time") < 0)
|
virTypedParamListAddULLong(params, cpu_time, "cpu.time");
|
||||||
return -1;
|
|
||||||
|
|
||||||
err = virCgroupGetCpuacctStat(priv->cgroup, &user_time, &sys_time);
|
if (virCgroupGetCpuacctStat(priv->cgroup, &user_time, &sys_time) == 0) {
|
||||||
if (!err && virTypedParamListAddULLong(params, user_time, "cpu.user") < 0)
|
virTypedParamListAddULLong(params, user_time, "cpu.user");
|
||||||
return -1;
|
virTypedParamListAddULLong(params, sys_time, "cpu.system");
|
||||||
if (!err && virTypedParamListAddULLong(params, sys_time, "cpu.system") < 0)
|
}
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -16841,10 +16797,9 @@ qemuDomainGetStatsCpuProc(virDomainObj *vm,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, cpuTime, "cpu.time") < 0 ||
|
virTypedParamListAddULLong(params, cpuTime, "cpu.time");
|
||||||
virTypedParamListAddULLong(params, userTime, "cpu.user") < 0 ||
|
virTypedParamListAddULLong(params, userTime, "cpu.user");
|
||||||
virTypedParamListAddULLong(params, sysTime, "cpu.system") < 0)
|
virTypedParamListAddULLong(params, sysTime, "cpu.system");
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -16932,9 +16887,8 @@ qemuDomainGetStatsCpuHaltPollTime(virDomainObj *dom,
|
|||||||
virHostCPUGetHaltPollTime(dom->pid, &haltPollSuccess, &haltPollFail) < 0)
|
virHostCPUGetHaltPollTime(dom->pid, &haltPollSuccess, &haltPollFail) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, haltPollSuccess, "cpu.haltpoll.success.time") < 0 ||
|
virTypedParamListAddULLong(params, haltPollSuccess, "cpu.haltpoll.success.time");
|
||||||
virTypedParamListAddULLong(params, haltPollFail, "cpu.haltpoll.fail.time") < 0)
|
virTypedParamListAddULLong(params, haltPollFail, "cpu.haltpoll.fail.time");
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -16993,12 +16947,8 @@ qemuDomainGetStatsBalloon(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
cur_balloon = dom->def->mem.cur_balloon;
|
cur_balloon = dom->def->mem.cur_balloon;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, cur_balloon, "balloon.current") < 0)
|
virTypedParamListAddULLong(params, cur_balloon, "balloon.current");
|
||||||
return -1;
|
virTypedParamListAddULLong(params, virDomainDefGetMemoryTotal(dom->def), "balloon.maximum");
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, virDomainDefGetMemoryTotal(dom->def),
|
|
||||||
"balloon.maximum") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
|
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
|
||||||
return 0;
|
return 0;
|
||||||
@ -17010,8 +16960,7 @@ qemuDomainGetStatsBalloon(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
|
|
||||||
#define STORE_MEM_RECORD(TAG, NAME) \
|
#define STORE_MEM_RECORD(TAG, NAME) \
|
||||||
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ ##TAG) \
|
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ ##TAG) \
|
||||||
if (virTypedParamListAddULLong(params, stats[i].val, "balloon." NAME) < 0) \
|
virTypedParamListAddULLong(params, stats[i].val, "balloon." NAME);
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < nr_stats; i++) {
|
for (i = 0; i < nr_stats; i++) {
|
||||||
STORE_MEM_RECORD(SWAP_IN, "swap_in")
|
STORE_MEM_RECORD(SWAP_IN, "swap_in")
|
||||||
@ -17080,16 +17029,14 @@ qemuDomainAddStatsFromHashTable(GHashTable *stats,
|
|||||||
if (virJSONValueGetBoolean(value, &stat) < 0)
|
if (virJSONValueGetBoolean(value, &stat) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ignore_value(virTypedParamListAddBoolean(params, stat, "%s.%s.%s",
|
virTypedParamListAddBoolean(params, stat, "%s.%s.%s", prefix, key, type);
|
||||||
prefix, key, type));
|
|
||||||
} else {
|
} else {
|
||||||
unsigned long long stat;
|
unsigned long long stat;
|
||||||
|
|
||||||
if (virJSONValueGetNumberUlong(value, &stat) < 0)
|
if (virJSONValueGetNumberUlong(value, &stat) < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ignore_value(virTypedParamListAddULLong(params, stat, "%s.%s.%s",
|
virTypedParamListAddULLong(params, stat, "%s.%s.%s", prefix, key, type);
|
||||||
prefix, key, type));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -17110,13 +17057,8 @@ qemuDomainGetStatsVcpu(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
qemuDomainObjPrivate *priv = dom->privateData;
|
qemuDomainObjPrivate *priv = dom->privateData;
|
||||||
g_autoptr(virJSONValue) queried_stats = NULL;
|
g_autoptr(virJSONValue) queried_stats = NULL;
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, virDomainDefGetVcpus(dom->def),
|
virTypedParamListAddUInt(params, virDomainDefGetVcpus(dom->def), "vcpu.current");
|
||||||
"vcpu.current") < 0)
|
virTypedParamListAddUInt(params, virDomainDefGetVcpusMax(dom->def), "vcpu.maximum");
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, virDomainDefGetVcpusMax(dom->def),
|
|
||||||
"vcpu.maximum") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
cpuinfo = g_new0(virVcpuInfo, virDomainDefGetVcpus(dom->def));
|
cpuinfo = g_new0(virVcpuInfo, virDomainDefGetVcpus(dom->def));
|
||||||
cpuwait = g_new0(unsigned long long, virDomainDefGetVcpus(dom->def));
|
cpuwait = g_new0(unsigned long long, virDomainDefGetVcpus(dom->def));
|
||||||
@ -17149,25 +17091,15 @@ qemuDomainGetStatsVcpu(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
g_autoptr(GHashTable) stats = NULL;
|
g_autoptr(GHashTable) stats = NULL;
|
||||||
g_autofree char *prefix = g_strdup_printf("vcpu.%u", cpuinfo[i].number);
|
g_autofree char *prefix = g_strdup_printf("vcpu.%u", cpuinfo[i].number);
|
||||||
|
|
||||||
if (virTypedParamListAddInt(params, cpuinfo[i].state,
|
virTypedParamListAddInt(params, cpuinfo[i].state, "vcpu.%u.state", cpuinfo[i].number);
|
||||||
"vcpu.%u.state", cpuinfo[i].number) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* stats below are available only if the VM is alive */
|
/* stats below are available only if the VM is alive */
|
||||||
if (!virDomainObjIsActive(dom))
|
if (!virDomainObjIsActive(dom))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, cpuinfo[i].cpuTime,
|
virTypedParamListAddULLong(params, cpuinfo[i].cpuTime, "vcpu.%u.time", cpuinfo[i].number);
|
||||||
"vcpu.%u.time", cpuinfo[i].number) < 0)
|
virTypedParamListAddULLong(params, cpuwait[i], "vcpu.%u.wait", cpuinfo[i].number);
|
||||||
return -1;
|
virTypedParamListAddULLong(params, cpudelay[i], "vcpu.%u.delay", cpuinfo[i].number);
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, cpuwait[i],
|
|
||||||
"vcpu.%u.wait", cpuinfo[i].number) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, cpudelay[i],
|
|
||||||
"vcpu.%u.delay", cpuinfo[i].number) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* state below is extracted from the individual vcpu structs */
|
/* state below is extracted from the individual vcpu structs */
|
||||||
if (!(vcpu = virDomainDefGetVcpu(dom->def, cpuinfo[i].number)))
|
if (!(vcpu = virDomainDefGetVcpu(dom->def, cpuinfo[i].number)))
|
||||||
@ -17176,11 +17108,8 @@ qemuDomainGetStatsVcpu(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
|
vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu);
|
||||||
|
|
||||||
if (vcpupriv->halted != VIR_TRISTATE_BOOL_ABSENT) {
|
if (vcpupriv->halted != VIR_TRISTATE_BOOL_ABSENT) {
|
||||||
if (virTypedParamListAddBoolean(params,
|
virTypedParamListAddBoolean(params, vcpupriv->halted == VIR_TRISTATE_BOOL_YES,
|
||||||
vcpupriv->halted == VIR_TRISTATE_BOOL_YES,
|
"vcpu.%u.halted", cpuinfo[i].number);
|
||||||
"vcpu.%u.halted",
|
|
||||||
cpuinfo[i].number) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!queried_stats)
|
if (!queried_stats)
|
||||||
@ -17196,9 +17125,8 @@ qemuDomainGetStatsVcpu(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define QEMU_ADD_NET_PARAM(params, num, name, value) \
|
#define QEMU_ADD_NET_PARAM(params, num, name, value) \
|
||||||
if (value >= 0 && \
|
if (value >= 0)\
|
||||||
virTypedParamListAddULLong((params), (value), "net.%zu.%s", (num), (name)) < 0) \
|
virTypedParamListAddULLong((params), (value), "net.%zu.%s", (num), (name));
|
||||||
return -1;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
|
qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
|
||||||
@ -17212,8 +17140,7 @@ qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
if (!virDomainObjIsActive(dom))
|
if (!virDomainObjIsActive(dom))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, dom->def->nnets, "net.count") < 0)
|
virTypedParamListAddUInt(params, dom->def->nnets, "net.count");
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* Check the path is one of the domain's network interfaces. */
|
/* Check the path is one of the domain's network interfaces. */
|
||||||
for (i = 0; i < dom->def->nnets; i++) {
|
for (i = 0; i < dom->def->nnets; i++) {
|
||||||
@ -17227,8 +17154,7 @@ qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
|
|
||||||
actualType = virDomainNetGetActualType(net);
|
actualType = virDomainNetGetActualType(net);
|
||||||
|
|
||||||
if (virTypedParamListAddString(params, net->ifname, "net.%zu.name", i) < 0)
|
virTypedParamListAddString(params, net->ifname, "net.%zu.name", i);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
if (actualType == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
|
||||||
if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) {
|
if (virNetDevOpenvswitchInterfaceStats(net->ifname, &tmp) < 0) {
|
||||||
@ -17243,22 +17169,14 @@ qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
QEMU_ADD_NET_PARAM(params, i, "rx.bytes", tmp.rx_bytes);
|
||||||
"rx.bytes", tmp.rx_bytes);
|
QEMU_ADD_NET_PARAM(params, i, "rx.pkts", tmp.rx_packets);
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
QEMU_ADD_NET_PARAM(params, i, "rx.errs", tmp.rx_errs);
|
||||||
"rx.pkts", tmp.rx_packets);
|
QEMU_ADD_NET_PARAM(params, i, "rx.drop", tmp.rx_drop);
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
QEMU_ADD_NET_PARAM(params, i, "tx.bytes", tmp.tx_bytes);
|
||||||
"rx.errs", tmp.rx_errs);
|
QEMU_ADD_NET_PARAM(params, i, "tx.pkts", tmp.tx_packets);
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
QEMU_ADD_NET_PARAM(params, i, "tx.errs", tmp.tx_errs);
|
||||||
"rx.drop", tmp.rx_drop);
|
QEMU_ADD_NET_PARAM(params, i, "tx.drop", tmp.tx_drop);
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
|
||||||
"tx.bytes", tmp.tx_bytes);
|
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
|
||||||
"tx.pkts", tmp.tx_packets);
|
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
|
||||||
"tx.errs", tmp.tx_errs);
|
|
||||||
QEMU_ADD_NET_PARAM(params, i,
|
|
||||||
"tx.drop", tmp.tx_drop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -17286,20 +17204,14 @@ qemuDomainGetStatsOneBlockFallback(virQEMUDriver *driver,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (src->allocation &&
|
if (src->allocation)
|
||||||
virTypedParamListAddULLong(params, src->allocation,
|
virTypedParamListAddULLong(params, src->allocation, "block.%zu.allocation", block_idx);
|
||||||
"block.%zu.allocation", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (src->capacity &&
|
if (src->capacity)
|
||||||
virTypedParamListAddULLong(params, src->capacity,
|
virTypedParamListAddULLong(params, src->capacity, "block.%zu.capacity", block_idx);
|
||||||
"block.%zu.capacity", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (src->physical &&
|
if (src->physical)
|
||||||
virTypedParamListAddULLong(params, src->physical,
|
virTypedParamListAddULLong(params, src->physical, "block.%zu.physical", block_idx);
|
||||||
"block.%zu.physical", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -17330,24 +17242,16 @@ qemuDomainGetStatsOneBlock(virQEMUDriver *driver,
|
|||||||
if (!stats || !entryname || !(entry = virHashLookup(stats, entryname)))
|
if (!stats || !entryname || !(entry = virHashLookup(stats, entryname)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, entry->wr_highest_offset,
|
virTypedParamListAddULLong(params, entry->wr_highest_offset, "block.%zu.allocation", block_idx);
|
||||||
"block.%zu.allocation", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (entry->capacity &&
|
if (entry->capacity)
|
||||||
virTypedParamListAddULLong(params, entry->capacity,
|
virTypedParamListAddULLong(params, entry->capacity, "block.%zu.capacity", block_idx);
|
||||||
"block.%zu.capacity", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (entry->physical) {
|
if (entry->physical) {
|
||||||
if (virTypedParamListAddULLong(params, entry->physical,
|
virTypedParamListAddULLong(params, entry->physical, "block.%zu.physical", block_idx);
|
||||||
"block.%zu.physical", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
} else {
|
} else {
|
||||||
if (qemuDomainStorageUpdatePhysical(driver, cfg, dom, src) == 0) {
|
if (qemuDomainStorageUpdatePhysical(driver, cfg, dom, src) == 0) {
|
||||||
if (virTypedParamListAddULLong(params, src->physical,
|
virTypedParamListAddULLong(params, src->physical, "block.%zu.physical", block_idx);
|
||||||
"block.%zu.physical", block_idx) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17366,10 +17270,8 @@ qemuDomainGetStatsBlockExportBackendStorage(const char *entryname,
|
|||||||
if (!stats || !entryname || !(entry = virHashLookup(stats, entryname)))
|
if (!stats || !entryname || !(entry = virHashLookup(stats, entryname)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (entry->write_threshold &&
|
if (entry->write_threshold)
|
||||||
virTypedParamListAddULLong(params, entry->write_threshold,
|
virTypedParamListAddULLong(params, entry->write_threshold, "block.%zu.threshold", recordnr);
|
||||||
"block.%zu.threshold", recordnr) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -17389,15 +17291,14 @@ qemuDomainGetStatsBlockExportFrontend(const char *frontendname,
|
|||||||
if (!stats || !frontendname || !(en = virHashLookup(stats, frontendname)))
|
if (!stats || !frontendname || !(en = virHashLookup(stats, frontendname)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(par, en->rd_req, "block.%zu.rd.reqs", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->rd_req, "block.%zu.rd.reqs", idx);
|
||||||
virTypedParamListAddULLong(par, en->rd_bytes, "block.%zu.rd.bytes", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->rd_bytes, "block.%zu.rd.bytes", idx);
|
||||||
virTypedParamListAddULLong(par, en->rd_total_times, "block.%zu.rd.times", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->rd_total_times, "block.%zu.rd.times", idx);
|
||||||
virTypedParamListAddULLong(par, en->wr_req, "block.%zu.wr.reqs", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->wr_req, "block.%zu.wr.reqs", idx);
|
||||||
virTypedParamListAddULLong(par, en->wr_bytes, "block.%zu.wr.bytes", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->wr_bytes, "block.%zu.wr.bytes", idx);
|
||||||
virTypedParamListAddULLong(par, en->wr_total_times, "block.%zu.wr.times", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->wr_total_times, "block.%zu.wr.times", idx);
|
||||||
virTypedParamListAddULLong(par, en->flush_req, "block.%zu.fl.reqs", idx) < 0 ||
|
virTypedParamListAddULLong(par, en->flush_req, "block.%zu.fl.reqs", idx);
|
||||||
virTypedParamListAddULLong(par, en->flush_total_times, "block.%zu.fl.times", idx) < 0)
|
virTypedParamListAddULLong(par, en->flush_total_times, "block.%zu.fl.times", idx);
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -17409,16 +17310,13 @@ qemuDomainGetStatsBlockExportHeader(virDomainDiskDef *disk,
|
|||||||
size_t recordnr,
|
size_t recordnr,
|
||||||
virTypedParamList *params)
|
virTypedParamList *params)
|
||||||
{
|
{
|
||||||
if (virTypedParamListAddString(params, disk->dst, "block.%zu.name", recordnr) < 0)
|
virTypedParamListAddString(params, disk->dst, "block.%zu.name", recordnr);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virStorageSourceIsLocalStorage(src) && src->path &&
|
if (virStorageSourceIsLocalStorage(src) && src->path)
|
||||||
virTypedParamListAddString(params, src->path, "block.%zu.path", recordnr) < 0)
|
virTypedParamListAddString(params, src->path, "block.%zu.path", recordnr);
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (src->id &&
|
if (src->id)
|
||||||
virTypedParamListAddUInt(params, src->id, "block.%zu.backingIndex", recordnr) < 0)
|
virTypedParamListAddUInt(params, src->id, "block.%zu.backingIndex", recordnr);
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -17620,9 +17518,7 @@ qemuDomainGetStatsBlock(virQEMUDriver *driver,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, visited, "block.count") < 0)
|
virTypedParamListAddUInt(params, visited, "block.count");
|
||||||
return -1;
|
|
||||||
|
|
||||||
virTypedParamListConcat(params, &blockparams);
|
virTypedParamListConcat(params, &blockparams);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -17653,23 +17549,19 @@ qemuDomainGetStatsIOThread(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, niothreads, "iothread.count") < 0)
|
virTypedParamListAddUInt(params, niothreads, "iothread.count");
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
for (i = 0; i < niothreads; i++) {
|
for (i = 0; i < niothreads; i++) {
|
||||||
if (iothreads[i]->poll_valid) {
|
if (iothreads[i]->poll_valid) {
|
||||||
if (virTypedParamListAddULLong(params, iothreads[i]->poll_max_ns,
|
virTypedParamListAddULLong(params, iothreads[i]->poll_max_ns,
|
||||||
"iothread.%u.poll-max-ns",
|
"iothread.%u.poll-max-ns",
|
||||||
iothreads[i]->iothread_id) < 0)
|
iothreads[i]->iothread_id);
|
||||||
goto cleanup;
|
virTypedParamListAddUInt(params, iothreads[i]->poll_grow,
|
||||||
if (virTypedParamListAddUInt(params, iothreads[i]->poll_grow,
|
"iothread.%u.poll-grow",
|
||||||
"iothread.%u.poll-grow",
|
iothreads[i]->iothread_id);
|
||||||
iothreads[i]->iothread_id) < 0)
|
virTypedParamListAddUInt(params, iothreads[i]->poll_shrink,
|
||||||
goto cleanup;
|
"iothread.%u.poll-shrink",
|
||||||
if (virTypedParamListAddUInt(params, iothreads[i]->poll_shrink,
|
iothreads[i]->iothread_id);
|
||||||
"iothread.%u.poll-shrink",
|
|
||||||
iothreads[i]->iothread_id) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17694,9 +17586,7 @@ qemuDomainGetStatsPerfOneEvent(virPerf *perf,
|
|||||||
if (virPerfReadEvent(perf, type, &value) < 0)
|
if (virPerfReadEvent(perf, type, &value) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virTypedParamListAddULLong(params, value, "perf.%s",
|
virTypedParamListAddULLong(params, value, "perf.%s", virPerfEventTypeToString(type));
|
||||||
virPerfEventTypeToString(type)) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -17749,35 +17639,21 @@ qemuDomainGetStatsDirtyRate(virQEMUDriver *driver G_GNUC_UNUSED,
|
|||||||
if (qemuDomainGetStatsDirtyRateMon(dom, &info) < 0)
|
if (qemuDomainGetStatsDirtyRateMon(dom, &info) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virTypedParamListAddInt(params, info.status,
|
virTypedParamListAddInt(params, info.status, "dirtyrate.calc_status");
|
||||||
"dirtyrate.calc_status") < 0)
|
virTypedParamListAddLLong(params, info.startTime, "dirtyrate.calc_start_time");
|
||||||
return -1;
|
virTypedParamListAddInt(params, info.calcTime, "dirtyrate.calc_period");
|
||||||
|
virTypedParamListAddString(params, qemuMonitorDirtyRateCalcModeTypeToString(info.mode),
|
||||||
if (virTypedParamListAddLLong(params, info.startTime,
|
"dirtyrate.calc_mode");
|
||||||
"dirtyrate.calc_start_time") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddInt(params, info.calcTime,
|
|
||||||
"dirtyrate.calc_period") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (virTypedParamListAddString(params,
|
|
||||||
qemuMonitorDirtyRateCalcModeTypeToString(info.mode),
|
|
||||||
"dirtyrate.calc_mode") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (info.status == VIR_DOMAIN_DIRTYRATE_MEASURED) {
|
if (info.status == VIR_DOMAIN_DIRTYRATE_MEASURED) {
|
||||||
if (virTypedParamListAddLLong(params, info.dirtyRate,
|
virTypedParamListAddLLong(params, info.dirtyRate, "dirtyrate.megabytes_per_second");
|
||||||
"dirtyrate.megabytes_per_second") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (info.mode == QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_RING) {
|
if (info.mode == QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_RING) {
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < info.nvcpus; i++) {
|
for (i = 0; i < info.nvcpus; i++) {
|
||||||
if (virTypedParamListAddULLong(params, info.rates[i].value,
|
virTypedParamListAddULLong(params, info.rates[i].value,
|
||||||
"dirtyrate.vcpu.%d.megabytes_per_second",
|
"dirtyrate.vcpu.%d.megabytes_per_second",
|
||||||
info.rates[i].idx) < 0)
|
info.rates[i].idx);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9784,11 +9784,8 @@ static int
|
|||||||
testDomainGetStatsState(virDomainObj *dom,
|
testDomainGetStatsState(virDomainObj *dom,
|
||||||
virTypedParamList *params)
|
virTypedParamList *params)
|
||||||
{
|
{
|
||||||
if (virTypedParamListAddInt(params, dom->state.state, "state.state") < 0)
|
virTypedParamListAddInt(params, dom->state.state, "state.state");
|
||||||
return -1;
|
virTypedParamListAddInt(params, dom->state.reason, "state.reason");
|
||||||
|
|
||||||
if (virTypedParamListAddInt(params, dom->state.reason, "state.reason") < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -9810,24 +9807,17 @@ testDomainGetStatsIOThread(virDomainObj *dom,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virTypedParamListAddUInt(params, niothreads, "iothread.count") < 0)
|
virTypedParamListAddUInt(params, niothreads, "iothread.count");
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < niothreads; i++) {
|
for (i = 0; i < niothreads; i++) {
|
||||||
testIOThreadInfo iothread = g_array_index(priv->iothreads,
|
testIOThreadInfo iothread = g_array_index(priv->iothreads,
|
||||||
testIOThreadInfo, i);
|
testIOThreadInfo, i);
|
||||||
if (virTypedParamListAddULLong(params, iothread.poll_max_ns,
|
virTypedParamListAddULLong(params, iothread.poll_max_ns,
|
||||||
"iothread.%u.poll-max-ns",
|
"iothread.%u.poll-max-ns", iothread.iothread_id);
|
||||||
iothread.iothread_id) < 0)
|
virTypedParamListAddUInt(params, iothread.poll_grow,
|
||||||
return -1;
|
"iothread.%u.poll-grow", iothread.iothread_id);
|
||||||
if (virTypedParamListAddUInt(params, iothread.poll_grow,
|
virTypedParamListAddUInt(params, iothread.poll_shrink,
|
||||||
"iothread.%u.poll-grow",
|
"iothread.%u.poll-shrink", iothread.iothread_id);
|
||||||
iothread.iothread_id) < 0)
|
|
||||||
return -1;
|
|
||||||
if (virTypedParamListAddUInt(params, iothread.poll_shrink,
|
|
||||||
"iothread.%u.poll-shrink",
|
|
||||||
iothread.iothread_id) < 0)
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -852,7 +852,7 @@ virTypedParamListExtend(virTypedParamList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddInt(virTypedParamList *list,
|
virTypedParamListAddInt(virTypedParamList *list,
|
||||||
int value,
|
int value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -866,12 +866,10 @@ virTypedParamListAddInt(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddUInt(virTypedParamList *list,
|
virTypedParamListAddUInt(virTypedParamList *list,
|
||||||
unsigned int value,
|
unsigned int value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -885,12 +883,10 @@ virTypedParamListAddUInt(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddLLong(virTypedParamList *list,
|
virTypedParamListAddLLong(virTypedParamList *list,
|
||||||
long long value,
|
long long value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -904,12 +900,10 @@ virTypedParamListAddLLong(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddULLong(virTypedParamList *list,
|
virTypedParamListAddULLong(virTypedParamList *list,
|
||||||
unsigned long long value,
|
unsigned long long value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -923,12 +917,10 @@ virTypedParamListAddULLong(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddString(virTypedParamList *list,
|
virTypedParamListAddString(virTypedParamList *list,
|
||||||
const char *value,
|
const char *value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -942,12 +934,10 @@ virTypedParamListAddString(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddBoolean(virTypedParamList *list,
|
virTypedParamListAddBoolean(virTypedParamList *list,
|
||||||
bool value,
|
bool value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -961,12 +951,10 @@ virTypedParamListAddBoolean(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddDouble(virTypedParamList *list,
|
virTypedParamListAddDouble(virTypedParamList *list,
|
||||||
double value,
|
double value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
@ -980,6 +968,4 @@ virTypedParamListAddDouble(virTypedParamList *list,
|
|||||||
va_start(ap, namefmt);
|
va_start(ap, namefmt);
|
||||||
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
virTypedParamSetNameVPrintf(list, par, namefmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -162,45 +162,45 @@ void
|
|||||||
virTypedParamListConcat(virTypedParamList *to,
|
virTypedParamListConcat(virTypedParamList *to,
|
||||||
virTypedParamList **fromptr);
|
virTypedParamList **fromptr);
|
||||||
|
|
||||||
int
|
void
|
||||||
virTypedParamListAddInt(virTypedParamList *list,
|
virTypedParamListAddInt(virTypedParamList *list,
|
||||||
int value,
|
int value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
int
|
void
|
||||||
virTypedParamListAddUInt(virTypedParamList *list,
|
virTypedParamListAddUInt(virTypedParamList *list,
|
||||||
unsigned int value,
|
unsigned int value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
int
|
void
|
||||||
virTypedParamListAddLLong(virTypedParamList *list,
|
virTypedParamListAddLLong(virTypedParamList *list,
|
||||||
long long value,
|
long long value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
int
|
void
|
||||||
virTypedParamListAddULLong(virTypedParamList *list,
|
virTypedParamListAddULLong(virTypedParamList *list,
|
||||||
unsigned long long value,
|
unsigned long long value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
int
|
void
|
||||||
virTypedParamListAddString(virTypedParamList *list,
|
virTypedParamListAddString(virTypedParamList *list,
|
||||||
const char *value,
|
const char *value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
int
|
void
|
||||||
virTypedParamListAddBoolean(virTypedParamList *list,
|
virTypedParamListAddBoolean(virTypedParamList *list,
|
||||||
bool value,
|
bool value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
int
|
void
|
||||||
virTypedParamListAddDouble(virTypedParamList *list,
|
virTypedParamListAddDouble(virTypedParamList *list,
|
||||||
double value,
|
double value,
|
||||||
const char *namefmt,
|
const char *namefmt,
|
||||||
...)
|
...)
|
||||||
G_GNUC_PRINTF(3, 4) G_GNUC_WARN_UNUSED_RESULT;
|
G_GNUC_PRINTF(3, 4);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user