]> xenbits.xensource.com Git - libvirt.git/commitdiff
domain: Keep assigned class_id in domstatus XML
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 4 Dec 2012 15:38:02 +0000 (16:38 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 11 Dec 2012 17:42:54 +0000 (18:42 +0100)
Interfaces keeps a class_id, which is an ID from which bridge
part of QoS settings is derived. We need to store class_id
in domain status file, so we can later pass it to
virNetDevBandwidthUnplug.

src/conf/domain_conf.c

index 18e65ca834b2b44adc081a165d74a3f4de289ed1..f5e2f71c48ee2f733cf86616324ba69c7f1ea13c 100644 (file)
@@ -4819,6 +4819,17 @@ virDomainActualNetDefParseXML(xmlNodePtr node,
                                        hostdev, flags) < 0) {
             goto error;
         }
+    } else if (actual->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
+        char *class_id = virXPathString("string(./class/@id)", ctxt);
+        if (class_id &&
+            virStrToLong_ui(class_id, NULL, 10, &actual->class_id) < 0) {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Unable to parse class id '%s'"),
+                           class_id);
+            VIR_FREE(class_id);
+            goto error;
+        }
+        VIR_FREE(class_id);
     }
 
     bandwidth_node = virXPathNode("./bandwidth", ctxt);
@@ -12511,6 +12522,8 @@ virDomainActualNetDefFormat(virBufferPtr buf,
         break;
 
     case VIR_DOMAIN_NET_TYPE_NETWORK:
+        if (def->class_id)
+            virBufferAsprintf(buf, "<class id='%u'/>", def->class_id);
         break;
     default:
         virReportError(VIR_ERR_INTERNAL_ERROR,