Roman Storozhenko
2017-May-24 07:49 UTC
[libvirt-users] How to show underlying QEMU command line using virsh
Hello, everybody I use virt to run my VM's and QEMU as a hypervisor. There is a file describing my virtual machine: /etc/libvirt/qemu/centos7.0.xml As you know it contains xml representation of my VM. Is there any way to show underlying qemu command that virsh runs using that file? For example: qemu-system-x86-64 -m 1024 -smp 2 -... If no, is there any way to figure it out during VM run ? --- Thanks in advance, Roman Storozhenko
Erik Skultety
2017-May-24 08:38 UTC
Re: [libvirt-users] How to show underlying QEMU command line using virsh
On Wed, May 24, 2017 at 10:49:23AM +0300, Roman Storozhenko wrote:> Hello, everybody > > I use virt to run my VM's and QEMU as a hypervisor. There is a file > describing my virtual machine: > > /etc/libvirt/qemu/centos7.0.xmlJust a note, never edit ^these files directly behind libvirt's back and always use 'virsh edit' for all modifications.> > As you know it contains xml representation of my VM. Is there any way to > show underlying qemu command that virsh runs using that file? For > example:virsh doesn't spawn the qemu process, it's a frontend to libvirtd daemon which will build the qemu cmdline according to the domain XML description and spawn the process. As for the qemu commandline, we don't have an API to query the command line, what you can do is get the qemu pid (e.g. with pgrep -f <VM_name> and then cat /proc/<pid>/cmdline) or use ps and pipe its output to grep. Erik> > qemu-system-x86-64 -m 1024 -smp 2 -... > > If no, is there any way to figure it out during VM run ? > > --- > Thanks in advance, > Roman Storozhenko > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users
Martin Kletzander
2017-May-24 12:23 UTC
Re: [libvirt-users] How to show underlying QEMU command line using virsh
On Wed, May 24, 2017 at 10:49:23AM +0300, Roman Storozhenko wrote:>Hello, everybody > >I use virt to run my VM's and QEMU as a hypervisor. There is a file >describing my virtual machine: > >/etc/libvirt/qemu/centos7.0.xml > >As you know it contains xml representation of my VM. Is there any way to >show underlying qemu command that virsh runs using that file? For >example: > >qemu-system-x86-64 -m 1024 -smp 2 -... > >If no, is there any way to figure it out during VM run ? >There is virsh domxml-to-native, you can do: virsh dumpxml centos7.0 | virsh domxml-to-native qemu-argv /dev/stdin However be warned that domxml-to-native does not support everything that the driver will, this API is always a bit behind with some things.>--- >Thanks in advance, >Roman Storozhenko > >_______________________________________________ >libvirt-users mailing list >libvirt-users@redhat.com >https://www.redhat.com/mailman/listinfo/libvirt-users
Tomáš Golembiovský
2017-May-24 21:00 UTC
Re: [libvirt-users] How to show underlying QEMU command line using virsh
On Wed, 24 May 2017 10:38:42 +0200 Erik Skultety <eskultet@redhat.com> wrote:> On Wed, May 24, 2017 at 10:49:23AM +0300, Roman Storozhenko wrote: > > Hello, everybody > > > > I use virt to run my VM's and QEMU as a hypervisor. There is a file > > describing my virtual machine: > > > > /etc/libvirt/qemu/centos7.0.xml > > Just a note, never edit ^these files directly behind libvirt's back and always > use 'virsh edit' for all modifications. > > > > > As you know it contains xml representation of my VM. Is there any way to > > show underlying qemu command that virsh runs using that file? For > > example: > > virsh doesn't spawn the qemu process, it's a frontend to libvirtd daemon which > will build the qemu cmdline according to the domain XML description and spawn > the process. As for the qemu commandline, we don't have an API to query the > command line, what you can do is get the qemu pid (e.g. with pgrep -f <VM_name> > and then cat /proc/<pid>/cmdline) or use ps and pipe its output to grep.Or look in /var/log/libvirt/qemu/centos7.0.log. AFAIK the qemu command gets logged every time you start the VM. Tomas> > Erik > > > > > qemu-system-x86-64 -m 1024 -smp 2 -... > > > > If no, is there any way to figure it out during VM run ? > > > > --- > > Thanks in advance, > > Roman Storozhenko > > > > _______________________________________________ > > libvirt-users mailing list > > libvirt-users@redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-users > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users-- Tomáš Golembiovský <tgolembi@redhat.com>