[libvirt-users] qemu-monitor-command

Shawn Davis sdavis17 at hawk.iit.edu
Tue Mar 20 17:18:12 UTC 2012


Thanks guys.  I will check out the virDomainMemoryPeek api.  I am still
curious though as to how to get the monitor command to work.  I am running
it on the same physical host as the vm so it is not remote.  What would be
an example of a path that one of you has gotten to work?  I have tried many
path forms and get the same Could not open ... error message.

Thanks,
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