
const static CMPIBroker *_BROKER; @@ -202,8 +203,16 @@ static int xen_net_rasd_to_vdev(CMPIInst static int xen_net_rasd_to_vdev(CMPIInstance *inst, struct virt_device *dev) { + const char *val = NULL; + free(dev->dev.net.type); - dev->dev.net.type = strdup("bridge"); + dev->dev.net.type = strdup("network"); + + if (cu_get_str_prop(inst, "PoolID", &val) != CMPI_RC_OK) + val = "NetworkPool/default";
The default network pool isn't guaranteed to be present. In such a case, the creation of a guest using "network" will fail. Would it be possible to print a meaningful error message in this case? We currently print "Failed to create domain" which isn't very descriptive. Should we use the libvirt API to attempt to discover an available pool? Also, why define val as "NetworkPool/default" just to strip out the "NetworkPool/" piece later on? Is this for clarity / readability reasons?
+static int net_rasd_to_vdev(CMPIInstance *inst, + struct virt_device *dev) +{ + const char *val = NULL; + CMPIObjectPath *op; + + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) + val = "00:00:00:00:00:00";
Why does this value differ from the random value assigned in the default NetRASD? I guess this brings up the question - should we be pulling these defaults from the default RASDs? Or should we not assume defaults at all and fail if an attribute we need isn't supplied? The problem I see is that the profiles don't explicitly define what attributes are required. It seems that the default RASDs define this for us in some cases, but not all (see VirtualDevice and Address for disk devices). Should these values be placed in the default RASDs as well? Either way, I'm not sure it's meaningful to use a default value for something such as the mac address. Maybe a distinction could be made - for things like network pool, we can use a default (a statically defined one as included above, or a discover a pool if available). For something like a mac address, which really should be supplied by the user, we can fail. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com