mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +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)))
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainGetPerfEvents(dom, ¶ms, &nparams) < 0)
|
||||
if (virDomainGetPerfEvents(dom, ¶ms, &nparams, args->flags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
|
||||
|
@ -1848,10 +1848,12 @@ void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats);
|
||||
|
||||
int virDomainGetPerfEvents(virDomainPtr dom,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams);
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
int virDomainSetPerfEvents(virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int nparams);
|
||||
int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
/*
|
||||
* BlockJob API
|
||||
|
@ -964,12 +964,14 @@ typedef int
|
||||
typedef int
|
||||
(*virDrvDomainGetPerfEvents)(virDomainPtr dom,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams);
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainSetPerfEvents)(virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int nparams);
|
||||
int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainBlockJobAbort)(virDomainPtr dom,
|
||||
|
@ -9695,6 +9695,7 @@ virDomainOpenChannel(virDomainPtr dom,
|
||||
* @domain: a domain object
|
||||
* @params: where to store perf events setting
|
||||
* @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
|
||||
* defined by VIR_DOMAIN_PERF_* macros and new fields will likely be
|
||||
@ -9704,12 +9705,13 @@ virDomainOpenChannel(virDomainPtr dom,
|
||||
*/
|
||||
int virDomainGetPerfEvents(virDomainPtr domain,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams)
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%p",
|
||||
params, nparams);
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%p flags=%x",
|
||||
params, nparams, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
@ -9721,7 +9723,8 @@ int virDomainGetPerfEvents(virDomainPtr domain,
|
||||
|
||||
if (conn->driver->domainGetPerfEvents) {
|
||||
int ret;
|
||||
ret = conn->driver->domainGetPerfEvents(domain, params, nparams);
|
||||
ret = conn->driver->domainGetPerfEvents(domain, params,
|
||||
nparams, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
@ -9740,6 +9743,7 @@ int virDomainGetPerfEvents(virDomainPtr domain,
|
||||
* @params: pointer to perf events parameter object
|
||||
* @nparams: number of perf event parameters (this value can be the same
|
||||
* 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.
|
||||
*
|
||||
@ -9747,12 +9751,13 @@ int virDomainGetPerfEvents(virDomainPtr domain,
|
||||
*/
|
||||
int virDomainSetPerfEvents(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams)
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d",
|
||||
params, nparams);
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d flags=%x",
|
||||
params, nparams, flags);
|
||||
VIR_TYPED_PARAMS_DEBUG(params, nparams);
|
||||
|
||||
virResetLastError();
|
||||
@ -9769,7 +9774,8 @@ int virDomainSetPerfEvents(virDomainPtr domain,
|
||||
|
||||
if (conn->driver->domainSetPerfEvents) {
|
||||
int ret;
|
||||
ret = conn->driver->domainSetPerfEvents(domain, params, nparams);
|
||||
ret = conn->driver->domainSetPerfEvents(domain, params,
|
||||
nparams, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
|
@ -10040,7 +10040,8 @@ qemuSetGlobalBWLive(virCgroupPtr cgroup, unsigned long long period,
|
||||
static int
|
||||
qemuDomainSetPerfEvents(virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int nparams)
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||
size_t i;
|
||||
@ -10049,11 +10050,12 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
virDomainDefPtr def;
|
||||
virDomainDefPtr persistentDef;
|
||||
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
int ret = -1;
|
||||
virPerfEventType type;
|
||||
bool enabled;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (virTypedParamsValidate(params, nparams, VIR_PERF_PARAMETERS) < 0)
|
||||
return -1;
|
||||
|
||||
@ -10107,7 +10109,8 @@ qemuDomainSetPerfEvents(virDomainPtr dom,
|
||||
static int
|
||||
qemuDomainGetPerfEvents(virDomainPtr dom,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams)
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
size_t i;
|
||||
virDomainObjPtr vm = NULL;
|
||||
@ -10117,6 +10120,8 @@ qemuDomainGetPerfEvents(virDomainPtr dom,
|
||||
int maxpar = 0;
|
||||
int npar = 0;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
|
@ -1819,7 +1819,8 @@ remoteDomainGetNumaParameters(virDomainPtr domain,
|
||||
static int
|
||||
remoteDomainGetPerfEvents(virDomainPtr domain,
|
||||
virTypedParameterPtr *params,
|
||||
int *nparams)
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
int rv = -1;
|
||||
remote_domain_get_perf_events_args args;
|
||||
@ -1829,6 +1830,7 @@ remoteDomainGetPerfEvents(virDomainPtr domain,
|
||||
remoteDriverLock(priv);
|
||||
|
||||
make_nonnull_domain(&args.dom, domain);
|
||||
args.flags = flags;
|
||||
|
||||
memset(&ret, 0, sizeof(ret));
|
||||
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 {
|
||||
remote_nonnull_domain dom;
|
||||
remote_typed_param params<REMOTE_DOMAIN_PERF_EVENTS_MAX>;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_get_perf_events_args {
|
||||
remote_nonnull_domain dom;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct remote_domain_get_perf_events_ret {
|
||||
|
@ -8610,6 +8610,7 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
||||
virTypedParameterPtr params = NULL;
|
||||
bool ret = false;
|
||||
const char *enable = NULL, *disable = NULL;
|
||||
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
|
||||
|
||||
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
|
||||
return false;
|
||||
@ -8627,7 +8628,7 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
||||
goto cleanup;
|
||||
|
||||
if (nparams == 0) {
|
||||
if (virDomainGetPerfEvents(dom, ¶ms, &nparams) != 0) {
|
||||
if (virDomainGetPerfEvents(dom, ¶ms, &nparams, flags) != 0) {
|
||||
vshError(ctl, "%s", _("Unable to get perf events"));
|
||||
goto cleanup;
|
||||
}
|
||||
@ -8640,7 +8641,7 @@ cmdPerf(vshControl *ctl, const vshCmd *cmd)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (virDomainSetPerfEvents(dom, params, nparams) != 0)
|
||||
if (virDomainSetPerfEvents(dom, params, nparams, flags) != 0)
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user