Skip to contentSkip to conversation

xm: Fix xm network-list for XenAPI

PATCH New Masaki Kanno 1 participant 1 message Feb 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xm: Fix xm network-list for XenAPI

Hi,

When I use XenAPI, MAC addresses are not shown by xm network-list.

# xm network-list vm1
Idx BE     MAC Addr.     handle state evt-ch tx-/rx-ring-ref BE-path
0   0  ??                   0     4      8     2304 /2305    /local/domain/0/backend/vif/3/0  
1   0  ??                   1     4      9     2306 /2307    /local/domain/0/backend/vif/3/1  
2   0  ??                   2     4      10    2308 /2309    /local/domain/0/backend/vif/3/2  
3   0  ??                   3     4      11    2310 /2311    /local/domain/0/backend/vif/3/3  

MAC addresses are shown by this patch.

# xm network-list vm1
Idx BE     MAC Addr.     handle state evt-ch tx-/rx-ring-ref BE-path
0   0  11:22:33:44:55:60    0     4      8     2304 /2305    /local/domain/0/backend/vif/3/0  
1   0  11:22:33:44:55:61    1     4      9     2306 /2307    /local/domain/0/backend/vif/3/1  
2   0  11:22:33:44:55:62    2     4      10    2308 /2309    /local/domain/0/backend/vif/3/2  
3   0  11:22:33:44:55:63    3     4      11    2310 /2311    /local/domain/0/backend/vif/3/3  

Best regards,
Kan

tools/python/xen/xm/main.py +5 -2
diff -r b4041e7bbe1b tools/python/xen/xm/main.py
@@ -2144,8 +2144,11 @@
 
     if serverType == SERVER_XEN_API:
         vif_refs = server.xenapi.VM.get_VIFs(get_single_vm(dom))
-        vif_properties = \
-            map(server.xenapi.VIF.get_runtime_properties, vif_refs)
+        vif_properties = []
+        for vif_ref in vif_refs:
+            vif_property = server.xenapi.VIF.get_runtime_properties(vif_ref)
+            vif_property['mac'] = server.xenapi.VIF.get_MAC(vif_ref)
+            vif_properties.append(vif_property)
         devs = map(lambda (handle, properties): [handle, map2sxp(properties)],
                    zip(range(len(vif_properties)), vif_properties))
     else:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel