Discussion:
[libvirt-users] how xml generated
李卓瑶
2018-04-26 02:29:33 UTC
Permalink
hi :
i create a domain by virt-manager tool, then there is a xxx.xml generated in /etc/libvirt/qemu/.
so, my question is how the xx.xml generated? What the code involves in libvirt ?

Thanks!



--
Have a good day
Michal Privoznik
2018-04-26 07:32:42 UTC
Permalink
Post by 李卓瑶
i create a domain by virt-manager tool, then there is a xxx.xml generated in /etc/libvirt/qemu/.
so, my question is how the xx.xml generated? What the code involves in libvirt ?
Long story short, virt-manager invokes virt-install which generates XML
string. This string (not yet saved onto disk, still just in memory) is
then passed to libvirt API virDomainDefineXML() which parses it, does
some sanity checking and finally formats it back and save it under
/etc/libvirt/qemu/$domain.xml.

Codewise, you want to be looking at qemuDomainDefineXMLFlags().

Michal
李卓瑶
2018-04-26 07:50:31 UTC
Permalink
Thanks for your reply
what i want to know is that why there are many devices in $domain.xml, actully , i choose nothing in virt-manager?
so, Do i need to look at qemuDomainDefineXMLFlags()?
hours ago, i thought it's qemuDomainCreateWithFlags.


--
Have a good day
-----原始邮件-----
发送时闎: 2018幎4月26日 星期四
䞻题: Re: [libvirt-users] how xml generated
Post by 李卓瑶
i create a domain by virt-manager tool, then there is a xxx.xml generated in /etc/libvirt/qemu/.
so, my question is how the xx.xml generated? What the code involves in libvirt ?
Long story short, virt-manager invokes virt-install which generates XML
string. This string (not yet saved onto disk, still just in memory) is
then passed to libvirt API virDomainDefineXML() which parses it, does
some sanity checking and finally formats it back and save it under
/etc/libvirt/qemu/$domain.xml.
Codewise, you want to be looking at qemuDomainDefineXMLFlags().
Michal
Michal Privoznik
2018-04-26 08:01:04 UTC
Permalink
Post by 李卓瑶
Thanks for your reply
what i want to know is that why there are many devices in $domain.xml, actully , i choose nothing in virt-manager?
so, Do i need to look at qemuDomainDefineXMLFlags()?
Because we try to have 1:1 relationship between domain XML configuration
and devices as seen by guest. Even when you don't select anything in
virt-manager the domain will definitely have a PCI root controller,
controller for disk bus (be it sata, scsi, ide, ..), then it'll also
have a virtual NIC, some memory/cpu configuration, and so on.

In the code, these devices are added once XML is parsed by
virDomainDefPostParseInternal(). Each driver can pass this xmlopt
structure filled in with callbacks (take a look at
virQEMUDriverCreateXMLConf()). So in the end, devices are added only
after XML is parsed. However, it is not done all in one place. For
instance, controllers are added during device address assignment, other
devices are added in PostParse callbacks, and so on.
Post by 李卓瑶
hours ago, i thought it's qemuDomainCreateWithFlags.
No. This creates so called transient domains.

https://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains

Michal
lizhuoyao
2018-04-26 08:46:07 UTC
Permalink
oh, there is much much much code,it's too too too hard for me.

So,,,,,can i ask more question:use virt-manager create a domain,but with a result of "unsupported configuration:the ioh3420 controller is not supported in this qemu".since it's arm64 platform,and ioh3420 is a intel device.right?Why produce a intel device in arm64 platform?

So, can i delete the ioh3420 only by changing the code?info: i use the libvirt-2.0.0,virt-manager create doamin succeed;when i update to libvirt-3.2.0,the issue above happened. qemu is 2.3.0

Thanks!


--
Have a good day
-----原始邮件-----
发送时闎: 2018幎4月26日 星期四
䞻题: Re: [libvirt-users] how xml generated
Post by 李卓瑶
Thanks for your reply
what i want to know is that why there are many devices in $domain.xml, actully , i choose nothing in virt-manager?
so, Do i need to look at qemuDomainDefineXMLFlags()?
Because we try to have 1:1 relationship between domain XML configuration
and devices as seen by guest. Even when you don't select anything in
virt-manager the domain will definitely have a PCI root controller,
controller for disk bus (be it sata, scsi, ide, ..), then it'll also
have a virtual NIC, some memory/cpu configuration, and so on.
In the code, these devices are added once XML is parsed by
virDomainDefPostParseInternal(). Each driver can pass this xmlopt
structure filled in with callbacks (take a look at
virQEMUDriverCreateXMLConf()). So in the end, devices are added only
after XML is parsed. However, it is not done all in one place. For
instance, controllers are added during device address assignment, other
devices are added in PostParse callbacks, and so on.
Post by 李卓瑶
hours ago, i thought it's qemuDomainCreateWithFlags.
No. This creates so called transient domains.
https://wiki.libvirt.org/page/VM_lifecycle#Transient_guest_domains_vs_Persistent_guest_domains
Michal
Michal Privoznik
2018-04-26 09:00:19 UTC
Permalink
Post by lizhuoyao
oh, there is much much much code,it's too too too hard for me.
So,,,,,can i ask more question:use virt-manager create a domain,but with a result of "unsupported configuration:the ioh3420 controller is not supported in this qemu".since it's arm64 platform,and ioh3420 is a intel device.right?Why produce a intel device in arm64 platform?
I don't think there's a way to step into virt-manager's process of
defining domains. However, you can use virt-install directly instead. It
can just print the XML instead of defining it in libvirt. You can take
this document, modify it and then 'virsh define ...' it.

What you are seeing is a bug that is fixed already.
Post by lizhuoyao
So, can i delete the ioh3420 only by changing the code?info: i use the libvirt-2.0.0,virt-manager create doamin succeed;when i update to libvirt-3.2.0,the issue above happened. qemu is 2.3.0
Also I should point out that libvirt-2.0.0 is two years old release.
Nearly. Upgrade if you can.

Michal
lizhuoyao
2018-04-27 05:46:29 UTC
Permalink
oki would try it as your suggestion.
Thanks much!


--
Have a good day
-----原始邮件-----
发送时闎: 2018幎4月26日 星期四
䞻题: Re: [libvirt-users] how xml generated
Post by lizhuoyao
oh, there is much much much code,it's too too too hard for me.
So,,,,,can i ask more question:use virt-manager create a domain,but with a result of "unsupported configuration:the ioh3420 controller is not supported in this qemu".since it's arm64 platform,and ioh3420 is a intel device.right?Why produce a intel device in arm64 platform?
I don't think there's a way to step into virt-manager's process of
defining domains. However, you can use virt-install directly instead. It
can just print the XML instead of defining it in libvirt. You can take
this document, modify it and then 'virsh define ...' it.
What you are seeing is a bug that is fixed already.
Post by lizhuoyao
So, can i delete the ioh3420 only by changing the code?info: i use the libvirt-2.0.0,virt-manager create doamin succeed;when i update to libvirt-3.2.0,the issue above happened. qemu is 2.3.0
Also I should point out that libvirt-2.0.0 is two years old release.
Nearly. Upgrade if you can.
Michal
Continue reading on narkive:
Loading...