[PATCH v2 08/17] Change virDomainVcpuPinDefParseXML to support parsing emulatorpin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/conf/domain_conf.c |   22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 264adcc..9abf675 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7759,7 +7759,19 @@ cleanup:
     return ret;
 }
 
-/* Parse the XML definition for a vcpupin */
+/* Parse the XML definition for a vcpupin or emulatorpin.
+ *
+ * vcpupin has the form of
+ *
+ *   <vcpupin vcpu='0' cpuset='0'/>
+ *
+ * and emulatorpin has the form of
+ *
+ *   <emulatorpin cpuset='0'/>
+ *
+ * A vcpuid of -1 is valid and only valid for emulatorpin. So callers
+ * have to check the returned cpuid for validity.
+ */
 static virDomainVcpuPinDefPtr
 virDomainVcpuPinDefParseXML(const xmlNodePtr node,
                             xmlXPathContextPtr ctxt,
@@ -7767,7 +7779,7 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
 {
     virDomainVcpuPinDefPtr def;
     xmlNodePtr oldnode = ctxt->node;
-    unsigned int vcpuid;
+    unsigned int vcpuid = -1;
     char *tmp = NULL;
     int ret;
 
@@ -7783,13 +7795,9 @@ virDomainVcpuPinDefParseXML(const xmlNodePtr node,
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("vcpu id must be an unsigned integer"));
         goto error;
-    } else if (ret == -1) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("can't parse vcpupin node"));
-        goto error;
     }
 
-    if (vcpuid >= maxvcpus) {
+    if (vcpuid != -1 && vcpuid >= maxvcpus) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        "%s", _("vcpu id must be less than maxvcpus"));
         goto error;
-- 
1.7.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]