[PATCH 3/3] domain_conf: set default emulator into def if it fails to alloc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: zhangjl02 <zhangjl02@xxxxxxxxxx>

When emulator is not found on host, domainPostParseDataAlloc will return 1,
and the domain will fail to start. Call domainPostParseDataDefEmulator to
replace emulator with the default one of guest's arch, and try to alloc again
after domainPostParseDataAlloc's failure. This will increase error tolerance,
if emulator defined in xml is not found on host.

Signed-off-by: zhangjl02 <zhangjl02@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bd2884088c..485f66357c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6266,7 +6266,15 @@ virDomainDefPostParse(virDomainDef *def,
         ret = xmlopt->config.domainPostParseDataAlloc(def, parseFlags,
                                                       xmlopt->config.priv,
                                                       &data.parseOpaque);
-
+        if (ret == 1){
+            int to_default = 0;
+            to_default = xmlopt->config.domainPostParseDataDefEmulator(def);
+            if (to_default) {
+                ret = xmlopt->config.domainPostParseDataAlloc(def, parseFlags,
+                                                              xmlopt->config.priv,
+                                                              &data.parseOpaque);
+            }
+        }
         if (virDomainDefPostParseCheckFailure(def, parseFlags, ret) < 0)
             goto cleanup;
         localParseOpaque = true;
-- 
2.35.1.windows.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux