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(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org