[libvirt] [PATCH V2 1/2] libxl: Support user-specified <emulator>

Jim Fehlig jfehlig at suse.com
Fri Oct 10 22:03:47 UTC 2014


With the introduction of the libxlDomainGetEmulatorType function,
it is trivial to support a user-specfied <emulator> in the libxl
driver.  This patch is based loosely on David Scott's old patch
to do the same

https://www.redhat.com/archives/libvir-list/2013-April/msg02119.html
Signed-off-by: Jim Fehlig <jfehlig at suse.com>
---

V2: Check if user-specified emulator is executable.

 src/libxl/libxl_conf.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 09211f8..715895c 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -705,6 +705,28 @@ libxlMakeDomBuildInfo(virDomainDefPtr def,
         if (VIR_STRDUP(b_info->u.hvm.boot, bootorder) < 0)
             goto error;
 
+        if (def->emulator) {
+            if (!virFileExists(def->emulator)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("emulator '%s' not found"),
+                               def->emulator);
+                goto error;
+            }
+
+            if (!virFileIsExecutable(def->emulator)) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("emulator '%s' is not executable"),
+                               def->emulator);
+                goto error;
+            }
+
+            VIR_FREE(b_info->device_model);
+            if (VIR_STRDUP(b_info->device_model, def->emulator) < 0)
+                goto error;
+
+            b_info->device_model_version = libxlDomainGetEmulatorType(def);
+        }
+
         if (def->nserials) {
             if (def->nserials > 1) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-- 
1.8.4.5




More information about the libvir-list mailing list