when do steps as follows:
1. start a vm
2. restart libvirtd service
3. shutdown the vm
I found the pidfile associated with the vm has not been removed.
Analyzing related piece of code, I found when libvirtd service restarted, the vm's _virDomainObj structure(named dom here) in libvirtd will be re-established according to the vm's state-file or config-file, but its member of privateData.pidfile will not be reassigned value. By the way, qemudriver is used in my libvirt.
So when the vm is shutdown, its pidfile will not be removed, because the member of privateData.pidfile is NULL.
My questions are :
1. Do you think it is a problem when a vm has been shutdown, but its pidfile has not been removed ?
2. Do you think it is expected that the member of privateData.pidfile's value missed after libvirtd restart?
If it’s a bug then I’ll submit the patch to fix it.
Also list the related piece of code about removing the vm's pidfile in libvirt for your information:
if (priv->pidfile &&
unlink(priv->pidfile) < 0 &&
errno != ENOENT)
VIR_WARN("Failed to remove PID file for %s: %s",
vm->def->name, virStrerror(errno, ebuf, sizeof(ebuf)));