提交 b3908d2e 编写于 作者: I Ilias Stamatis 提交者: Ján Tomko

test_driver: implement virDomainMemoryPeek

Begins by writing a @start byte in the first position of @buffer and
then for every next byte it stores the value of its previous one
incremented by one.

Behaves the same for both supported flags.
Signed-off-by: NIlias Stamatis <stamatis.iliass@gmail.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 f8c73457
......@@ -6072,6 +6072,42 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
return 0;
}
static int
testDomainMemoryPeek(virDomainPtr dom,
unsigned long long start,
size_t size,
void *buffer,
unsigned int flags)
{
int ret = -1;
size_t i;
unsigned char b = start;
virDomainObjPtr vm = NULL;
virCheckFlags(VIR_MEMORY_VIRTUAL | VIR_MEMORY_PHYSICAL, -1);
if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
virReportError(VIR_ERR_INVALID_ARG,
"%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
goto cleanup;
}
if (!(vm = testDomObjFromDomain(dom)))
goto cleanup;
if (virDomainObjCheckActive(vm) < 0)
goto cleanup;
for (i = 0; i < size; i++)
((unsigned char *) buffer)[i] = b++;
ret = 0;
cleanup:
virDomainObjEndAPI(&vm);
return ret;
}
/*
* Snapshot APIs
......@@ -6970,6 +7006,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainManagedSave = testDomainManagedSave, /* 1.1.4 */
.domainHasManagedSaveImage = testDomainHasManagedSaveImage, /* 1.1.4 */
.domainManagedSaveRemove = testDomainManagedSaveRemove, /* 1.1.4 */
.domainMemoryPeek = testDomainMemoryPeek, /* 5.4.0 */
.domainSnapshotNum = testDomainSnapshotNum, /* 1.1.4 */
.domainSnapshotListNames = testDomainSnapshotListNames, /* 1.1.4 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册