
diff -r a57141febd4a -r 27f3f7f05eb7 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Fri Jun 12 16:14:40 2009 -0700 +++ b/libxkutil/device_parsing.h Tue Jun 16 13:35:31 2009 -0700 @@ -47,6 +47,7 @@ char *mac; char *source; char *model; + char *name;
This is a hard tab, it should be 8 spaces.
diff -r a57141febd4a -r 27f3f7f05eb7 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Fri Jun 12 16:14:40 2009 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Tue Jun 16 13:35:31 2009 -0700 @@ -59,6 +59,7 @@
#define DEFAULT_MAC_PREFIX "00:16:3e" #define DEFAULT_XEN_WEIGHT 1024 +#define BRIDGE_TYPE "bridge"
const static CMPIBroker *_BROKER;
@@ -553,7 +554,20 @@ dev->id = strdup(dev->dev.net.mac);
free(dev->dev.net.type); - dev->dev.net.type = strdup("network"); + if (cu_get_str_prop(inst, "NetworkType", &val) == CMPI_RC_OK) { + if (STREQC(val, BRIDGE_TYPE)) { + dev->dev.net.type = strdup(BRIDGE_TYPE); + if (cu_get_str_prop(inst, "NetworkName", &val) == + CMPI_RC_OK) { + dev->dev.net.name = strdup(val); + } else { + return "No Network bridge name specified"; + } + } else { + dev->dev.net.type = strdup("network");
This will cause a seg fault if the user doesn't specify a value for the NetworkType attribute. So you'll either need to make NetworkType mandatory (and return an error if its not specified), or allow the guest to be crated with a network type interface in the case where 1) NetworkType is specified 2) NetworkType is "network"
+ } + } +
if (cu_get_str_prop(inst, "PoolID", &val) != CMPI_RC_OK) val = _default_network(inst, ns);
For either case, these lines need to be moved as appropriate. If the interface type is bridge, you'll want to ignore the PoolID value (or return an error - since the PoolID value should only be set for network type interfaces). Also, the following lines only pertain to network interface types: if (val == NULL) return "No NetworkPool specified and no default available"; free(dev->dev.net.source); dev->dev.net.source = name_from_pool_id(val); This bit of code shouldn't be executed for bridge type interfaces. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com