[Libvirt-cim] [PATCH] [RFC] ProcessorRASD, the class that won't go away

Dan Smith danms at us.ibm.com
Thu Apr 24 15:57:43 UTC 2008


JG> +static bool device_instances(const CMPIBroker *broker,
JG> +                             struct virt_device *devs,
JG> +                             int count,
JG> +                             const virDomainPtr dom,
JG> +                             const char *ns,
JG> +                             struct inst_list *list)
JG> +{
JG> +        int i;
JG> +        bool ret;
JG> +        uint64_t proc_count = 0;
JG> +        bool proc_found = false;
JG> +        CMPIInstance *instance = NULL;
JG> +
JG> +        for (i = 0; i < count; i++) {
JG> +                struct virt_device *dev = &devs[i];
JG> +
JG> +                if (dev->type == CIM_RES_TYPE_NET)
JG> +                        instance = net_instance(broker,
JG> +                                                &dev->dev.net,
JG> +                                                dom,
JG> +                                                ns);
JG> +                else if (dev->type == CIM_RES_TYPE_DISK)
JG> +                        instance = disk_instance(broker,
JG> +                                                 &dev->dev.disk,
JG> +                                                 dom,
JG> +                                                 ns);
JG> +                else if (dev->type == CIM_RES_TYPE_MEM)
JG> +                        instance = mem_instance(broker,
JG> +                                                &dev->dev.mem,
JG> +                                                dom,
JG> +                                                ns);
JG> +                else if (dev->type == CIM_RES_TYPE_PROC) {
JG> +                        proc_found = true;
JG> +                        proc_count = dev->dev.vcpu.quantity;
JG> +                        continue;
JG> +                } else
JG> +                        return false;

I don't think you need proc_found.

JG> +
JG> +                if (!instance)
JG> +                        return false;
JG> +                
JG> +                device_set_devid(instance, dev, dom);
JG> +                device_set_systemname(instance, dom);
JG> +                inst_list_add(list, instance);
JG> +        }
JG> +
JG> +        if (proc_count) {

This should be:

  if (proc_count > 0) {

JG> +                ret = vcpu_instances(broker,
JG> +                                     dom,
JG> +                                     ns,
JG> +                                     proc_count,
JG> +                                     list);
JG> +        }
JG> +
JG> +        return true;
JG>  }

Also, a quick comment in here about why the processor case is so
strange would be good.  We know why because we've been over it too
many times, but for future generations, this might be a bit hard to
figure out :)

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20080424/f269b646/attachment.sig>


More information about the Libvirt-cim mailing list