[PATCH] Show Xen vif<domid>.<n> device name in domain XML

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

 



This patch changes the Xen domain XML so that it shows the target device (ie. vif<domid>.<n>), which you can then use to collect interface stats.

For example:

# virsh dumpxml fc6_1
  ...
    <interface type='bridge'>
      <source bridge='xenbr0'/>
      <target dev='vif2.0'/>
      <mac address='00:16:3e:1a:2f:8c'/>
      <script path='vif-bridge'/>
    </interface>

Note that this patch only adds to the XML, it doesn't change any XML that was being returned before.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.133
diff -u -p -r1.133 xend_internal.c
--- src/xend_internal.c	16 Aug 2007 15:38:38 -0000	1.133
+++ src/xend_internal.c	20 Aug 2007 16:22:55 -0000
@@ -1354,6 +1354,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
     int max_mem, cur_mem;
     unsigned char uuid[VIR_UUID_BUFLEN];
     char uuidstr[VIR_UUID_STRING_BUFLEN];
+    int vif_index = 0;
 
     if (root == NULL) {
         /* ERROR */
@@ -1626,6 +1627,9 @@ xend_parse_sexp_desc(virConnectPtr conn,
             if (tmp)
                 virBufferVSprintf(&buf, "      <target dev='%s'/>\n",
                                   tmp);
+            else
+                virBufferVSprintf(&buf, "      <target dev='vif%d.%d'/>\n",
+                                  domid, vif_index);
             tmp = sexpr_node(node, "device/vif/mac");
             if (tmp)
                 virBufferVSprintf(&buf, "      <mac address='%s'/>\n",
@@ -1639,6 +1643,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
                                   tmp2);
 
             virBufferAdd(&buf, "    </interface>\n", 17);
+            vif_index++;
         } else if (sexpr_lookup(node, "device/vfb")) {
             /* New style graphics config for PV guests in >= 3.0.4,
              * or for HVM guests in >= 3.0.5 */

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
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]