Bug 611824 - RFE: Expose 'virDomainMemoryPeek' and 'virDomainBlockPeek' in python bindings
RFE: Expose 'virDomainMemoryPeek' and 'virDomainBlockPeek' in python bindings
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt (Show other bugs)
6.0
All Linux
medium Severity medium
: rc
: ---
Assigned To: Osier Yang
Virtualization Bugs
: AutoVerified, FutureFeature
Depends On:
Blocks: 655920
  Show dependency treegraph
 
Reported: 2010-07-06 11:10 EDT by Daniel Berrange
Modified: 2016-04-26 12:30 EDT (History)
13 users (show)

See Also:
Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Enhancement
Doc Text:
No documentation needed.
Story Points: ---
Clone Of: 492683
Environment:
Last Closed: 2012-06-20 02:23:45 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Comment 8 Osier Yang 2011-05-25 08:47:07 EDT
It's still not supported in upstream.
Comment 10 Nan Zhang 2011-11-29 01:05:33 EST
Test with libvirt-0.9.4-23.el6.x86_64, doesn't find this two methods 'virDomainMemoryPeek' and 'virDomainBlockPeek'.

# nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod.so | grep Peek

# nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod_qemu.so | grep Peek
Comment 11 Osier Yang 2011-12-15 08:04:13 EST
patch committed to upstream.

commit d758e0cb64e4a02a2f51de892fca4159952ac027
Author: Osier Yang <jyang@redhat.com>
Date:   Thu Dec 15 21:01:33 2011 +0800

    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
Comment 13 Wayne Sun 2012-01-10 05:19:00 EST
# rpm -q libvirt libvirt-python
libvirt-0.9.9-1.el6.x86_64
libvirt-python-0.9.9-1.el6.x86_64

# nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod.so | grep MemoryPeek
                 U virDomainMemoryPeek

1. start a domain
# virsh list
 Id Name                 State
----------------------------------
 53 rhel6u2              running

2. check
# python
Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) 
[GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open(None)
>>> dom = conn.lookupByName('rhel6u2')
>>> dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_VIRTUAL)
'\xd0\x93\xb6\xbb9\x7f\x00\x00\r\x00\x00\x00\x00\x00\x00\x00x\x01\x00\x00\x00\x00\x00\x00\xb0\x93\xb6\xbb9\x7f\x00\x00'
>>> dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_PHYSICAL)
'S\xff\x00\xf0S\xff\x00\xf0\xc3\xe2\x00\xf0S\xff\x00\xf0S\xff\x00\xf0S\xff\x00\xf0S\xff\x00\xf0S\xff\x00\xf0'
>>> 

so, this is fixed
Comment 14 Wayne Sun 2012-01-10 05:32:15 EST
(In reply to comment #13)
> # rpm -q libvirt libvirt-python
> libvirt-0.9.9-1.el6.x86_64
> libvirt-python-0.9.9-1.el6.x86_64
> 
> # nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod.so | grep MemoryPeek
>                  U virDomainMemoryPeek
> 
> 1. start a domain
> # virsh list
>  Id Name                 State
> ----------------------------------
>  53 rhel6u2              running
> 
> 2. check
> # python
> Python 2.6.6 (r266:84292, Sep 12 2011, 14:03:14) 
> [GCC 4.4.5 20110214 (Red Hat 4.4.5-6)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import libvirt
> >>> conn = libvirt.open(None)
> >>> dom = conn.lookupByName('rhel6u2')
> >>> dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_VIRTUAL)
> '\xd0\x93\xb6\xbb9\x7f\x00\x00\r\x00\x00\x00\x00\x00\x00\x00x\x01\x00\x00\x00\x00\x00\x00\xb0\x93\xb6\xbb9\x7f\x00\x00'
> >>> dom.memoryPeek(0, 32, libvirt.VIR_MEMORY_PHYSICAL)
> 'S\xff\x00\xf0S\xff\x00\xf0\xc3\xe2\x00\xf0S\xff\x00\xf0S\xff\x00\xf0S\xff\x00\xf0S\xff\x00\xf0S\xff\x00\xf0'
> >>> 
> 

for blockPeek:

# nm -a -D /usr/lib64/python2.6/site-packages/libvirtmod.so | grep BlockPeek
                 U virDomainBlockPeek

>>> dom.blockPeek('hda', 0, 10, 0)
'\xfa\xb8\x00\x10\x8e\xd0\xbc\x00\xb0\xb8'
>>> dom.blockPeek('hda', 10, 10, 0)
'\x00\x00\x8e\xd8\x8e\xc0\xfb\xbe\x00|'


> so, this is fixed
Comment 15 Osier Yang 2012-05-04 05:31:26 EDT
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
No documentation needed.
Comment 17 errata-xmlrpc 2012-06-20 02:23:45 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0748.html

Note You need to log in before you can comment on or make changes to this bug.