mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
Fix autostart flag when loading running domains
Drivers load running persistent and transient domain configs before inactive persistent domain configs, however only the latter would set a domain's autostart flag. This mismatch between the loaded and on-disk state could later cause problems with "virsh autostart": # virsh autostart example error: Failed to mark domain example as autostarted error: Failed to create symlink '/etc/libvirt/qemu/autostart/example.xml to '/etc/libvirt/qemu/example.xml': File exists This patch ensures the autostart flag is set correctly even when the domain is already defined. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=632100 https://bugzilla.redhat.com/show_bug.cgi?id=675319 Signed-off-by: Michael Chapman <mike@very.puzzling.org>
This commit is contained in:
parent
4cff75a41b
commit
30697181dc
1
AUTHORS
1
AUTHORS
@ -175,6 +175,7 @@ Patches have also been contributed by:
|
|||||||
Heath Petersen <HeathPetersen@Kandre.com>
|
Heath Petersen <HeathPetersen@Kandre.com>
|
||||||
Neil Wilson <neil@aldur.co.uk>
|
Neil Wilson <neil@aldur.co.uk>
|
||||||
Ohad Levy <ohadlevy@gmail.com>
|
Ohad Levy <ohadlevy@gmail.com>
|
||||||
|
Michael Chapman <mike@very.puzzling.org>
|
||||||
|
|
||||||
[....send patches to get your name here....]
|
[....send patches to get your name here....]
|
||||||
|
|
||||||
|
@ -9862,21 +9862,24 @@ static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
|
|||||||
VIR_DOMAIN_XML_INACTIVE)))
|
VIR_DOMAIN_XML_INACTIVE)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
/* if the domain is already in our hashtable, we don't need to do
|
|
||||||
* anything further
|
|
||||||
*/
|
|
||||||
if ((dom = virDomainFindByUUID(doms, def->uuid))) {
|
|
||||||
VIR_FREE(configFile);
|
|
||||||
virDomainDefFree(def);
|
|
||||||
return dom;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
/* if the domain is already in our hashtable, we only need to
|
||||||
|
* update the autostart flag
|
||||||
|
*/
|
||||||
|
if ((dom = virDomainFindByUUID(doms, def->uuid))) {
|
||||||
|
dom->autostart = autostart;
|
||||||
|
|
||||||
|
VIR_FREE(configFile);
|
||||||
|
VIR_FREE(autostartLink);
|
||||||
|
virDomainDefFree(def);
|
||||||
|
return dom;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(dom = virDomainAssignDef(caps, doms, def, false)))
|
if (!(dom = virDomainAssignDef(caps, doms, def, false)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user