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@xxxxxxxxxxxxxxxxx> --- src/conf/domain_conf.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0d9fef4..5a6ff8b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9859,21 +9859,22 @@ static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps, VIR_DOMAIN_XML_INACTIVE))) goto error; + if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL) + goto error; + + if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0) + 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); + dom->autostart = autostart; return dom; } - if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL) - goto error; - - if ((autostart = virFileLinkPointsTo(autostartLink, configFile)) < 0) - goto error; - if (!(dom = virDomainAssignDef(caps, doms, def, false))) goto error; -- 1.7.4.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list