ClusterLabs / resource-agents

Combined repository of OCF agents from the RHCS and Linux-HA projects
GNU General Public License v2.0
488 stars 577 forks source link

Discusses the VirtualDomain_start function #1920

Open twtlpla opened 3 months ago

twtlpla commented 3 months ago

In the VirtualDomain_start function, declare to ensure that domain is undefined until creating it. What is the reason for this?

If virtualdomain is stopped, the 'virsh list --all' command cannot query the corresponding domain, and the virtual machine is considered to be deleted. Because of this, is it possible to remove the 'virsh undefine' from the virtualdomain_start function?

oalbrigt commented 3 months ago

According to the comments it seems to be because there's no way to which directories are managed by libvirt, so I think we do it to be sure we're using the correct config file.

twtlpla commented 3 months ago

there's no way to which directories are managed by libvirt

How does ’virsh undefine‘ solve this problem? After the experiment, as long as the $OCF_RESKEY_config is configured, the domain can be started successfully regardless of whether it is in the /etc/libvirt/qemu directory.

oalbrigt commented 3 months ago

It undefines existing configs with the name, so it will create a new one from the config file you specify (e.g. put on shared storage).

twtlpla commented 3 months ago

It undefines existing configs with the name, so it will create a new one from the config file you specify (e.g. put on shared storage).

Do you mean that when the configuration file of an existing domain is different from the configuration file we specified, delete the original file first, and then use the configuration file we specified to complete the startup of the domain?

oalbrigt commented 3 months ago

Correct.