[Libvirt-cim] [PATCH] Add support for EmulatedType 1 to SDC

Richard Maciel rmaciel at linux.vnet.ibm.com
Fri Jan 23 17:19:37 UTC 2009


+1

Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1232129948 28800
> # Node ID 2409abcca2b26accdb8529a0951b42446ddcc1f0
> # Parent  8c56ab06aeb9b89f419f1befe6182c92ad5edbb8
> Add support for EmulatedType 1 to SDC.
> 
> Also fix a bug with the if statement in set_disk_props() and a spacing bug.
> 
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
> 
> diff -r 8c56ab06aeb9 -r 2409abcca2b2 src/Virt_SettingsDefineCapabilities.c
> --- a/src/Virt_SettingsDefineCapabilities.c	Wed Jan 14 08:41:52 2009 -0800
> +++ b/src/Virt_SettingsDefineCapabilities.c	Fri Jan 16 10:19:08 2009 -0800
> @@ -611,13 +611,13 @@
>                                   const CMPIObjectPath *ref,
>                                   const char *id,
>                                   uint64_t disk_size,
> +                                 uint16_t emu_type,
>                                   struct inst_list *list)
>  {
>          const char *addr;
>          const char *dev;
>          CMPIInstance *inst;
>          CMPIStatus s = {CMPI_RC_OK, NULL};
> -        uint16_t emu_type = 0;
> 
>          if (type == DOMAIN_LXC) {
>                  addr = "/tmp";
> @@ -646,7 +646,7 @@
>                          dev = "xvda";
>                          CMSetProperty(inst, "Caption",
>                                        (CMPIValue *)"PV disk", CMPI_chars);
> -                } else if (type, DOMAIN_XENFV) {
> +                } else if (type == DOMAIN_XENFV) {
>                          CMSetProperty(inst, "Caption",
>                                        (CMPIValue *)"FV disk", CMPI_chars);
>                  }
> @@ -671,6 +671,7 @@
>          char *pfx;
>          const char *id;
>          uint64_t disk_size;
> +        uint16_t emu_type = 0;
>          CMPIStatus s = {CMPI_RC_OK, NULL};
> 
>          switch(template_type) {
> @@ -702,16 +703,54 @@
>          pfx = class_prefix_name(CLASSNAME(ref));
> 
>          if (STREQ(pfx, "Xen")) {
> -                s = set_disk_props(DOMAIN_XENPV, ref, id, disk_size, list); 
> -                
> +                int xen_type[2] = {DOMAIN_XENFV, DOMAIN_XENPV};
> +                int i = 0;
> + 
> +                for (; i < 2; i++) {
> +                        emu_type = 0;
> +                        s = set_disk_props(xen_type[i],
> +                                           ref, 
> +                                           id, 
> +                                           disk_size, 
> +                                           emu_type, 
> +                                           list); 
> +                        if (s.rc != CMPI_RC_OK)
> +                                goto out;
> +
> +                        emu_type = 1;
> +                        s = set_disk_props(xen_type[i],
> +                                           ref, 
> +                                           id, 
> +                                           disk_size, 
> +                                           emu_type, 
> +                                           list); 
> +                        if (s.rc != CMPI_RC_OK)
> +                                goto out;
> +                }
> +        } else if (STREQ(pfx, "KVM")) {
> +                s = set_disk_props(DOMAIN_KVM,
> +                                   ref, 
> +                                   id, 
> +                                   disk_size, 
> +                                   emu_type, 
> +                                   list); 
>                  if (s.rc != CMPI_RC_OK)
> -                       goto out;
> +                        goto out;
> 
> -                s = set_disk_props(DOMAIN_XENFV, ref, id, disk_size, list); 
> -        } else if (STREQ(pfx, "KVM")) {
> -                s = set_disk_props(DOMAIN_KVM, ref, id, disk_size, list); 
> +                emu_type = 1; 
> +                s = set_disk_props(DOMAIN_KVM,
> +                                   ref, 
> +                                   id, 
> +                                   disk_size, 
> +                                   emu_type, 
> +                                   list); 
>          } else if (STREQ(pfx, "LXC")) {
> -                s = set_disk_props(DOMAIN_LXC, ref, id, disk_size, list); 
> +                s = set_disk_props(DOMAIN_LXC,
> +                                   ref, 
> +                                   id, 
> +                                   disk_size, 
> +                                   emu_type, 
> +                                   list); 
>          } else {
>                  cu_statusf(_BROKER, &s, 
>                              CMPI_RC_ERR_FAILED,
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim


-- 
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list