[libvirt-users] qemu-monitor-command

Shawn Davis sdavis17 at hawk.iit.edu
Wed Mar 21 03:43:33 UTC 2012


I understood what was said by the way about the permissions.  I temporarily
switched off SElinux.  I think I just may not be entering the command
correctly.  If I put home/testa/image.dump I get Could not open 'image.dump'
If I put /home/testa/image.dump I get Invalid char in expression from the
first slash.  Can someone who has gotten this to work please tell me how
they typed out the entire command in full detail?  I don't really care where
it saves it, I just need the dump of the memory.

I have tried this with various forms of the path:

sudo virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912
image.dump'

Regards, 
Shawn

-----Original Message-----
From: Eric Blake [mailto:eblake at redhat.com] 
Sent: Tuesday, March 20, 2012 10:09 AM
To: Shawn Davis
Cc: libvirt-users at redhat.com
Subject: Re: [libvirt-users] qemu-monitor-command

On 03/20/2012 07:30 AM, Shawn Davis wrote:
> Hello Everyone,
> 
> I am working on a grad school project for virtual introspection.  I 
> have a vm running (with 512mb of memory) and want to access the 
> pmemsave function through virsh with the qemu-monitor-command.

Why?  I would just access it through the public API virDomainMemoryPeek
instead, then you don't have to worry about the nuances.  Alas,
virDomainMemoryPeek has not yet been wired into virsh (patches welcome!), so
you'll have to access it through a custom C program, or through one of the
other language bindings such as python or perl.


> virsh qemu-monitor-command --hmp Shawn 'pmemsave 0 536870912 image.dump'
> 
> Shawn is the name of my vm and image.dump is the name of my output 
> file.  No matter what I do, I keep getting: Could not open 'image.dump'

That's because when you do raw pass-through like this, you are asking qemu
to open the relative pathname 'image.dump', relative to the current working
directory of qemu, which isn't necessarily the current working directory of
your virsh process.  Furthermore, if you are accessing a remote connection
(such as -c qemu+ssh://remote/system), the file name is relative to the
remote system, but you probably want the file to appear on the machine where
you are running virsh.  Finally, if SELinux is in effect, you have to ensure
that qemu has proper permissions, including SELinux label, to open() the
file; this is something that libvirt can do for you via the
virDomainMemoryPeek API, but if you go through qemu-monitor-command, you are
on your own.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org





More information about the libvirt-users mailing list