Bug 611824 - RFE: Expose 'virDomainMemoryPeek' and 'virDomainBlockPeek' in python bindings
Summary: RFE: Expose 'virDomainMemoryPeek' and 'virDomainBlockPeek' in python bindings
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt   
(Show other bugs)
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Osier Yang
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Keywords: AutoVerified, FutureFeature
Depends On:
Blocks: 655920
TreeView+ depends on / blocked
 
Reported: 2010-07-06 15:10 UTC by Daniel Berrange
Modified: 2016-04-26 16:30 UTC (History)
13 users (show)

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 06:23:45 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Comment 8 Osier Yang 2011-05-25 12:47:07 UTC
It's still not supported in upstream.

Comment 10 Nan Zhang 2011-11-29 06:05:33 UTC
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 13:04:13 UTC
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 10:19:00 UTC
# 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 10:32:15 UTC
(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 09:31:26 UTC
    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 06:23:45 UTC
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.