Re: where can i find the sourcecode from virDomainDestroy ?

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

 



On 10/16/20 11:37 AM, Lentes, Bernd wrote:
Hi,

i have some questions concerning the destroying of domains, and i hope i'm right here. If not sorry for the disturbance.
I'm running a two node HA cluster with pacemaker and KVM domains as resources.
>From time to time when i try to stop a domain with the cluster manager that does not work, so the domain is destroyed.
That's ok.
But seldom and irregular also destroy does not work, so the node this domain is running on is fenced.
That's ugly. Fencing is the worst which can happen to a cluster and i try to avoid it.
Maybe destroy does not work because of heavy load, i'm currently examing that.

I installed the source package from libvirt-4.0.0, i have a SLES 12 SP4.


The first thing to try, if there is any possibility, is to upgrade your libvirt version. 4.0.0 is nearly 3 years out of date at this time, and *a lot* has changed since then. If you actually are experiencing a libvirt bug, then it's very likely it was identified and fixed during this time. (Even though you are running and older version of SLES, it's likely someone somewhere has built a newer version and has a pre-built package available)



I found a virsh-domain.c which i assume is responsible for the domains. Right ?


virsh-domain.c contains the functions that correspond to domain-related commands of the virsh utility. They gather input from the commandline, then call libvirt's public API. So you won't find much there.


I found a function called "virDomainDestroy", which i believe has the purpose to destroy the domain. Right ?


That is the top-level public API (what is called by user programs like virsh or virt-manager). It looks into the virConnect object that was previously opened by said user program, and calls the domainDestroy() function for whichever hypervisor driver you're using. So for example, if you are using the QEMU driver, it will end up calling qemuDomainDestroy(), or if you're using xen (libxl), it will call libxlDomainDestroy() (you can get a list of all these functions by searching for "domainDestroy" in the source - each hypervisor will initialize the .domainDestroy member of its virHypervisorDriver object with a pointer to its domainDestroy function.)


From there, you can search for the appropriate function for the hypervisor you're using. For example, qemuDomainDestroy is in src/qemu/qemu_driver.c, and libxlDomainDestroy is in src/libxl/libxl_driver.c


But i don't find the source for that function. I greped the whole source code for it, but didn't find it.


If you grep'ed all the source you have for virDomainDestroy and didn't find it, then either you don't have all the source, or there was a mistake in your grep command :-). virDomainDestroy is in src/libvirt-domain.c (but as I detailed above, that's not actually the function you're looking for, only a switch-point in the long linkage of the journey from application to hypervisor driver).


In the end, while I don't want to discourage looking into the source in general, since it's always enlightening and leads to a better understanding, this may not be the most efficient path to a solution; you may get better, faster results by upgrading to as new a version of libvirt as possible, then if the error continues, come back to the list with a detailed description of the error (or if you think direct interaction could lead to a quicker resolution, point an IRC client at irc.oftc.net, join the #virt channel, and ask away - several libvirt developers are there during weekday normal worktime (mostly in Europe, plus a few in the U.S.), and we try our best to be helpful and polite :-)


Good luck!


I'd like to know what this function returns in success or failure.

Could you please help me ?

Thanks.


Bernd





[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]

  Powered by Linux