mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
virDomain{Get,Set}PerfEvents: Add @flags argument
I've noticed that these APIs are missing @flags argument. Even though we don't have a use for them, it's our policy that every new API must have @flags. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
46a5d1938e
commit
3b6c818532
@ -2694,7 +2694,7 @@ remoteDispatchDomainGetPerfEvents(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainGetPerfEvents(dom, ¶ms, &nparams) < 0)
|
if (virDomainGetPerfEvents(dom, ¶ms, &nparams, args->flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
|
if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
|
||||||
|
@ -1848,10 +1848,12 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
|
|||||||
|
|
||||||
int virDomainGetPerfEvents(virDomainPtr dom,
|
int virDomainGetPerfEvents(virDomainPtr dom,
|
||||||
virTypedParameterPtr *params,
|
virTypedParameterPtr *params,
|
||||||
int *nparams);
|
int *nparams,
|
||||||
|
unsigned int flags);
|
||||||
int virDomainSetPerfEvents(virDomainPtr dom,
|
int virDomainSetPerfEvents(virDomainPtr dom,
|
||||||
virTypedParameterPtr params,
|
virTypedParameterPtr params,
|
||||||
int nparams);
|
int nparams,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* BlockJob API
|
* BlockJob API
|
||||||
|
@ -964,12 +964,14 @@ typedef int
|
|||||||
typedef int
|
typedef int
|
||||||
(*virDrvDomainGetPerfEvents)(virDomainPtr dom,
|
(*virDrvDomainGetPerfEvents)(virDomainPtr dom,
|
||||||
virTypedParameterPtr *params,
|
virTypedParameterPtr *params,
|
||||||
int *nparams);
|
int *nparams,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*virDrvDomainSetPerfEvents)(virDomainPtr dom,
|
(*virDrvDomainSetPerfEvents)(virDomainPtr dom,
|
||||||
virTypedParameterPtr params,
|
virTypedParameterPtr params,
|
||||||
int nparams);
|
int nparams,
|
||||||
|
unsigned int flags);
|
||||||
|
|
||||||
typedef int
|
typedef int
|
||||||
(*virDrvDomainBlockJobAbort)(virDomainPtr dom,
|
(*virDrvDomainBlockJobAbort)(virDomainPtr dom,
|
||||||
|
@ -9695,6 +9695,7 @@ virDomainOpenChannel(virDomainPtr dom,
|
|||||||
* @domain: a domain object
|
* @domain: a domain object
|
||||||
* @params: where to store perf events setting
|
* @params: where to store perf events setting
|
||||||
* @nparams: number of items in @params
|
* @nparams: number of items in @params
|
||||||
|
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||||
*
|
*
|
||||||
* Get all perf events setting. Possible fields returned in @params are
|
* Get all perf events setting. Possible fields returned in @params are
|
||||||
* defined by VIR_DOMAIN_PERF_* macros and new fields will likely be
|
* defined by VIR_DOMAIN_PERF_* macros and new fields will likely be
|
||||||
@ -9704,12 +9705,13 @@ virDomainOpenChannel(virDomainPtr dom,
|
|||||||
*/
|
*/
|
||||||
int virDomainGetPerfEvents(virDomainPtr domain,
|
int virDomainGetPerfEvents(virDomainPtr domain,
|
||||||
virTypedParameterPtr *params,
|
virTypedParameterPtr *params,
|
||||||
int *nparams)
|
int *nparams,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
|
|
||||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%p",
|
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%p flags=%x",
|
||||||
params, nparams);
|
params, nparams, flags);
|
||||||
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
|
|
||||||
@ -9721,7 +9723,8 @@ int virDomainGetPerfEvents(virDomainPtr domain,
|
|||||||
|
|
||||||
if (conn->driver->domainGetPerfEvents) {
|
if (conn->driver->domainGetPerfEvents) {
|
||||||
int ret;
|
int ret;
|
||||||
ret = conn->driver->domainGetPerfEvents(domain, params, nparams);
|
ret = conn->driver->domainGetPerfEvents(domain, params,
|
||||||
|
nparams, flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
return ret;
|
return ret;
|
||||||
@ -9740,6 +9743,7 @@ int virDomainGetPerfEvents(virDomainPtr domain,
|
|||||||
* @params: pointer to perf events parameter object
|
* @params: pointer to perf events parameter object
|
||||||
* @nparams: number of perf event parameters (this value can be the same
|
* @nparams: number of perf event parameters (this value can be the same
|
||||||
* less than the number of parameters supported)
|
* less than the number of parameters supported)
|
||||||
|
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||||
*
|
*
|
||||||
* Enable or disable the particular list of perf events you care about.
|
* Enable or disable the particular list of perf events you care about.
|
||||||
*
|
*
|
||||||
@ -9747,12 +9751,13 @@ int virDomainGetPerfEvents(virDomainPtr domain,
|
|||||||
*/
|
*/
|
||||||
int virDomainSetPerfEvents(virDomainPtr domain,
|
int virDomainSetPerfEvents(virDomainPtr domain,
|
||||||
virTypedParameterPtr params,
|
virTypedParameterPtr params,
|
||||||
int nparams)
|
int nparams,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virConnectPtr conn;
|
virConnectPtr conn;
|
||||||
|
|
||||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d",
|
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d flags=%x",
|
||||||
params, nparams);
|
params, nparams, flags);
|
||||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||||
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
@ -9769,7 +9774,8 @@ int virDomainSetPerfEvents(virDomainPtr domain,
|
|||||||
|
|
||||||
if (conn->driver->domainSetPerfEvents) {
|
if (conn->driver->domainSetPerfEvents) {
|
||||||
int ret;
|
int ret;
|
||||||
ret = conn->driver->domainSetPerfEvents(domain, params, nparams);
|
ret = conn->driver->domainSetPerfEvents(domain, params,
|
||||||
|
nparams, flags);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -10040,7 +10040,8 @@ qemuSetGlobalBWLive(virCgroupPtr cgroup, unsigned long long period,
|
|||||||
static int
|
static int
|
||||||
qemuDomainSetPerfEvents(virDomainPtr dom,
|
qemuDomainSetPerfEvents(virDomainPtr dom,
|
||||||
virTypedParameterPtr params,
|
virTypedParameterPtr params,
|
||||||
int nparams)
|
int nparams,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||||
size_t i;
|
size_t i;
|
||||||
@ -10049,11 +10050,12 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
|
|||||||
qemuDomainObjPrivatePtr priv;
|
qemuDomainObjPrivatePtr priv;
|
||||||
virDomainDefPtr def;
|
virDomainDefPtr def;
|
||||||
virDomainDefPtr persistentDef;
|
virDomainDefPtr persistentDef;
|
||||||
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virPerfEventType type;
|
virPerfEventType type;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (virTypedParamsValidate(params, nparams, VIR_PERF_PARAMETERS) < 0)
|
if (virTypedParamsValidate(params, nparams, VIR_PERF_PARAMETERS) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -10107,7 +10109,8 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
|
|||||||
static int
|
static int
|
||||||
qemuDomainGetPerfEvents(virDomainPtr dom,
|
qemuDomainGetPerfEvents(virDomainPtr dom,
|
||||||
virTypedParameterPtr *params,
|
virTypedParameterPtr *params,
|
||||||
int *nparams)
|
int *nparams,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
@ -10117,6 +10120,8 @@ qemuDomainGetPerfEvents(virDomainPtr dom,
|
|||||||
int maxpar = 0;
|
int maxpar = 0;
|
||||||
int npar = 0;
|
int npar = 0;
|
||||||
|
|
||||||
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
@ -1819,7 +1819,8 @@ remoteDomainGetNumaParameters(virDomainPtr domain,
|
|||||||
static int
|
static int
|
||||||
remoteDomainGetPerfEvents(virDomainPtr domain,
|
remoteDomainGetPerfEvents(virDomainPtr domain,
|
||||||
virTypedParameterPtr *params,
|
virTypedParameterPtr *params,
|
||||||
int *nparams)
|
int *nparams,
|
||||||
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
int rv = -1;
|
int rv = -1;
|
||||||
remote_domain_get_perf_events_args args;
|
remote_domain_get_perf_events_args args;
|
||||||
@ -1829,6 +1830,7 @@ remoteDomainGetPerfEvents(virDomainPtr domain,
|
|||||||
remoteDriverLock(priv);
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
make_nonnull_domain(&args.dom, domain);
|
make_nonnull_domain(&args.dom, domain);
|
||||||
|
args.flags = flags;
|
||||||
|
|
||||||
memset(&ret, 0, sizeof(ret));
|
memset(&ret, 0, sizeof(ret));
|
||||||
if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_PERF_EVENTS,
|
if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_PERF_EVENTS,
|
||||||
|
@ -634,10 +634,12 @@ struct remote_domain_get_numa_parameters_ret {
|
|||||||
struct remote_domain_set_perf_events_args {
|
struct remote_domain_set_perf_events_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
remote_typed_param params<REMOTE_DOMAIN_PERF_EVENTS_MAX>;
|
remote_typed_param params<REMOTE_DOMAIN_PERF_EVENTS_MAX>;
|
||||||
|
unsigned int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct remote_domain_get_perf_events_args {
|
struct remote_domain_get_perf_events_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
|
unsigned int flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct remote_domain_get_perf_events_ret {
|
struct remote_domain_get_perf_events_ret {
|
||||||
|
@ -8610,6 +8610,7 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virTypedParameterPtr params = NULL;
|
virTypedParameterPtr params = NULL;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
const char *enable = NULL, *disable = NULL;
|
const char *enable = NULL, *disable = NULL;
|
||||||
|
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||||
|
|
||||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return false;
|
return false;
|
||||||
@ -8627,7 +8628,7 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (nparams == 0) {
|
if (nparams == 0) {
|
||||||
if (virDomainGetPerfEvents(dom, ¶ms, &nparams) != 0) {
|
if (virDomainGetPerfEvents(dom, ¶ms, &nparams, flags) != 0) {
|
||||||
vshError(ctl, "%s", _("Unable to get perf events"));
|
vshError(ctl, "%s", _("Unable to get perf events"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -8640,7 +8641,7 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (virDomainSetPerfEvents(dom, params, nparams) != 0)
|
if (virDomainSetPerfEvents(dom, params, nparams, flags) != 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user