os-cmpi-xen

changeset 97:c37b7ff52b4f sles10sp1

Added support for specifying VIF model in Xen_VirtualSystemManagementService.DefineSystem.

Also populate NICConfigInfo property in Xen_NetworkPort and Xen_NetworkPortSettingData.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
author Jim Fehlig <jfehlig@novell.com>
date Thu Mar 29 16:09:37 2007 -0600 (2007-03-29)
parents e717d287cf85
children aad84ea2d09e
files ChangeLog src/Xen_NetworkPortSettingData_Resource.c src/Xen_NetworkPort_Resource.c src/Xen_VirtualSystemManagementService.c
line diff
     1.1 --- a/ChangeLog	Tue Mar 27 16:04:49 2007 -0600
     1.2 +++ b/ChangeLog	Thu Mar 29 16:09:37 2007 -0600
     1.3 @@ -1,3 +1,11 @@
     1.4 +-------------------------------------------------------------------
     1.5 +Thu Mar 29 16:05:05 MDT 2007 - jfehlig@novell.com
     1.6 +
     1.7 +        - Added support for specifying VIF model in
     1.8 +          Xen_VirtualSystemManagementService.DefineSystem.
     1.9 +        - Populate NICConfigInfo property in Xen_NetworkPort and
    1.10 +          Xen_NetworkPortSettingData.
    1.11 +
    1.12  -------------------------------------------------------------------
    1.13  Tue Mar 27 16:01:43 MDT 2007 - jfehlig@novell.com
    1.14  
     2.1 --- a/src/Xen_NetworkPortSettingData_Resource.c	Tue Mar 27 16:04:49 2007 -0600
     2.2 +++ b/src/Xen_NetworkPortSettingData_Resource.c	Thu Mar 29 16:09:37 2007 -0600
     2.3 @@ -247,6 +247,17 @@ int Xen_NetworkPortSettingData_setInstan
     2.4     CMSetProperty(instance, "AutomaticAllocation" , (CMPIValue *)&alloctype, CMPI_boolean);
     2.5     CMSetProperty(instance, "AutomaticDeallocation" , (CMPIValue *)&alloctype, CMPI_boolean);
     2.6  
     2.7 +   char nic_config_info[512];
     2.8 +   nic_config_info[0] = '\0';
     2.9 +   if (resource->mac)
    2.10 +      snprintf(nic_config_info, 512, "mac=%s", resource->mac);
    2.11 +   if (resource->model) {
    2.12 +      strncat(nic_config_info, ",model=", 512 - strlen(nic_config_info));
    2.13 +      strncat(nic_config_info, resource->model, 512 - strlen(nic_config_info));
    2.14 +   }
    2.15 +   if (nic_config_info[0] != '\0')
    2.16 +      CMSetProperty(instance, "NICConfigInfo" , (CMPIValue *)nic_config_info, CMPI_chars);
    2.17 +   
    2.18     /*
    2.19      * TODO:
    2.20      * PoolID, Weight
     3.1 --- a/src/Xen_NetworkPort_Resource.c	Tue Mar 27 16:04:49 2007 -0600
     3.2 +++ b/src/Xen_NetworkPort_Resource.c	Thu Mar 29 16:09:37 2007 -0600
     3.3 @@ -258,6 +258,17 @@ int Xen_NetworkPort_setInstanceFromResou
     3.4        CMSetProperty(instance, "ActiveMaximumTransmissionUnit",(CMPIValue *)&(resource->mtu), CMPI_uint64);
     3.5     }
     3.6  
     3.7 +   char nic_config_info[512];
     3.8 +   nic_config_info[0] = '\0';
     3.9 +   if (resource->mac)
    3.10 +      snprintf(nic_config_info, 512, "mac=%s", resource->mac);
    3.11 +   if (resource->model) {
    3.12 +      strncat(nic_config_info, ",model=", 512 - strlen(nic_config_info));
    3.13 +      strncat(nic_config_info, resource->model, 512 - strlen(nic_config_info));
    3.14 +   }
    3.15 +   if (nic_config_info[0] != '\0')
    3.16 +      CMSetProperty(instance, "NICConfigInfo" , (CMPIValue *)nic_config_info, CMPI_chars);
    3.17 +
    3.18     if (vm_rec->power_state != XEN_VM_POWER_STATE_HALTED) {
    3.19        CMSetProperty(instance, "Status", (CMPIValue *)"OK", CMPI_chars);
    3.20     } else {
     4.1 --- a/src/Xen_VirtualSystemManagementService.c	Tue Mar 27 16:04:49 2007 -0600
     4.2 +++ b/src/Xen_VirtualSystemManagementService.c	Thu Mar 29 16:09:37 2007 -0600
     4.3 @@ -1935,17 +1935,13 @@ static int nic_rasd2vmconfig(CMPIInstanc
     4.4     while (tok) {
     4.5        if (strncmp(tok, "mac", 3) == 0)
     4.6           (*vif_rec)->mac = strdup(tok + 4);
     4.7 -      /*
     4.8 -       * TODO:
     4.9 -       * Map other config items in the NIC info to xen_vif_record struct.
    4.10 -       */
    4.11 +      else if (strncmp(tok, "model", 5) == 0)
    4.12 +         (*vif_rec)->model = strdup(tok + 6);
    4.13        
    4.14        tok = strtok_r(NULL, ",", &next_tok);
    4.15     }
    4.16     
    4.17     free(string);
    4.18 -   _SBLIM_TRACE(2,("--- mac = %s",
    4.19 -                   (*vif_rec)->mac ?  (*vif_rec)->mac : "not specified"));
    4.20     
    4.21     return 1;
    4.22  }
    4.23 @@ -2065,6 +2061,8 @@ static int add_strings_to_map(const char
    4.24     (*map)->contents[(*map)->size].key = strdup(key);
    4.25     (*map)->contents[(*map)->size].val = strdup(val);
    4.26     (*map)->size++;
    4.27 +
    4.28 +   return 1;
    4.29  }
    4.30  
    4.31