On 07.11.2014 23:28, Min Du wrote:
Hi,

Now for some reason, I need to add “ -qmp tcp:127.0.0.1:1235” when creating a 
KVM VM using libvirt. This command meaning in “qemu-kvm --help” is: -qmp dev    
    like -monitor but opens in 'control' mode.
I added command-line equivalent options into the xml file, like below format:

   <qemu:commandline>
          <qemu:arg value="-s"/>
          <qemu:arg value="-qmp"/>
          <qemu:arg value="tcp:127.0.0.1:1235"/>
   </qemu:commandline>

However when I create VM using this xml file, I got the error:

# virsh create instance-libvirt.xml
error: Failed to create domain from instance-libvirt.xml
error: internal error process exited while connecting to monitor: qemu-kvm: 
-qmp tcp:127.0.0.1:1235: Duplicate ID 'monitor' for mon
duplicate chardev: monitor

The VM I created, without “—qmp” option, has below options showing in “ps aux | 
grep qemu-kvm”:

-chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/vmifs_test.monitor,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control

Looks like libvirt automatically adds the monitor options upon VM creation.

Is there a way to disable this and use “—qmp” instead when creating VM?

No. Libvirt always creates a VM with monitor as it is used to control the machine. Without the monitor there's not much left for our APIs.

Why do you need to have monitor anyway? Is there something you can't achieve with libvirt APIs? Even if it was so, there's this APIs which allows you to pass arbitrary monitor commands to qemu: virDomainQemuMonitorCommand.

Michal

_______________________________________________
libvirt-users mailing list
libvirt-users@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users

Reply via email to