Checking for the existence and execute permission of a user-specified
emulator is fine when actually creating a VM, but is problematic when
running unit tests since a development system may not have the
emulator installed.
Defer the emulator checks to libxl, when actually starting a VM. One
downside is errors associated with non-existent or non-executable
emulator are reported in the libxl driver log files instead of being
returned through the libvirt API. E.g. before this change
virsh create test.xml
error: Failed to create domain from test.xml
error: unsupported configuration: emulator '/foo/bar' not found
After this change
virsh create test.xml
error: Failed to create domain from test.xml
error: internal error: libxenlight failed to create new domain 'test'
but the libxl driver log file contains
2017-02-23 22:04:18.319+0000: libxl: libxl_dm.c:2050:libxl__spawn_local_dm:
device model /foo/bar is not executable: No such file or directory
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 4bab651b3..2c10fbe25 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -435,20 +435,6 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
b_info->u.hvm.bios = LIBXL_BIOS_TYPE_OVMF;
if (def->emulator) {
- if (!virFileExists(def->emulator)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("emulator '%s' not found"),
- def->emulator);
- return -1;
- }
-
- if (!virFileIsExecutable(def->emulator)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("emulator '%s' is not executable"),
- def->emulator);
- return -1;
- }
-
VIR_FREE(b_info->device_model);
if (VIR_STRDUP(b_info->device_model, def->emulator) < 0)
return -1;
--
2.11.0