Re: Question, how to use virDomainQemuMonitorCommand()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/09/10 - 04:52:25PM, Lai Jiangshan wrote:
> On 09/07/2010 09:22 PM, Chris Lalancette wrote:
> > On 09/07/10 - 04:08:13PM, Lai Jiangshan wrote:
> >> Hi, Chris,
> >>
> >> I saw virDomainQemuMonitorCommand() in libvirt-qemu.c,
> >> I think it will help me to send arbitrary qemu-monitor command to
> >> qemu via libvirtd.
> >>
> >> But how can I use virDomainQemuMonitorCommand()?
> >> Can I use it by just using current tools(virsh or other) without writing any code?
> > 
> > Unfortunately, no.  There is a bug in the current virsh command that prevents
> > it from properly parsing the command-lines necessary to send monitor commands
> > to the qemu monitor.  Until we fix that bug, we won't push the support into
> > virsh.
> > 
> 
> Thanks,
> 
> We need this feature, could you tell me the detail of the bug,
> we will try to fix it or do assists.

I've outlined it before on this list, but the gist of it is that the way that
virsh parses command-line arguments loses the formatting.  Thus, if you were
enter a command like:

# virsh qemu-monitor-command f13guest "info cpus"

Then virsh main() will get 4 arguments:

argv[0] = "virsh";
argv[1] = "qemu-monitor-command";
argv[2] = "f13guest";
argv[3] = "info cpus";

So far, all is good.  However, during the parsing of these command-line
arguments, virsh takes all of these arguments and smashes them back together
as a single string:

command = "virsh qemu-monitor-command f13guest info cpus";

And then it reparses the whole thing.  Notice that we've lost the quoting,
though, so now it's an invalid command.

The problem is further complicated by some of the other features of virsh,
including the support for separating multiple commands with semicolons.  For
example, the following is a legal command:

# virsh 'define D.xml; dumpxml D'

In any case, the answer is probably to re-write the command-line parsing of
virsh to not lose quoting.  I have not had time to do this, so if you have
the time to look at it and make it work, patches are definitely appreciated!

-- 
Chris Lalancette

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]