WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-cim

Re: [Xen-cim] [PATCH]move to changeset 14542

To: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Subject: Re: [Xen-cim] [PATCH]move to changeset 14542
From: Jim Fehlig <jfehlig@xxxxxxxxxx>
Date: Sun, 08 Apr 2007 22:51:31 -0600
Cc: xen-ciM <xen-cim@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sun, 08 Apr 2007 21:50:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070405081918.GA23112@xxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-cim-request@lists.xensource.com?subject=help>
List-id: xen-cim mailing list <xen-cim.lists.xensource.com>
List-post: <mailto:xen-cim@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-cim>, <mailto:xen-cim-request@lists.xensource.com?subject=unsubscribe>
References: <460DBAE9.10004@xxxxxxxxxx> <94C8C9E8B25F564F95185BDA64AB05F604E87635@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20070405081918.GA23112@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-cim-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070221)
Ewan Mellor wrote:
On Wed, Apr 04, 2007 at 11:25:45PM -0400, Subrahmanian, Raj wrote:

All,
This patch moves the providers to changeset 14542.

Thanks for this Raj, this is very useful.  I'll get some testing done here,
too, and hopefully there shouldn't be much more stuff for you to catch up on.

I have left two things open.
- I was not sure how to integrate with the vbd and vdi code that has
come in. These sections of code were commented out with VBD<->VDI issue.

I don't know what this means.  Could you explain?

- The upstream has not yet accepted the model info for vifs patch that
Jim sent out.

Jim said that he would go and try a different approach (putting the model info
in a VIF.other_config dictionary), but he hasn't yet come back to me with a
new patch.

The patch is done but I got side-tracked before testing it :-/. I'll get something out this week.

Jim

This is just the first cut. I was not able to rigorously test it since
my hvm box is still under the 'old' xen. I am hoping that by sending it
out, we will have more people working on it. With this, I can do some
basic enumeration etc.
The big change between 14542 and the tip seems to be some change in the
session handling code.

Calls on the session class now take two session references -- the first is the
session that you're authenticating with, as with any call, and the second is
the session that you actually want to talk about.  This will allow us (later)
to have the ability for superusers to inspect other people's sessions, for
example.

As far as you're concerned, just passing in the same session handle twice
should be all you need to do.

Cheers,

Ewan.


Thanks
Raj

Content-Description: move_prov_to_unstable.patch
# HG changeset patch
# User root@xxxxxxxxxxxxxxx
# Node ID 25962bc0d49ad3a8d13ad221a9c291dadbb90530
# Parent  c37b7ff52b4f4b0e876f16c48f92ede5a90ab2e5
This patch moves the providers to the changeset 14542. There are two open problems. I have not updated the providers to make use of the vdi structure. These places have been commented out with VBD<->VDI issues. The second issue is that the upstream has not yet accepted the model field for networkport With these patches, I am able to compile and enumerate with the providers.



Signed-off-by: Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>

diff -r c37b7ff52b4f -r 25962bc0d49a 
src/Xen_ComputerSystemSettingData_Resource.c
--- a/src/Xen_ComputerSystemSettingData_Resource.c      Thu Mar 29 16:09:37 
2007 -0600
+++ b/src/Xen_ComputerSystemSettingData_Resource.c      Wed Apr 04 22:46:28 
2007 -0400
@@ -157,18 +157,18 @@ int Xen_ComputerSystemSettingData_setIns
    char inst_id[1024];
    int prop_bool_val;
    char *prop_string_val;
-
+   char hvm_boot_order[1024];
    if (resource == NULL) return 0;
    if (CMIsNullObject(instance)) return 0;
/* Set the CMPIInstance properties from the resource data. */
    snprintf(inst_id, 1024, "Xen:%s", resource->name_label);
    CMSetProperty(instance, "InstanceID",(CMPIValue *)inst_id, CMPI_chars);
-
-   if (resource->hvm_boot && (resource->hvm_boot[0] != '\0')) {
+// There must be an easier way of figuring out pv/hvm, but, until we figure 
that out, we will keep this - Raj
+   if (xen_utils_get_value_from_map(resource->hvm_boot_params, "order", 
hvm_boot_order)&& (hvm_boot_order[0] != '\0')) {
       /* HVM settings */
       CMSetProperty(instance, "VirtualSystemType", (CMPIValue 
*)"hvm-3.0-unknown", CMPI_chars);
-      CMSetProperty(instance, "BootOrder", (CMPIValue *)resource->hvm_boot, 
CMPI_chars);
+      CMSetProperty(instance, "BootOrder", (CMPIValue *)hvm_boot_order, 
CMPI_chars);
       prop_bool_val = get_platform_bool_val(resource, "stdvga");
       CMSetProperty(instance, "stdvga", (CMPIValue *)&prop_bool_val, 
CMPI_boolean);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_ComputerSystem_Resource.c
--- a/src/Xen_ComputerSystem_Resource.c Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_ComputerSystem_Resource.c Wed Apr 04 22:46:28 2007 -0400
@@ -170,13 +170,13 @@ int Xen_ComputerSystem_setInstanceFromRe
          CMSetProperty(instance, "Status",(CMPIValue *)"Suspended", 
CMPI_chars);
          break;
- case XEN_VM_POWER_STATE_SHUTTINGDOWN:
+/*      case :
          statusvalue = 9; // "Stopping"
          enabledStateVal = 4; // "Shutting Down"
          requestedStateVal = 3; // "Disabled"
          CMSetProperty(instance, "Status",(CMPIValue *)"Stopping", CMPI_chars);
          break;
-
+*/
       default:
          statusvalue = 0; // "Unknown"
          enabledStateVal = 0; // "Unknown"
@@ -212,8 +212,9 @@ int Xen_ComputerSystem_deleteResource(xe
     * For now we'll treat this operation as synchronous and not wait
     * for shutdown before removing the domain.
     */
-   if ((resource->power_state !=  XEN_VM_POWER_STATE_HALTED) ||
-       (resource->power_state !=  XEN_VM_POWER_STATE_SHUTTINGDOWN))   {
+   if (resource->power_state !=  XEN_VM_POWER_STATE_HALTED)
+// (resource->power_state != XEN_VM_POWER_STATE_SHUTTINGDOWN)) + {
       /* Initiate an asynchronous graceful shutdown of the domain's OS.
          Note - this will also eventually destroy the domain! */
       if (!xen_vm_clean_shutdown(session->xen, resource->handle)) {
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_DiskSettingData_Resource.c
--- a/src/Xen_DiskSettingData_Resource.c        Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_DiskSettingData_Resource.c        Wed Apr 04 22:46:28 2007 -0400
@@ -257,9 +257,10 @@ int Xen_DiskSettingData_setInstanceFromR
    else
       mode = "r";
- snprintf(buf, MAX_INSTANCEID_LEN, "%s,%s,%s", resource->image, resource->device, mode);
+/*   snprintf(buf, MAX_INSTANCEID_LEN, "%s,%s,%s", resource->image, 
resource->device, mode);
    CMSetProperty(instance, "DiskConfigInfo",(CMPIValue *)buf, CMPI_chars);
-
+       VDI<->VBD issue
+*/
    /*
     * TODO:
     * PoolID, Weight, HostResource (mapped device in dom0)
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_Disk_Resource.c
--- a/src/Xen_Disk_Resource.c   Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_Disk_Resource.c   Wed Apr 04 22:46:28 2007 -0400
@@ -241,7 +241,7 @@ int Xen_Disk_setInstanceFromResource(xen
CMSetProperty(instance, "Name",(CMPIValue *)resource->device, CMPI_chars); - CMSetProperty(instance, "Device",(CMPIValue *)resource->image, CMPI_chars);
+   //CMSetProperty(instance, "Device",(CMPIValue *)resource->image, CMPI_chars); VDI 
<-> VBD issue
    CMSetProperty(instance, "DeviceName",(CMPIValue *)resource->device, 
CMPI_chars);
char *mode;
@@ -259,7 +259,7 @@ int Xen_Disk_setInstanceFromResource(xen
    CMSetProperty(instance, "Access",(CMPIValue *)&access, CMPI_uint16);
char diskinfo[1024];
-   snprintf(diskinfo, 1024, "%s,%s,%s", resource->image, resource->device, 
mode);
+   //snprintf(diskinfo, 1024, "%s,%s,%s", resource->image, resource->device, mode); 
VDI<->VBD issue
    CMSetProperty(instance, "DiskConfigInfo",(CMPIValue *)diskinfo, CMPI_chars);
if (vm_rec->power_state != XEN_VM_POWER_STATE_HALTED) {
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_Memory.c
--- a/src/Xen_Memory.c  Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_Memory.c  Wed Apr 04 22:46:28 2007 -0400
@@ -133,7 +133,7 @@ static CMPIStatus EnumInstanceNames(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_Memory_setInstanceFromResource(resource, instance, _BROKER)) {
+      if (!Xen_Memory_setInstanceFromResource(session, resource, instance, 
_BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -227,7 +227,7 @@ static CMPIStatus EnumInstances(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_Memory_setInstanceFromResource(resource, instance, _BROKER)) {
+      if (!Xen_Memory_setInstanceFromResource(session, resource, instance, 
_BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -319,7 +319,7 @@ static CMPIStatus GetInstance(
    }
/* Set the instance property values from the resource data. */
-   if (!Xen_Memory_setInstanceFromResource(resource, instance, _BROKER)) {
+   if (!Xen_Memory_setInstanceFromResource(session, resource, instance, 
_BROKER)) {
       _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
       CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
       goto exit;
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_MemorySettingData.c
--- a/src/Xen_MemorySettingData.c       Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_MemorySettingData.c       Wed Apr 04 22:46:28 2007 -0400
@@ -132,7 +132,7 @@ static CMPIStatus EnumInstanceNames(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_MemorySettingData_setInstanceFromResource(resource, instance, 
_BROKER)) {
+      if (!Xen_MemorySettingData_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -226,7 +226,7 @@ static CMPIStatus EnumInstances(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_MemorySettingData_setInstanceFromResource(resource, instance, 
_BROKER)) {
+      if (!Xen_MemorySettingData_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -318,7 +318,7 @@ static CMPIStatus GetInstance(
    }
/* Set the instance property values from the resource data. */
-   if (!Xen_MemorySettingData_setInstanceFromResource(resource, instance, 
_BROKER)) {
+   if (!Xen_MemorySettingData_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
       _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
       CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
       goto exit;
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_MemorySettingData_Resource.c
--- a/src/Xen_MemorySettingData_Resource.c      Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_MemorySettingData_Resource.c      Wed Apr 04 22:46:28 2007 -0400
@@ -16,7 +16,8 @@
 // ============================================================================
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
-// Description:
+//               Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
+// Description: // ============================================================================ #include <stdlib.h>
@@ -25,7 +26,7 @@
#include <xen_common.h>
 #include <xen_vm.h>
-
+#include <xen_vm_metrics.h>
 #include "Xen_MemorySettingData_Resource.h"
/* Include the required CMPI data types, function headers, and macros. */
@@ -125,7 +126,8 @@ int Xen_MemorySettingData_freeResource(_
// ---------------------------------------------------------------------------- /* Set the property values of a CMPI instance from a specific resource. */
-int Xen_MemorySettingData_setInstanceFromResource(_RESOURCE * resource,
+int Xen_MemorySettingData_setInstanceFromResource(xen_utils_session *session,
+                                                 _RESOURCE * resource,
                                                   const CMPIInstance * 
instance,
                                                   const CMPIBroker * broker)
 {
@@ -146,8 +148,12 @@ int Xen_MemorySettingData_setInstanceFro
    int consumerVisibility = 2; /* 2 == Passed-Through */
    CMSetProperty(instance, "ConsumerVisibility" , (CMPIValue 
*)&consumerVisibility, CMPI_uint16);
- unsigned long long memory;
-   memory = resource->memory_actual;
+   int64_t memory;
+   // Get the memory_actual
+   if (resource->metrics->is_record)
+       memory=resource->metrics->u.record->memory_actual;
+   else        
+       xen_vm_metrics_get_memory_actual(session, &memory, 
resource->metrics->u.handle);;
    CMSetProperty(instance, "Reservation",(CMPIValue *)&memory, CMPI_uint64);
    CMSetProperty(instance, "VirtualQuantity",(CMPIValue *)&memory, 
CMPI_uint64);
    memory = resource->memory_dynamic_max;
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_MemorySettingData_Resource.h
--- a/src/Xen_MemorySettingData_Resource.h      Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_MemorySettingData_Resource.h      Wed Apr 04 22:46:28 2007 -0400
@@ -77,7 +77,8 @@ int Xen_MemorySettingData_freeResource(_
 int Xen_MemorySettingData_freeResource(_RESOURCE * resource);
/* Set the property values of a CMPI instance from a specific resource. */
-int Xen_MemorySettingData_setInstanceFromResource(_RESOURCE * resource,
+int Xen_MemorySettingData_setInstanceFromResource(xen_utils_session *session,
+                                                 _RESOURCE * resource,
                                                   const CMPIInstance * 
instance,
                                                   const CMPIBroker * broker);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_Memory_Resource.c
--- a/src/Xen_Memory_Resource.c Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_Memory_Resource.c Wed Apr 04 22:46:28 2007 -0400
@@ -17,11 +17,13 @@
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 //                Tokunbo Adeshiyan, <tokunbo@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
+//               Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
 // Description:
 // ============================================================================
#include <xen_common.h>
 #include <xen_vm.h>
+#include <xen_vm_metrics.h>
#include <stdlib.h>
 #include <assert.h>
@@ -142,8 +144,10 @@ int Xen_Memory_freeResource(_RESOURCE * // ---------------------------------------------------------------------------- -/* Set the property values of a CMPI instance from a specific resource. */
-int Xen_Memory_setInstanceFromResource(_RESOURCE * resource,
+/* Set the property values of a CMPI instance from a specific resource. + Added session parameter so that the memory_actual value can be picked up from xen_vm_metrics : Raj Subrahmanian 04/04/2007*/
+int Xen_Memory_setInstanceFromResource(xen_utils_session *session,
+                                      _RESOURCE * resource,
                                        const CMPIInstance * instance,
                                        const CMPIBroker * broker)
 {
@@ -165,13 +169,17 @@ int Xen_Memory_setInstanceFromResource(_
    uint64_t blocksize = 1;
    CMSetProperty(instance, "BlockSize", (CMPIValue *)&blocksize, CMPI_uint64);
- unsigned long long blocks = resource->memory_dynamic_max;
+   int64_t blocks = resource->memory_dynamic_max;
    CMSetProperty(instance, "NumberOfBlocks", (CMPIValue *)&blocks, 
CMPI_uint64);
-   blocks = resource->memory_actual;
+ + // Get the memory_actual
+   if (resource->metrics->is_record)
+       blocks=resource->metrics->u.record->memory_actual;
+   else        
+       xen_vm_metrics_get_memory_actual(session, &blocks, 
resource->metrics->u.handle);
    CMSetProperty(instance, "ConsumableBlocks", (CMPIValue *)&blocks, 
CMPI_uint64);
- if ((resource->power_state == XEN_VM_POWER_STATE_RUNNING) ||
-       (resource->power_state == XEN_VM_POWER_STATE_SHUTTINGDOWN))
+ if (resource->power_state == XEN_VM_POWER_STATE_RUNNING) CMSetProperty(instance, "Status", (CMPIValue *)"OK", CMPI_chars);
    else
       CMSetProperty(instance, "Status", (CMPIValue *)"No Contact", CMPI_chars);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_Memory_Resource.h
--- a/src/Xen_Memory_Resource.h Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_Memory_Resource.h Wed Apr 04 22:46:28 2007 -0400
@@ -78,7 +78,8 @@ int Xen_Memory_freeResource(_RESOURCE * int Xen_Memory_freeResource(_RESOURCE * resource); /* Set the property values of a CMPI instance from a specific resource. */
-int Xen_Memory_setInstanceFromResource(_RESOURCE * resource,
+int Xen_Memory_setInstanceFromResource(xen_utils_session *session,
+                                      _RESOURCE * resource,
                                        const CMPIInstance * instance,
                                        const CMPIBroker * broker);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_NetworkPortSettingData_Resource.c
--- a/src/Xen_NetworkPortSettingData_Resource.c Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_NetworkPortSettingData_Resource.c Wed Apr 04 22:46:28 2007 -0400
@@ -251,10 +251,10 @@ int Xen_NetworkPortSettingData_setInstan
    nic_config_info[0] = '\0';
    if (resource->mac)
       snprintf(nic_config_info, 512, "mac=%s", resource->mac);
-   if (resource->model) {
+/*   if (resource->model) {
       strncat(nic_config_info, ",model=", 512 - strlen(nic_config_info));
       strncat(nic_config_info, resource->model, 512 - strlen(nic_config_info));
-   }
+   }Nic config info does have model*/
    if (nic_config_info[0] != '\0')
       CMSetProperty(instance, "NICConfigInfo" , (CMPIValue *)nic_config_info, 
CMPI_chars);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_NetworkPort_Resource.c
--- a/src/Xen_NetworkPort_Resource.c    Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_NetworkPort_Resource.c    Wed Apr 04 22:46:28 2007 -0400
@@ -262,10 +262,10 @@ int Xen_NetworkPort_setInstanceFromResou
    nic_config_info[0] = '\0';
    if (resource->mac)
       snprintf(nic_config_info, 512, "mac=%s", resource->mac);
-   if (resource->model) {
+   /*if (resource->model) {
       strncat(nic_config_info, ",model=", 512 - strlen(nic_config_info));
       strncat(nic_config_info, resource->model, 512 - strlen(nic_config_info));
-   }
+   } NIC config info does not have model*/
    if (nic_config_info[0] != '\0')
       CMSetProperty(instance, "NICConfigInfo" , (CMPIValue *)nic_config_info, 
CMPI_chars);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_OperatingSystem.c
--- a/src/Xen_OperatingSystem.c Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_OperatingSystem.c Wed Apr 04 22:46:28 2007 -0400
@@ -134,7 +134,7 @@ static CMPIStatus EnumInstanceNames(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_OperatingSystem_setInstanceFromResource(resource, instance, 
_BROKER)) {
+      if (!Xen_OperatingSystem_setInstanceFromResource(session,resource, 
instance, _BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -228,7 +228,7 @@ static CMPIStatus EnumInstances(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_OperatingSystem_setInstanceFromResource(resource, instance, 
_BROKER)) {
+      if (!Xen_OperatingSystem_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -320,7 +320,7 @@ static CMPIStatus GetInstance(
    }
/* Set the instance property values from the resource data. */
-   if (!Xen_OperatingSystem_setInstanceFromResource(resource, instance, 
_BROKER)) {
+   if (!Xen_OperatingSystem_setInstanceFromResource(session,resource, 
instance, _BROKER)) {
       _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
       CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
       goto exit;
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_OperatingSystem_Resource.c
--- a/src/Xen_OperatingSystem_Resource.c        Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_OperatingSystem_Resource.c        Wed Apr 04 22:46:28 2007 -0400
@@ -26,6 +26,7 @@
#include <xen_common.h>
 #include <xen_vm.h>
+#include <xen_vm_metrics.h>
#include "Xen_OperatingSystem_Resource.h" @@ -116,7 +117,8 @@ int Xen_OperatingSystem_freeResource(_RE // ---------------------------------------------------------------------------- /* Set the property values of a CMPI instance from a specific resource. */
-int Xen_OperatingSystem_setInstanceFromResource(_RESOURCE * resource,
+int Xen_OperatingSystem_setInstanceFromResource(xen_utils_session *session,
+                                               _RESOURCE * resource,
                                                 const CMPIInstance * instance,
                                                 const CMPIBroker * broker)
 {
@@ -171,12 +173,12 @@ int Xen_OperatingSystem_setInstanceFromR
          // Status is just a string (and deprecated), so just say Suspended
          CMSetProperty(instance, "Status",(CMPIValue *)"Suspended", 
CMPI_chars);
          break;
- +/* case XEN_VM_POWER_STATE_SHUTTINGDOWN:
          statusvalue = 9; // "Stopping"
          CMSetProperty(instance, "Status",(CMPIValue *)"Stopping", CMPI_chars);
          break;
-
+*/
       default:
          statusvalue = 0; // "Unknown"
          CMSetProperty(instance, "Status",(CMPIValue *)"No Contact", 
CMPI_chars);
@@ -192,8 +194,15 @@ int Xen_OperatingSystem_setInstanceFromR
    /*
     * TODO:
     * What memory_* field of xen_vm_record should we use here?
-    */
-   CMSetProperty(instance, "TotalVisibleMemorySize", (CMPIValue 
*)&(resource->memory_actual), CMPI_uint64);
+   */
+   int64_t memory=0;
+   // Get the memory_actual
+   if (resource->metrics->is_record)
+       memory=resource->metrics->u.record->memory_actual;
+   else        
+       xen_vm_metrics_get_memory_actual(session, &memory, 
resource->metrics->u.handle);
+ + CMSetProperty(instance, "TotalVisibleMemorySize", (CMPIValue *)&(memory), CMPI_uint64); return 1;
 }
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_OperatingSystem_Resource.h
--- a/src/Xen_OperatingSystem_Resource.h        Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_OperatingSystem_Resource.h        Wed Apr 04 22:46:28 2007 -0400
@@ -77,7 +77,8 @@ int Xen_OperatingSystem_freeResource(_RE
 int Xen_OperatingSystem_freeResource(_RESOURCE * resource);
/* Set the property values of a CMPI instance from a specific resource. */
-int Xen_OperatingSystem_setInstanceFromResource(_RESOURCE * resource,
+int Xen_OperatingSystem_setInstanceFromResource(xen_utils_session *session,
+                                               _RESOURCE * resource,
                                                 const CMPIInstance * instance,
                                                 const CMPIBroker * broker);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_ProcessorSettingData.c
--- a/src/Xen_ProcessorSettingData.c    Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_ProcessorSettingData.c    Wed Apr 04 22:46:28 2007 -0400
@@ -16,6 +16,7 @@
 // ============================================================================
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
+//               Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
 // Description:
 // ============================================================================
@@ -132,7 +133,7 @@ static CMPIStatus EnumInstanceNames(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_ProcessorSettingData_setInstanceFromResource(resource, 
instance, _BROKER)) {
+      if (!Xen_ProcessorSettingData_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -226,7 +227,7 @@ static CMPIStatus EnumInstances(
       }
/* Set the instance property values from the resource data. */
-      if (!Xen_ProcessorSettingData_setInstanceFromResource(resource, 
instance, _BROKER)) {
+      if (!Xen_ProcessorSettingData_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
          _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
          CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
          goto exit;
@@ -318,7 +319,7 @@ static CMPIStatus GetInstance(
    }
/* Set the instance property values from the resource data. */
-   if (!Xen_ProcessorSettingData_setInstanceFromResource(resource, instance, 
_BROKER)) {
+   if (!Xen_ProcessorSettingData_setInstanceFromResource(session, resource, 
instance, _BROKER)) {
       _SBLIM_TRACE(1,("--- _setInstanceFromResource() failed"));
       CMSetStatusWithChars(_BROKER, &status, CMPI_RC_ERR_FAILED, "Failed to set 
property values from resource data");
       goto exit;
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_ProcessorSettingData_Resource.c
--- a/src/Xen_ProcessorSettingData_Resource.c   Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_ProcessorSettingData_Resource.c   Wed Apr 04 22:46:28 2007 -0400
@@ -16,6 +16,7 @@
 // ============================================================================
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
+//               Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
 // Description:
 // ============================================================================
@@ -25,6 +26,7 @@ #include <xen_common.h>
 #include <xen_vm.h>
+#include <xen_vm_metrics.h>
#include "Xen_ProcessorSettingData_Resource.h" @@ -121,8 +123,11 @@ int Xen_ProcessorSettingData_freeResourc // ---------------------------------------------------------------------------- -/* Set the property values of a CMPI instance from a specific resource. */
-int Xen_ProcessorSettingData_setInstanceFromResource(_RESOURCE * resource,
+/* Set the property values of a CMPI instance from a specific resource. + We also pass in the session object so that the metrics class can be accessed when required.
+*/
+int Xen_ProcessorSettingData_setInstanceFromResource(xen_utils_session 
*session,
+                                                    _RESOURCE * resource,
                                                      const CMPIInstance * 
instance,
                                                      const CMPIBroker * broker)
 {
@@ -143,12 +148,15 @@ int Xen_ProcessorSettingData_setInstance
    int consumerVisibility = 3; /* 3 == Virtualized */
    CMSetProperty(instance, "ConsumerVisibility" , (CMPIValue 
*)&consumerVisibility, CMPI_uint16);
- unsigned long long cpus = 1;
+   int64_t cpus = 1;
    CMSetProperty(instance, "Reservation",(CMPIValue *)&cpus, CMPI_uint64);
    CMSetProperty(instance, "Limit",(CMPIValue *)&cpus, CMPI_uint64);
    CMSetProperty(instance, "AllocationUnits",(CMPIValue *)"Cores", CMPI_chars);
-   cpus = resource->vcpus_number;
-   CMSetProperty(instance, "VirtualQuantity",(CMPIValue *)&cpus, CMPI_uint64);
+   if (resource->metrics->is_record)
+       cpus=resource->metrics->u.record->vcpus_number;
+   else        
+       xen_vm_metrics_get_vcpus_number(session, &cpus, 
resource->metrics->u.handle);
+      CMSetProperty(instance, "VirtualQuantity",(CMPIValue *)&cpus, 
CMPI_uint64);
int alloctype = 1;
    CMSetProperty(instance, "AutomaticAllocation" , (CMPIValue *)&alloctype, 
CMPI_boolean);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_ProcessorSettingData_Resource.h
--- a/src/Xen_ProcessorSettingData_Resource.h   Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_ProcessorSettingData_Resource.h   Wed Apr 04 22:46:28 2007 -0400
@@ -76,7 +76,8 @@ int Xen_ProcessorSettingData_freeResourc
 int Xen_ProcessorSettingData_freeResource(_RESOURCE * resource);
/* Set the property values of a CMPI instance from a specific resource. */
-int Xen_ProcessorSettingData_setInstanceFromResource(_RESOURCE * resource,
+int Xen_ProcessorSettingData_setInstanceFromResource(xen_utils_session 
*session,
+                                                    _RESOURCE * resource,
                                                      const CMPIInstance * 
instance,
                                                      const CMPIBroker * 
broker);
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_Processor_Resource.c
--- a/src/Xen_Processor_Resource.c      Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_Processor_Resource.c      Wed Apr 04 22:46:28 2007 -0400
@@ -17,6 +17,7 @@
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 //                Tokunbo Adeshiyan, <tokunbo@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
+//               Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
 // Description:
 // ============================================================================
@@ -25,6 +26,7 @@ #include <xen_common.h>
 #include <xen_vm.h>
+#include <xen_vm_metrics.h>
#include "Xen_Processor_Resource.h" @@ -72,12 +74,14 @@ int Xen_Processor_freeResources(_RESOURC
 }
// ----------------------------------------------------------------------------
-
+// This function was changed to extract the vcpus_number value from the 
metrics structure rather
+// Raj - 04/04/2007
 /* Iterator to get the next resource from the resources list. */
 int Xen_Processor_getNextResource(xen_utils_session *session,
                                   _RESOURCES * resources,
                                   _RESOURCE ** resource)
 {
+   int64_t vcpus_number;
    if (resources == NULL) return 0;
/* Check if reached the end of the list of Xen domain names. */
@@ -97,8 +101,13 @@ int Xen_Processor_getNextResource(xen_ut
    resources->currentprocessornum++;
/* Return success while there are still processor devices for this domain. */
-   if (resources->currentprocessornum <= (*resource)->vcpus_number)
-      return 1;
+   // Get the vcpus_number
+   if ((*resource)->metrics->is_record)
+       vcpus_number=(*resource)->metrics->u.record->vcpus_number;
+   else        
+       xen_vm_metrics_get_vcpus_number(session, &vcpus_number, 
(*resource)->metrics->u.handle);
+   if (resources->currentprocessornum <= vcpus_number)
+ return 1; NextDomain:
    /* All processors in this domain have been exhausted. */
diff -r c37b7ff52b4f -r 25962bc0d49a 
src/Xen_VirtualSystemManagementCapabilities.c
--- a/src/Xen_VirtualSystemManagementCapabilities.c     Thu Mar 29 16:09:37 
2007 -0600
+++ b/src/Xen_VirtualSystemManagementCapabilities.c     Wed Apr 04 22:46:28 
2007 -0400
@@ -15,7 +15,7 @@
 //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
USA
 // ============================================================================
 // Authors:       Jim Fehlig, <jfehlig@xxxxxxxxxx>
-// Contributors:
+// Contributors: // Description: A class used to represent the capabilities of // Xen_VirtualSystemManagementService, e.g. which
 //                methods are supported.
diff -r c37b7ff52b4f -r 25962bc0d49a src/Xen_VirtualSystemManagementService.c
--- a/src/Xen_VirtualSystemManagementService.c  Thu Mar 29 16:09:37 2007 -0600
+++ b/src/Xen_VirtualSystemManagementService.c  Wed Apr 04 22:46:28 2007 -0400
@@ -16,6 +16,7 @@
 // ============================================================================
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
+//               Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
 // Description:
 // ============================================================================
@@ -34,6 +35,7 @@
 #include <xen_vif.h>
 #include <xen_vbd.h>
 #include <xen_console.h>
+#include <xen_vm_metrics.h>
 #include <xen_string_string_map.h>
/* Include utility functions */
@@ -1428,7 +1430,7 @@ static int add_resource_to_vm(xen_vm_rec
       }
/* Adding cpus means just that - adding to existing amount */
-      uint64_t cpus = propertyvalue.value.uint64 + vmRec->vcpus_number;
+ uint64_t cpus = propertyvalue.value.uint64 + vmRec->vcpus_number; /*
        * TODO:
        * 1. CPU weights and other scheduling parameters?
@@ -1688,8 +1690,8 @@ static int vssd2xenconfig(CMPIInstance *
                               "No BootOrder specified for HVM guest");
          return 0;
       }
-      vm_rec->hvm_boot = strdup(CMGetCharPtr(propertyvalue.value.string));
- + //vm_rec->hvm_boot_params = strdup(CMGetCharPtr(propertyvalue.value.string));
+      add_strings_to_map("order", 
CMGetCharPtr(propertyvalue.value.string),&(vm_rec->hvm_boot_params ));
       /* Default stdvga to 0 */
       plat_val = "0";
       propertyvalue = CMGetProperty(vssd, "stdvga", status);
@@ -1794,7 +1796,7 @@ static int vssd2xenconfig(CMPIInstance *
    return 1;
 }
-
+// Look for vcpus_number in the metrics structure.
 static int proc_rasd2vmconfig(CMPIInstance *proc_rasd, xen_vm_record *vm_rec,
                               CMPIStatus *status)
 {
@@ -1806,10 +1808,13 @@ static int proc_rasd2vmconfig(CMPIInstan
        * TODO:
        * 1. Handle defaults if processors not specified.
        * 2. CPU weights and other scheduling parameters?
+       
        */
-      vm_rec->vcpus_number = propertyvalue.value.uint64;
-
-      return 1;
+   if (vm_rec->metrics->is_record)
+       vm_rec->metrics->u.record->vcpus_number=propertyvalue.value.uint64;
+   else        
+       xen_vm_metrics_set_vcpus_number(session, propertyvalue.value.uint64, 
vm_rec->metrics->u.handle);  
+    return 1;
    }
return 0;
@@ -1866,7 +1871,7 @@ static int disk_rasd2vmconfig(CMPIInstan
          free(string);
          goto Error;
       }
-      (*vbd_rec)->image = strdup(tok);
+//      (*vbd_rec)->image = strdup(tok); VDI<->BBD issue
if ((tok = strtok_r(NULL, ",", &next_tok)) == NULL) {
          _SBLIM_TRACE(1,("--- Malformed DiskConfigInfo property in disk setting 
data"));
@@ -1888,7 +1893,7 @@ static int disk_rasd2vmconfig(CMPIInstan
          (*vbd_rec)->mode = XEN_VBD_MODE_RO;
free(string);
-      _SBLIM_TRACE(2,("--- uname = %s", (*vbd_rec)->image));
+      //_SBLIM_TRACE(2,("--- uname = %s", (*vbd_rec)->image));
       _SBLIM_TRACE(2,("--- dev = %s", (*vbd_rec)->device));
       _SBLIM_TRACE(2,("--- mode = %s",
                       (*vbd_rec)->mode == XEN_VBD_MODE_RW ? "RW" : "RO"));
@@ -1935,8 +1940,8 @@ static int nic_rasd2vmconfig(CMPIInstanc
    while (tok) {
       if (strncmp(tok, "mac", 3) == 0)
          (*vif_rec)->mac = strdup(tok + 4);
-      else if (strncmp(tok, "model", 5) == 0)
-         (*vif_rec)->model = strdup(tok + 6);
+/*      else if (strncmp(tok, "model", 5) == 0)
+ (*vif_rec)->model = strdup(tok + 6); Commented off to compile the code*/ tok = strtok_r(NULL, ",", &next_tok);
    }
diff -r c37b7ff52b4f -r 25962bc0d49a 
src/Xen_VirtualSystemManagementService_Resource.c
--- a/src/Xen_VirtualSystemManagementService_Resource.c Thu Mar 29 16:09:37 
2007 -0600
+++ b/src/Xen_VirtualSystemManagementService_Resource.c Wed Apr 04 22:46:28 
2007 -0400
@@ -16,6 +16,7 @@
 // ============================================================================
 // Authors:       Dr. Gareth S. Bestor, <bestor@xxxxxxxxxx>
 // Contributors:  Jim Fehlig, <jfehlig@xxxxxxxxxx>
+
 // Description:
 // ============================================================================
diff -r c37b7ff52b4f -r 25962bc0d49a src/xen_utils.c
--- a/src/xen_utils.c   Thu Mar 29 16:09:37 2007 -0600
+++ b/src/xen_utils.c   Wed Apr 04 22:46:28 2007 -0400
@@ -15,7 +15,7 @@
 //    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  
USA
 // ============================================================================
 // Authors:       Jim Fehlig, <jfehlig@xxxxxxxxxx>
-// Contributors:
+// Contributors:  Raj Subrahmanian <raj.subrahmanian@xxxxxxxxxx>
 // Description:   Utilitiy functions built on top of libxen for use in all
 //                providers.
 // ============================================================================
@@ -682,3 +682,25 @@ int xen_utils_is_domain_active(xen_utils
    return 1;
 }
+/*
+ * Extract the value from a string map given a key
+ *
+*/
+int xen_utils_get_value_from_map(xen_string_string_map *map, const char *key, 
char *val)
+{
+   int i=0;
+   // Make sure you have a good value
+   if(!map) return 0;
+   // String map is empty
+   if (map->size==0) return 0;
+   while (i<map->size)
+   {   // Found key
+       if (strcmp(key, map->contents[i].key)==0)
+       {
+        val=strdup(map->contents[i].val);
+        return 1;
+       }
+       i++;
+   }
+   return 0;
+}
\ No newline at end of file
diff -r c37b7ff52b4f -r 25962bc0d49a src/xen_utils.h
--- a/src/xen_utils.h   Thu Mar 29 16:09:37 2007 -0600
+++ b/src/xen_utils.h   Wed Apr 04 22:46:28 2007 -0400
@@ -179,5 +179,12 @@ int xen_utils_is_domain_active(xen_utils
                                int *isActive);
+/*
+ * Extract the value from a string map given a key
+ *
+*/
+int xen_utils_get_value_from_map(xen_string_string_map *map, const char *key, 
char *val);
+
+
#endif /* __XEN_UTILS_H__ */

_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim


_______________________________________________
Xen-cim mailing list
Xen-cim@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-cim

<Prev in Thread] Current Thread [Next in Thread>