[PATCH] Make sure to create a default emulator device for XenFV domains

# HG changeset patch # User Dan Smith <danms@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@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; }

Hi, On my F8 machine with the following deatils : libcmpiutil changeset : 72 libvirt-cim changeset : 545 + the current patch applied. I am getting the following error: Virt_VirtualSystemManagementService.c(577): DefineSystem Virt_VirtualSystemManagementService.c(392): rasd_to_vdev(): Required field `Address' missing from NetRASD Virt_VirtualSystemManagementService.c(522): Failed to classify resources: Required field `Address' missing from NetRASD std_invokemethod.c(305): Method `DefineSystem' returned 1 To resolve this I modified the vsms.py NetRASD info to have Address field. After this I got the *Segmentation fault. *Please see the error below. std_invokemethod.c(230): Method parameter `ResourceSettings' validated type 0x3000 std_invokemethod.c(230): Method parameter `ReferenceConfiguration' validated type 0x1600 std_invokemethod.c(303): Executing handler for method `DefineSystem' Virt_VirtualSystemManagementService.c(577): DefineSystem misc_util.c(72): Connecting to libvirt with uri `xen' Segmentation fault Thanks and Regards, Deepti. Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@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@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; }
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

DK> To resolve this I modified the vsms.py NetRASD info to have DK> Address field. This is the correct solution :) DK> After this I got the *Segmentation fault. I just submitted a patch that should fix this. It looks like you don't have a network on your system (or one could not be found for some reason). This patch will make the provider not crash in this case :) Thanks! -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Dan Smith wrote:
# HG changeset patch # User Dan Smith <danms@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
+1 -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (3)
-
Dan Smith
-
Deepti B Kalakeri
-
Kaitlin Rupert