[Libvirt-cim] [PATCH 2 of 2] Add boot order support

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Thu May 14 01:34:05 UTC 2009


> +
> +                        tmp_list = (char **)realloc(blist, 
> +                                                    (bl_size+1) * 

Style-wise, the rest of the code uses (bl_size + 1).


> diff -r c0bd6c9a2c00 -r e3ea69df8ae9 libxkutil/xml_parse_test.c
> --- a/libxkutil/xml_parse_test.c	Mon May 11 16:47:15 2009 -0300
> +++ b/libxkutil/xml_parse_test.c	Wed May 13 14:55:21 2009 -0300
> @@ -28,6 +28,7 @@
>  static void print_os(struct domain *dom,
>                       FILE *d)
>  {
> +        int i;
> 
>          if (dom->type == DOMAIN_XENPV) {
>                  print_value(d, "Domain Type", "Xen PV");
> @@ -39,13 +40,18 @@
>                  print_value(d, "Domain Type", "Xen FV");
>                  print_value(d, "Type", dom->os_info.fv.type);
>                  print_value(d, "Loader", dom->os_info.fv.loader);
> -                print_value(d, "Boot", dom->os_info.fv.boot);
> 
> +                for (i = 0; i < dom->os_info.fv.bootlist_size; i++) {

This should be bootlist_ct.

> +                        print_value(d, "Boot", dom->os_info.fv.bootlist[i]);
> +                }
>          } else if ((dom->type == DOMAIN_KVM) || (dom->type == DOMAIN_QEMU)) {
>                  print_value(d, "Domain Type", "KVM/QEMU");
>                  print_value(d, "Type", dom->os_info.fv.type);
>                  print_value(d, "Loader", dom->os_info.fv.loader);
> -                print_value(d, "Boot", dom->os_info.fv.boot);
> +
> +                for (i = 0; i < dom->os_info.fv.bootlist_size; i++) {

Same here.


> +                }
> +
> +                for (i = 0; i < bl_size; i++) {
> +                        CMPIString *cm_str;
> +
> +                        cm_str = CMNewString(_BROKER,
> +                                             (const char *)dominfo->os_info.fv.bootlist[i],
> +                                             &s);
> +                        if (s.rc != CMPI_RC_OK) {
> +                                CU_DEBUG("Error adding item to BootDevice " 
> +                                         "list");
> +                                continue;
> +                        }
> +
> +                        s = CMSetArrayElementAt(array,
> +                                                i,
> +                                                cm_str,

This should be (CMPIValue *)&cm_str

> +                                                CMPI_string);
> +                        if (s.rc != CMPI_RC_OK)
> +                                CU_DEBUG("Error setting BootDevice array "
> +                                         "element");
> +                }
> +
> +                s = CMSetProperty(inst,
> +                                  "BootDevices",
> +                                  (CMPIValue *)array,

This should be (CMPIValue *)&array

> +
> +        } else {
> +                
> +                CU_DEBUG("Failed to get BootDevices property");
> +
> +                tmp_str_arr = (char **)realloc(domain->os_info.fv.bootlist,
> +                                               sizeof(char *));
> +                if (tmp_str_arr == NULL)
> +                        return 0;
> +
> +                tmp_str_arr[0] = strdup("hd");
> +
> +                domain->os_info.fv.bootlist = tmp_str_arr;
> +                domain->os_info.fv.bootlist_ct = 1;
> +        }
> 

Since you've added this here, I would remove the code that adds a 
default boot device in xmlgen - that allows you to remove some duplicate 
code.  Plus, this follows convention - most of the defaults are set in 
VSMS - not in xmlgen itself.
-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list