Martin Kletzander
2016-Oct-17 19:34 UTC
Re: [libvirt-users] Libvirt adds extra parameters in domain XML
On Mon, Oct 17, 2016 at 02:29:10PM +0200, Marina Danial wrote:>I have a predetermined set of commands that I want to launch qemu with: > >sudo `which qemu-system-x86_64` -m 4G $(IMAGE) -enable-kvm \ >-nographic \ >-net nic,model=virtio,netdev=net0,macaddr=$(MAC),vlan=0 \ >-netdev tap,id=net0,ifname=tap01,vhost=on,script=no,downscript=no \ >-net nic,model=virtio,netdev=net1,macaddr=$(MANAGE_MAC),vlan=1 \ >-netdev tap,id=net1,ifname=tap02,vhost=on,script=no,downscript=no \ > >I dont need any extra configuration from libvirt. is this possible? Or can >anyone help with a possible xml configuration ? >Why do you need libvirt, then? If you need something from libvirt, we'll need to add some things. But if you don't need libvirt, then you can just run that command. Maybe I'm missing something.> > >On Thu, Oct 13, 2016 at 1:13 PM, Martin Kletzander <mkletzan@redhat.com> >wrote: > >> On Thu, Oct 13, 2016 at 11:49:44AM +0200, Marina Danial wrote: >> >>> Hello, >>> >>> In my C++ code, I generate my own domain XML file and I >>> use virDomainCreateXML or virDomainDefineXML to launch my qemu VM. >>> However, >>> when I get to check which commands are sent to the qemu commandline, I >>> find >>> that libvirt has added so many extra parameters to the ones I have already >>> set. How can I prevent libvirt from adding any extra parameters to the >>> ones >>> I originally defined in the domain XML? >>> >>> >> What problems are you having with those? What specific ones are >> problematic for you? Libvirt adds a lot of things so that the domain is >> predictable, it can talk to it later on and so on. Some of them are >> adding the same things you would have there without -no-defconfig and >> similar. Just so we can guarantee some compatibility etc. >> >> Help will be highly appreciated. >>> >>> >>> Thanks >>> >> >> _______________________________________________ >>> libvirt-users mailing list >>> libvirt-users@redhat.com >>> https://www.redhat.com/mailman/listinfo/libvirt-users >>> >>
Marina Danial
2016-Oct-17 19:37 UTC
Re: [libvirt-users] Libvirt adds extra parameters in domain XML
I need write the domain XML in libvirt to eventually convert it into these qemu commands.. I don't want to call qemu directly with these commands. So I needed assistance with that On Oct 17, 2016 9:34 PM, "Martin Kletzander" <mkletzan@redhat.com> wrote:> On Mon, Oct 17, 2016 at 02:29:10PM +0200, Marina Danial wrote: > >> I have a predetermined set of commands that I want to launch qemu with: >> >> sudo `which qemu-system-x86_64` -m 4G $(IMAGE) -enable-kvm \ >> -nographic \ >> -net nic,model=virtio,netdev=net0,macaddr=$(MAC),vlan=0 \ >> -netdev tap,id=net0,ifname=tap01,vhost=on,script=no,downscript=no \ >> -net nic,model=virtio,netdev=net1,macaddr=$(MANAGE_MAC),vlan=1 \ >> -netdev tap,id=net1,ifname=tap02,vhost=on,script=no,downscript=no \ >> >> I dont need any extra configuration from libvirt. is this possible? Or can >> anyone help with a possible xml configuration ? >> >> > Why do you need libvirt, then? If you need something from libvirt, > we'll need to add some things. But if you don't need libvirt, then you > can just run that command. Maybe I'm missing something. > > >> >> On Thu, Oct 13, 2016 at 1:13 PM, Martin Kletzander <mkletzan@redhat.com> >> wrote: >> >> On Thu, Oct 13, 2016 at 11:49:44AM +0200, Marina Danial wrote: >>> >>> Hello, >>>> >>>> In my C++ code, I generate my own domain XML file and I >>>> use virDomainCreateXML or virDomainDefineXML to launch my qemu VM. >>>> However, >>>> when I get to check which commands are sent to the qemu commandline, I >>>> find >>>> that libvirt has added so many extra parameters to the ones I have >>>> already >>>> set. How can I prevent libvirt from adding any extra parameters to the >>>> ones >>>> I originally defined in the domain XML? >>>> >>>> >>>> What problems are you having with those? What specific ones are >>> problematic for you? Libvirt adds a lot of things so that the domain is >>> predictable, it can talk to it later on and so on. Some of them are >>> adding the same things you would have there without -no-defconfig and >>> similar. Just so we can guarantee some compatibility etc. >>> >>> Help will be highly appreciated. >>> >>>> >>>> >>>> Thanks >>>> >>>> >>> _______________________________________________ >>> >>>> libvirt-users mailing list >>>> libvirt-users@redhat.com >>>> https://www.redhat.com/mailman/listinfo/libvirt-users >>>> >>>> >>>
Andrea Bolognani
2016-Oct-18 08:14 UTC
Re: [libvirt-users] Libvirt adds extra parameters in domain XML
On Mon, 2016-10-17 at 21:37 +0200, Marina Danial wrote:> I need write the domain XML in libvirt to eventually convert > it into these qemu commands.. I don't want to call qemu > directly with these commands. So I needed assistance with > thatIf you're dead set on executing QEMU with those options, and *only* those options, then libvirt is quite simply not the tool you're looking for. When you use libvirt, by definition you're giving up fine-grained control of the specific options passed to the underlying hypervisor and trust libvirt to translate an high-level virtual hardware definition (guest XML) into an appropriate QEMU command line. Just to give you an example of why libvirt will never be able to build exactly the command line you provided, we rely on the QEMU monitor to eg. perform device hotplug, so you will never see a QEMU process spawned by libvirt that lacks the '-mon' option. So your options are basically: 1) switch to libvirt and accept the fact that your QEMU command lines will be quite a bit more verbose than they currently are 2) keep spawning QEMU processes with hand-crafted command lines I would of course recommend going for 1), as that will allow you to use all of libvirt's features down the line, when it eventually turns out you need them ;) -- Andrea Bolognani / Red Hat / Virtualization