
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@us.ibm.com