static void
-virDomainCachetuneDefFree(virDomainCachetuneDefPtr cachetune)
+virDomainResctrlDefFree(virDomainResctrlDefPtr resctrl)
{
- if (!cachetune)
+ if (!resctrl)
return;
- virObjectUnref(cachetune->alloc);
- virBitmapFree(cachetune->vcpus);
- VIR_FREE(cachetune);
+ virObjectUnref(resctrl->alloc);
+ virBitmapFree(resctrl->vcpus);
+ VIR_FREE(resctrl);
}
virDomainShmemDefFree(def->shmems[i]);
VIR_FREE(def->shmems);
- for (i = 0; i < def->ncachetunes; i++)
- virDomainCachetuneDefFree(def->cachetunes[i]);
- VIR_FREE(def->cachetunes);
+ for (i = 0; i < def->nresctrls; i++)
+ virDomainResctrlDefFree(def->resctrls[i]);
+ VIR_FREE(def->resctrls);
VIR_FREE(def->keywrap);
xmlNodePtr *nodes = NULL;
virBitmapPtr vcpus = NULL;
virResctrlAllocPtr alloc = virResctrlAllocNew();
- virDomainCachetuneDefPtr tmp_cachetune = NULL;
+ virDomainResctrlDefPtr tmp_resctrl = NULL;
char *tmp = NULL;
char *vcpus_str = NULL;
char *alloc_id = NULL;
if (!alloc)
goto cleanup;
- if (VIR_ALLOC(tmp_cachetune) < 0)
+ if (VIR_ALLOC(tmp_resctrl) < 0)
goto cleanup;
vcpus_str = virXMLPropString(node, "vcpus");
goto cleanup;
}
- for (i = 0; i < def->ncachetunes; i++) {
- if (virBitmapOverlaps(def->cachetunes[i]->vcpus, vcpus)) {
+ for (i = 0; i < def->nresctrls; i++) {
+ if (virBitmapOverlaps(def->resctrls[i]->vcpus, vcpus)) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("Overlapping vcpus in cachetunes"));
goto cleanup;
if (virResctrlAllocSetID(alloc, alloc_id) < 0)
goto cleanup;
- VIR_STEAL_PTR(tmp_cachetune->vcpus, vcpus);
- VIR_STEAL_PTR(tmp_cachetune->alloc, alloc);
+ VIR_STEAL_PTR(tmp_resctrl->vcpus, vcpus);
+ VIR_STEAL_PTR(tmp_resctrl->alloc, alloc);
- if (VIR_APPEND_ELEMENT(def->cachetunes, def->ncachetunes, tmp_cachetune) < 0)
+ if (VIR_APPEND_ELEMENT(def->resctrls, def->nresctrls, tmp_resctrl) < 0)
goto cleanup;
ret = 0;
cleanup:
ctxt->node = oldnode;
- virDomainCachetuneDefFree(tmp_cachetune);
+ virDomainResctrlDefFree(tmp_resctrl);
virObjectUnref(alloc);
virBitmapFree(vcpus);
VIR_FREE(alloc_id);
static int
virDomainCachetuneDefFormat(virBufferPtr buf,
- virDomainCachetuneDefPtr cachetune,
+ virDomainResctrlDefPtr resctrl,
unsigned int flags)
{
virBuffer childrenBuf = VIR_BUFFER_INITIALIZER;
int ret = -1;
virBufferSetChildIndent(&childrenBuf, buf);
- virResctrlAllocForeachCache(cachetune->alloc,
+ virResctrlAllocForeachCache(resctrl->alloc,
virDomainCachetuneDefFormatHelper,
&childrenBuf);
goto cleanup;
}
- vcpus = virBitmapFormat(cachetune->vcpus);
+ vcpus = virBitmapFormat(resctrl->vcpus);
if (!vcpus)
goto cleanup;
virBufferAsprintf(buf, "<cachetune vcpus='%s'", vcpus);
if (!(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) {
- const char *alloc_id = virResctrlAllocGetID(cachetune->alloc);
+ const char *alloc_id = virResctrlAllocGetID(resctrl->alloc);
if (!alloc_id)
goto cleanup;
def->iothreadids[i]->iothread_id);
}
- for (i = 0; i < def->ncachetunes; i++)
- virDomainCachetuneDefFormat(&childrenBuf, def->cachetunes[i], flags);
+ for (i = 0; i < def->nresctrls; i++)
+ virDomainCachetuneDefFormat(&childrenBuf, def->resctrls[i], flags);
if (virBufferCheckError(&childrenBuf) < 0)
return -1;
virCapsPtr caps = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
- if (!vm->def->ncachetunes)
+ if (!vm->def->nresctrls)
return 0;
/* Force capability refresh since resctrl info can change
if (!caps)
return -1;
- for (i = 0; i < vm->def->ncachetunes; i++) {
+ for (i = 0; i < vm->def->nresctrls; i++) {
if (virResctrlAllocCreate(caps->host.resctrl,
- vm->def->cachetunes[i]->alloc,
+ vm->def->resctrls[i]->alloc,
priv->machineName) < 0)
goto cleanup;
}
&vcpu->sched) < 0)
return -1;
- for (i = 0; i < vm->def->ncachetunes; i++) {
- virDomainCachetuneDefPtr ct = vm->def->cachetunes[i];
+ for (i = 0; i < vm->def->nresctrls; i++) {
+ virDomainResctrlDefPtr ct = vm->def->resctrls[i];
if (virBitmapIsBitSet(ct->vcpus, vcpuid)) {
if (virResctrlAllocAddPID(ct->alloc, vcpupid) < 0)
/* Remove resctrl allocation after cgroups are cleaned up which makes it
* kind of safer (although removing the allocation should work even with
* pids in tasks file */
- for (i = 0; i < vm->def->ncachetunes; i++)
- virResctrlAllocRemove(vm->def->cachetunes[i]->alloc);
+ for (i = 0; i < vm->def->nresctrls; i++)
+ virResctrlAllocRemove(vm->def->resctrls[i]->alloc);
qemuProcessRemoveDomainStatus(driver, vm);
if (qemuConnectAgent(driver, obj) < 0)
goto error;
- for (i = 0; i < obj->def->ncachetunes; i++) {
- if (virResctrlAllocDeterminePath(obj->def->cachetunes[i]->alloc,
+ for (i = 0; i < obj->def->nresctrls; i++) {
+ if (virResctrlAllocDeterminePath(obj->def->resctrls[i]->alloc,
priv->machineName) < 0)
goto error;
}