Signed-off-by: Xu Wang <[email protected]>
---
 libxkutil/device_parsing.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index d93ba7b..2b3ca81 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -1014,7 +1014,21 @@ static int parse_vcpu_device(xmlNode *node, struct 
virt_device **vdevs)
         char *count_str;
         int count;
 
-        count_str = get_node_content(node);
+        CU_DEBUG("Enter parse_vcpu_device().");
+
+        list = calloc(1, sizeof(*list));
+        if (list == NULL) {
+                CU_DEBUG("calloc failed.");
+                goto err;
+        }
+
+        list->dev.vcpu.others = parse_data_to_others(node, BAD_CAST "domain");
+
+        count_str = fetch_from_others(&list->dev.vcpu.others,
+                                      "vcpu",
+                                      TYPE_NODE,
+                                      "domain");
+
         if (count_str == NULL)
                 count = 1; /* Default to 1 VCPU if non specified */
         else if (sscanf(count_str, "%i", &count) != 1)
@@ -1022,10 +1036,6 @@ static int parse_vcpu_device(xmlNode *node, struct 
virt_device **vdevs)
 
         free(count_str);
 
-        list = calloc(1, sizeof(*list));
-        if (list == NULL)
-                goto err;
-        
         list->dev.vcpu.quantity = count;
 
         list->type = CIM_RES_TYPE_PROC;
-- 
1.7.1

_______________________________________________
Libvirt-cim mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvirt-cim

Reply via email to