# HG changeset patch
# User Sharad Mishra <snmishra(a)us.ibm.com>
# Date 1279667490 18000
# Node ID 74e5764714b5e172ce703aee980544d7bc0d03b5
# Parent ad15531492da607d5aa44a4fa2c67f6ef41a6e1b
NetRASD enumeration to show VSI fields.
This fixes the bug where VSI fields were not populated for NetRASD.
Signed-off-by: Sharad Mishra <snmishra(a)us.ibm.com>
diff -r ad15531492da -r 74e5764714b5 libxkutil/device_parsing.c
--- a/libxkutil/device_parsing.c Wed Jul 14 11:54:31 2010 -0400
+++ b/libxkutil/device_parsing.c Tue Jul 20 18:11:30 2010 -0500
@@ -77,7 +77,6 @@
free(dev->model);
free(dev->device);
free(dev->net_mode);
- cleanup_vsi_device(&dev->vsi);
}
static void cleanup_emu_device(struct emu_device *dev)
@@ -296,11 +295,55 @@
}
}
+static int parse_vsi_device(xmlNode *dnode, struct net_device *vdevs)
+{
+ struct vsi_device *vsi_dev = NULL;
+ xmlNode * child = NULL;
+
+ vsi_dev = calloc(1, sizeof(*vsi_dev));
+ if (vsi_dev == NULL)
+ goto err;
+
+ vsi_dev->vsi_type = get_attr_value(dnode, "type");
+ if (vsi_dev->vsi_type == NULL)
+ goto err;
+
+ for (child = dnode->children; child != NULL; child = child->next) {
+ if (XSTREQ(child->name, "parameters")) {
+ vsi_dev->manager_id = get_attr_value(child,
+ "managerid");
+ if (vsi_dev->manager_id == NULL)
+ goto err;
+
+ vsi_dev->type_id = get_attr_value(child,
"typeid");
+ if (vsi_dev->type_id == NULL)
+ goto err;
+
+ vsi_dev->type_id_version =
+ get_attr_value(child, "typeidversion");
+ if (vsi_dev->type_id_version == NULL)
+ goto err;
+
+ vsi_dev->instance_id = get_attr_value(child,
+ "instanceid");
+ vsi_dev->profile_id = get_attr_value(child,
+ "profileid");
+ }
+ }
+
+ memcpy(&(vdevs->vsi), vsi_dev, sizeof(*vsi_dev));
+ return 1;
+
+err:
+ cleanup_vsi_device(vsi_dev);
+ free(vsi_dev);
+ return 0;
+}
+
static int parse_net_device(xmlNode *inode, struct virt_device **vdevs)
{
struct virt_device *vdev = NULL;
struct net_device *ndev = NULL;
- struct vsi_device *vsi_dev = NULL;
xmlNode *child = NULL;
vdev = calloc(1, sizeof(*vdev));
@@ -308,7 +351,6 @@
goto err;
ndev = &(vdev->dev.net);
- vsi_dev = &(ndev->vsi);
ndev->type = get_attr_value(inode, "type");
if (ndev->type == NULL)
@@ -340,24 +382,7 @@
if (ndev->model == NULL)
goto err;
} else if (XSTREQ(child->name, "virtualport")) {
- vsi_dev->vsi_type = get_attr_value(child, "type");
- if (vsi_dev->vsi_type == NULL)
- goto err;
- } else if (XSTREQ(child->name, "parameters")) {
- vsi_dev->manager_id = get_attr_value(child,
"managerid");
- if (vsi_dev->manager_id == NULL)
- goto err;
-
- vsi_dev->type_id = get_attr_value(child,
"typeid");
- if (vsi_dev->type_id == NULL)
- goto err;
-
- vsi_dev->type_id_version = get_attr_value(child,
"typeidversion");
- if (vsi_dev->type_id_version == NULL)
- goto err;
-
- vsi_dev->instance_id = get_attr_value(child,
"instanceid");
- vsi_dev->profile_id = get_attr_value(child,
"profileid");
+ parse_vsi_device(child, ndev);
}
}
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Chip Vincent
Open Virtualization, Linux Technology Center
IBM Systems & Technology Group
phone: 919-254-4482, T/L 444-4482
email: cvincent(a)us.ibm.com