提交 e1bafb00 编写于 作者: M Martin Kletzander

qemu_cgroup: Remove unnecessary virQEMUDriverPtr arguments

Since commit 2e6ecba1, the pointer to the qemu driver is saved in
domain object's private data and hence does not have to be passed as
yet another parameter if domain object is already one of them.

This is a first (example) patch of this kind of clean up, others will
hopefully follow.
Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 a54c9622
......@@ -604,8 +604,7 @@ qemuTeardownChardevCgroup(virDomainObjPtr vm,
static int
qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm)
qemuSetupDevicesCgroup(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = NULL;
......@@ -644,7 +643,7 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
if (rv < 0)
goto cleanup;
cfg = virQEMUDriverGetConfig(driver);
cfg = virQEMUDriverGetConfig(priv->driver);
deviceACL = cfg->cgroupDeviceACL ?
(const char *const *)cfg->cgroupDeviceACL :
defaultDeviceACL;
......@@ -769,8 +768,7 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm)
static int
qemuSetupCpuCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm)
qemuSetupCpuCgroup(virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectEventPtr event = NULL;
......@@ -806,7 +804,7 @@ qemuSetupCpuCgroup(virQEMUDriverPtr driver,
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
}
qemuDomainEventQueue(driver, event);
qemuDomainEventQueue(priv->driver, event);
}
return 0;
......@@ -814,16 +812,15 @@ qemuSetupCpuCgroup(virQEMUDriverPtr driver,
static int
qemuInitCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuInitCgroup(virDomainObjPtr vm,
size_t nnicindexes,
int *nicindexes)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(priv->driver);
if (!virQEMUDriverIsPrivileged(driver))
if (!virQEMUDriverIsPrivileged(priv->driver))
goto done;
if (!virCgroupAvailable())
......@@ -954,14 +951,13 @@ qemuRestoreCgroupState(virDomainObjPtr vm)
}
int
qemuConnectCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm)
qemuConnectCgroup(virDomainObjPtr vm)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(priv->driver);
int ret = -1;
if (!virQEMUDriverIsPrivileged(driver))
if (!virQEMUDriverIsPrivileged(priv->driver))
goto done;
if (!virCgroupAvailable())
......@@ -991,8 +987,7 @@ qemuConnectCgroup(virQEMUDriverPtr driver,
}
int
qemuSetupCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuSetupCgroup(virDomainObjPtr vm,
size_t nnicindexes,
int *nicindexes)
{
......@@ -1005,13 +1000,13 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
return -1;
}
if (qemuInitCgroup(driver, vm, nnicindexes, nicindexes) < 0)
if (qemuInitCgroup(vm, nnicindexes, nicindexes) < 0)
return -1;
if (!priv->cgroup)
return 0;
if (qemuSetupDevicesCgroup(driver, vm) < 0)
if (qemuSetupDevicesCgroup(vm) < 0)
goto cleanup;
if (qemuSetupBlkioCgroup(vm) < 0)
......@@ -1020,7 +1015,7 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
if (qemuSetupMemoryCgroup(vm) < 0)
goto cleanup;
if (qemuSetupCpuCgroup(driver, vm) < 0)
if (qemuSetupCpuCgroup(vm) < 0)
goto cleanup;
if (qemuSetupCpusetCgroup(vm) < 0)
......
......@@ -55,10 +55,8 @@ int qemuSetupChardevCgroup(virDomainObjPtr vm,
virDomainChrDefPtr dev);
int qemuTeardownChardevCgroup(virDomainObjPtr vm,
virDomainChrDefPtr dev);
int qemuConnectCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm);
int qemuSetupCgroup(virQEMUDriverPtr driver,
virDomainObjPtr vm,
int qemuConnectCgroup(virDomainObjPtr vm);
int qemuSetupCgroup(virDomainObjPtr vm,
size_t nnicindexes,
int *nicindexes);
int qemuSetupCpusetMems(virDomainObjPtr vm);
......
......@@ -5594,7 +5594,7 @@ qemuProcessLaunch(virConnectPtr conn,
}
VIR_DEBUG("Setting up domain cgroup (if required)");
if (qemuSetupCgroup(driver, vm, nnicindexes, nicindexes) < 0)
if (qemuSetupCgroup(vm, nnicindexes, nicindexes) < 0)
goto cleanup;
if (!(priv->perf = virPerfNew()))
......@@ -6819,7 +6819,7 @@ qemuProcessReconnect(void *opaque)
if (qemuHostdevUpdateActiveDomainDevices(driver, obj->def) < 0)
goto error;
if (qemuConnectCgroup(driver, obj) < 0)
if (qemuConnectCgroup(obj) < 0)
goto error;
if (qemuDomainPerfRestart(obj) < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册