1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-10-29 16:25:07 +03:00

python: Expose blockPeek and memoryPeek in Python binding

A simple example to show how to use it:

\#! /usr/bin/python

import os
import sys
import libvirt

disk = "/var/lib/libvirt/images/test.img"

conn = libvirt.open(None)
dom = conn.lookupByName('test')

mem_contents = dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_VIRTUAL);
sys.stdout.write(mem_contents)

% python test.py | hexdump
0000000 1660 0209 0000 0000 0000 0000 0000 0000
0000010 0000 0000 0000 0000 d3a0 01d0 0000 0000
0000020
This commit is contained in:
Osier Yang
2011-12-15 21:01:33 +08:00
parent 6948b725e7
commit d758e0cb64
3 changed files with 91 additions and 0 deletions

View File

@@ -405,5 +405,22 @@
<arg name='flags' type='unsigned int' info='an OR&apos;ed set of virDomainModificationImpact'/>
<return type='int' info='0 in case of success, -1 in case of failure'/>
</function>
<function name='virDomainBlockPeek' file='python'>
<info>Read the contents of domain's disk device</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='disk' type='const char *' info='disk name'/>
<arg name='offset' type='unsigned long long' info='offset within block device'/>
<arg name='size' type='size_t' info='size to read'/>
<arg name='flags' type='unsigned int' info='unused, always pass 0'/>
<return type='char *' info='the returned buffer or None in case of error'/>
</function>
<function name='virDomainMemoryPeek' file='python'>
<info>Read the contents of domain's memory</info>
<arg name='dom' type='virDomainPtr' info='pointer to the domain'/>
<arg name='start' type='unsigned long long' info='start of memory to peek'/>
<arg name='size' type='size_t' info='size of memory to peek'/>
<arg name='flags' type='unsigned int' info='an OR&apos;ed set of virDomainMemoryFlags'/>
<return type='char *' info='the returned buffer or None in case of error'/>
</function>
</symbols>
</api>