[Libvirt-cim] [PATCH] Add some useful debug messages to VSMS to assist in debugging DefineSystem

Dan Smith danms at us.ibm.com
Mon Oct 29 18:46:00 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1193683554 25200
# Node ID 4a1d173152a3c4ceffe3cde01424a6576ea0ae20
# Parent  000f480e2956d631525f5151f611b3e8b41bbe8e
Add some useful debug messages to VSMS to assist in debugging DefineSystem

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r 000f480e2956 -r 4a1d173152a3 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Mon Oct 29 09:13:57 2007 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Mon Oct 29 11:45:54 2007 -0700
@@ -85,11 +85,14 @@ static CMPIStatus define_system_parse_ar
         int ret;
 
         sys_str = cu_get_str_arg(argsin, "SystemSettings");
-        if (sys_str == NULL)
-                goto out;
+        if (sys_str == NULL) {
+                CU_DEBUG("No SystemSettings string argument");
+                goto out;
+        }
 
         ret = cu_parse_embedded_instance(sys_str, _BROKER, sys);
         if (ret) {
+                CU_DEBUG("Unable to parse SystemSettings instance");
                 CMSetStatusWithChars(_BROKER, &s,
                                      CMPI_RC_ERR_FAILED,
                                      "SystemSettings parse error");
@@ -98,7 +101,7 @@ static CMPIStatus define_system_parse_ar
 
         res_arr = cu_get_array_arg(argsin, "ResourceSettings");
         if (res_arr == NULL) {
-                printf("Failed to get array arg\n");
+                CU_DEBUG("Failed to get array arg");
                 goto out;
         }
 
@@ -227,12 +230,16 @@ static int classify_resources(struct ins
                 CMPIObjectPath *op;
 
                 op = CMGetObjectPath(all->list[i], NULL);
-                if (op == NULL)
+                if (op == NULL) {
+                        CU_DEBUG("No path for RASD");
                         return 0;
+                }
 
                 if (rasd_type_from_classname(CLASSNAME(op), &type) != 
-                    CMPI_RC_OK)
+                    CMPI_RC_OK) {
+                        CU_DEBUG("No type for class %s", CLASSNAME(op))
                         return 0;
+                }
 
                 if (type == CIM_RASD_TYPE_PROC)
                         rasd_to_vdev(all->list[i],
@@ -261,11 +268,14 @@ static CMPIInstance *connect_and_create(
         CMPIInstance *inst;
 
         conn = connect_by_classname(_BROKER, CLASSNAME(ref), s);
-        if (conn == NULL)
+        if (conn == NULL) {
+                CU_DEBUG("libvirt connection failed");
                 return NULL;
+        }
 
         dom = virDomainDefineXML(conn, xml);
         if (dom == NULL) {
+                CU_DEBUG("Failed to define domain from XML");
                 CMSetStatusWithChars(_BROKER, s,
                                      CMPI_RC_ERR_FAILED,
                                      "Failed to create domain");
@@ -274,10 +284,12 @@ static CMPIInstance *connect_and_create(
 
         name = virDomainGetName(dom);
         inst = instance_from_name(_BROKER, conn, (char *)name, ref);
-        if (inst == NULL)
+        if (inst == NULL) {
+                CU_DEBUG("Failed to get new instance");
                 CMSetStatusWithChars(_BROKER, s,
                                      CMPI_RC_ERR_FAILED,
                                      "Failed to lookup resulting system");
+        }
 
         virConnectClose(conn);
 
@@ -301,6 +313,7 @@ static CMPIInstance *create_system(CMPII
         }
 
         if (!classify_resources(resources, domain)) {
+                CU_DEBUG("Failed to classify resources");
                 cu_statusf(_BROKER, s,
                            CMPI_RC_ERR_FAILED,
                            "ResourceSettings Error");
@@ -308,6 +321,7 @@ static CMPIInstance *create_system(CMPII
         }
 
         if (!vssd_to_domain(vssd, domain)) {
+                CU_DEBUG("Failed to create domain from VSSD");
                 cu_statusf(_BROKER, s,
                            CMPI_RC_ERR_FAILED,
                            "SystemSettings Error");
@@ -315,7 +329,7 @@ static CMPIInstance *create_system(CMPII
         }
 
         xml = system_to_xml(domain);
-        printf("\nSystem XML:\n%s\n", xml);
+        CU_DEBUG("System XML:\n%s", xml);
 
         inst = connect_and_create(xml, ref, s);
 
@@ -357,7 +371,7 @@ static CMPIStatus define_system(CMPIMeth
 
         inst_list_init(&res);
 
-        printf("Parsing args\n");
+        CU_DEBUG("DefineSystem");
 
         s = define_system_parse_args(argsin, &vssd, &res);
         if (s.rc != CMPI_RC_OK)




More information about the Libvirt-cim mailing list