mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
test_driver: Introduce testIOThreadInfo and generate IOThread infos
Introduce testIOThreadInfo to store IOThread infos: iothread_id, poll_max_ns, poll_grow and poll_shrink for future usage. Add an example of IOThread configuration to testdomfc4.xml, we also want to generate default testIOThreadInfo for the IOThread configured in the xml, so introduce testDomainGenerateIOThreadInfos, the values are taken from QEMU. Signed-off-by: Luke Yue <lukedyue@gmail.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
cb3033776f
commit
6650d14f6c
@ -11,6 +11,11 @@
|
||||
<memory>261072</memory>
|
||||
<currentMemory>131072</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<iothreads>2</iothreads>
|
||||
<iothreadids>
|
||||
<iothread id="2"/>
|
||||
<iothread id="4"/>
|
||||
</iothreadids>
|
||||
<devices>
|
||||
<disk type='file'>
|
||||
<source file='/u/fc4.img'/>
|
||||
|
@ -183,6 +183,14 @@ struct _testDomainNamespaceDef {
|
||||
xmlNodePtr *snap_nodes;
|
||||
};
|
||||
|
||||
typedef struct _testIOThreadInfo testIOThreadInfo;
|
||||
struct _testIOThreadInfo {
|
||||
unsigned int iothread_id;
|
||||
unsigned long long poll_max_ns;
|
||||
unsigned int poll_grow;
|
||||
unsigned int poll_shrink;
|
||||
};
|
||||
|
||||
static void
|
||||
testDomainDefNamespaceFree(void *data)
|
||||
{
|
||||
@ -381,6 +389,9 @@ struct _testDomainObjPrivate {
|
||||
/* used by get/set time APIs */
|
||||
long long seconds;
|
||||
unsigned int nseconds;
|
||||
|
||||
/* used by IOThread APIs */
|
||||
GArray *iothreads;
|
||||
};
|
||||
|
||||
|
||||
@ -397,6 +408,8 @@ testDomainObjPrivateAlloc(void *opaque)
|
||||
priv->seconds = 627319920;
|
||||
priv->nseconds = 0;
|
||||
|
||||
priv->iothreads = g_array_new(FALSE, FALSE, sizeof(testIOThreadInfo));
|
||||
|
||||
return priv;
|
||||
}
|
||||
|
||||
@ -427,6 +440,8 @@ static void
|
||||
testDomainObjPrivateFree(void *data)
|
||||
{
|
||||
testDomainObjPrivate *priv = data;
|
||||
|
||||
g_array_free(priv->iothreads, TRUE);
|
||||
g_free(priv);
|
||||
}
|
||||
|
||||
@ -696,6 +711,26 @@ testDomainGenerateIfnames(virDomainDef *domdef)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
testDomainGenerateIOThreadInfos(virDomainObj *obj)
|
||||
{
|
||||
size_t i;
|
||||
testDomainObjPrivate *priv;
|
||||
|
||||
if (!obj->def->iothreadids || !obj->def->niothreadids)
|
||||
return;
|
||||
|
||||
priv = obj->privateData;
|
||||
|
||||
for (i = 0; i < obj->def->niothreadids; i++) {
|
||||
testIOThreadInfo iothread;
|
||||
iothread.iothread_id = obj->def->iothreadids[i]->iothread_id;
|
||||
iothread.poll_max_ns = 32768;
|
||||
iothread.poll_grow = 0;
|
||||
iothread.poll_shrink = 0;
|
||||
g_array_append_val(priv->iothreads, iothread);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
testDomainShutdownState(virDomainPtr domain,
|
||||
@ -1045,6 +1080,8 @@ testParseDomains(testDriver *privconn,
|
||||
|
||||
testDomainObjCheckTaint(obj);
|
||||
|
||||
testDomainGenerateIOThreadInfos(obj);
|
||||
|
||||
virDomainObjEndAPI(&obj);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user