[libvirt] [PATCH] conf: set postParseFailed even without ALLOW_POST_PARSE_FAIL

Ján Tomko posted 1 patch 6 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/a43fde189a28a17dedc2d2407c23e7e818992d97.1520000270.git.jtomko@redhat.com
Test syntax-check passed
src/conf/domain_conf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[libvirt] [PATCH] conf: set postParseFailed even without ALLOW_POST_PARSE_FAIL
Posted by Ján Tomko 6 years, 1 month ago
We allow the postParse callbacks to fail for some reasons (missing
emulator binary) when parsing the configs from /etc/libvirt.
In that case, def->postParseFailed is set to true and the post
parse callbacks are re-executed on domain startup.

However this bool was only set when virDomainDefPostParse was called
with the ALLOW_POST_PARSE_FAIL flag set. If the callback failed
again on domain startup, the bool would be reset and subsequent
startups would not attempt to reexecute the callback.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_conf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fcafc8b2f..a248d73de 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5027,6 +5027,9 @@ virDomainDefPostParseCheckFailure(virDomainDefPtr def,
                                   unsigned int parseFlags,
                                   int ret)
 {
+    if (ret != 0)
+        def->postParseFailed = true;
+
     if (ret <= 0)
         return ret;
 
@@ -5034,7 +5037,6 @@ virDomainDefPostParseCheckFailure(virDomainDefPtr def,
         return -1;
 
     virResetLastError();
-    def->postParseFailed = true;
     return 0;
 }
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: set postParseFailed even without ALLOW_POST_PARSE_FAIL
Posted by Peter Krempa 6 years, 1 month ago
On Fri, Mar 02, 2018 at 15:17:55 +0100, Ján Tomko wrote:
> We allow the postParse callbacks to fail for some reasons (missing
> emulator binary) when parsing the configs from /etc/libvirt.
> In that case, def->postParseFailed is set to true and the post
> parse callbacks are re-executed on domain startup.
> 
> However this bool was only set when virDomainDefPostParse was called
> with the ALLOW_POST_PARSE_FAIL flag set. If the callback failed
> again on domain startup, the bool would be reset and subsequent
> startups would not attempt to reexecute the callback.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/conf/domain_conf.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

ACK
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list