# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1208274284 25200
# Node ID 2651b1fdeefc1e12108cd1634075da0bc506cd16
# Parent 01b0a24fc16f9daff19f3733552f223ddf6d7a18
Make sure to create a default emulator device for XenFV domains
This adds the emulator device in once we go to create the actual domain
object (and thus determine if the type necessitates an <emulator>.
This should fix definesystem on XenFV, although some other things
surrounding the NetRASD stuff in progress now may prevent regular testing
of it.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 01b0a24fc16f -r 2651b1fdeefc configure.ac
--- a/configure.ac Mon Apr 14 15:17:08 2008 -0700
+++ b/configure.ac Tue Apr 15 08:44:44 2008 -0700
@@ -87,6 +87,13 @@ AC_SUBST(MIG_CHECKS_DIR)
AC_SUBST(MIG_CHECKS_DIR)
AC_DEFINE_UNQUOTED(MIG_CHECKS_DIR, "$MIG_CHECKS_DIR", [External migration check
timeout])
+AC_ARG_WITH([xen_emulator],
+ [ --with-xen_emulator=emu Location of Xen FullVirt emulator],
+ [test "x$withval" != "x" &&
XEN_EMULATOR="$withval"],
+ [XEN_EMULATOR=/usr/lib/xen/bin/qemu-dm])
+AC_SUBST(XEN_EMULATOR)
+AC_DEFINE_UNQUOTED(XEN_EMULATOR, "$XEN_EMULATOR", [Location of Xen FullVirt
emulator])
+
# Autogenerate the autoconf header file to store build settings
AC_CONFIG_HEADER([config.h])
diff -r 01b0a24fc16f -r 2651b1fdeefc src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Mon Apr 14 15:17:08 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c Tue Apr 15 08:44:44 2008 -0700
@@ -49,6 +49,8 @@
#include "Virt_HostSystem.h"
#include "svpc_types.h"
+#include "config.h"
+
const static CMPIBroker *_BROKER;
enum ResourceAction {
@@ -121,6 +123,25 @@ static int xenpv_vssd_to_domain(CMPIInst
return 1;
}
+static bool fv_default_emulator(struct domain *domain)
+{
+ const char *emul = XEN_EMULATOR;
+
+ cleanup_virt_device(domain->dev_emu);
+
+ domain->dev_emu = calloc(1, sizeof(*domain->dev_emu));
+ if (domain->dev_emu == NULL) {
+ CU_DEBUG("Failed to allocate default emulator device");
+ return 0;
+ }
+
+ domain->dev_emu->type = CIM_RES_TYPE_EMU;
+ domain->dev_emu->dev.emu.path = strdup(emul);
+ domain->dev_emu->id = strdup("emulator");
+
+ return 1;
+}
+
static int fv_vssd_to_domain(CMPIInstance *inst,
struct domain *domain,
const char *pfx)
@@ -128,11 +149,13 @@ static int fv_vssd_to_domain(CMPIInstanc
int ret;
const char *val;
- if (STREQC(pfx, "KVM"))
+ if (STREQC(pfx, "KVM")) {
domain->type = DOMAIN_KVM;
- else if (STREQC(pfx, "Xen"))
+ } else if (STREQC(pfx, "Xen")) {
domain->type = DOMAIN_XENFV;
- else {
+ if (!fv_default_emulator(domain))
+ return 0;
+ } else {
CU_DEBUG("Unknown fullvirt domain type: %s", pfx);
return 0;
}