# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1208293325 25200
# Node ID f01fe8c3d7b72fb89ebfa8981f2d1fafe8066df7
# Parent 40f221d14476a2817a1e80a34b5c56189500db6c
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.
Changes:
- Use bool values instead of ints
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 40f221d14476 -r f01fe8c3d7b7 configure.ac
--- a/configure.ac Tue Apr 15 14:33:50 2008 -0400
+++ b/configure.ac Tue Apr 15 14:02:05 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 40f221d14476 -r f01fe8c3d7b7 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Tue Apr 15 14:33:50 2008 -0400
+++ b/src/Virt_VirtualSystemManagementService.c Tue Apr 15 14:02:05 2008 -0700
@@ -50,6 +50,8 @@
#include "Virt_DevicePool.h"
#include "svpc_types.h"
+#include "config.h"
+
const static CMPIBroker *_BROKER;
enum ResourceAction {
@@ -122,6 +124,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 false;
+ }
+
+ domain->dev_emu->type = CIM_RES_TYPE_EMU;
+ domain->dev_emu->dev.emu.path = strdup(emul);
+ domain->dev_emu->id = strdup("emulator");
+
+ return true;
+}
+
static int fv_vssd_to_domain(CMPIInstance *inst,
struct domain *domain,
const char *pfx)
@@ -129,11 +150,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;
}