Change in vdsm[master]: hostdev: report 'net' devices and their interface name

danken at redhat.com danken at redhat.com
Sun Dec 7 01:30:27 UTC 2014


Dan Kenigsberg has uploaded a new change for review.

Change subject: hostdev: report 'net' devices and their interface name
......................................................................

hostdev: report 'net' devices and their interface name

Change-Id: If70f9c1c679fc911284b2c34f962ac6057f7517c
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/hostdevTests.py
M vdsm/hostdev.py
2 files changed, 26 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/12/35912/1

diff --git a/tests/hostdevTests.py b/tests/hostdevTests.py
index 4b39cb4..fa91b82 100644
--- a/tests/hostdevTests.py
+++ b/tests/hostdevTests.py
@@ -241,6 +241,20 @@
     </device>
     """
 
+_NET_DEVICE = """
+<device>
+  <name>net_em1_28_d2_44_55_66_88</name>
+  <path>/sys/devices/pci0000:00/0000:00:19.0/net/em1</path>
+  <parent>pci_0000_00_19_0</parent>
+  <capability type='net'>
+    <interface>em1</interface>
+    <address>28:d2:44:55:66:88</address>
+    <link state='down'/>
+    <capability type='80203'/>
+  </capability>
+</device>
+"""
+
 
 DEVICES_PARSED = {u'pci_0000_00_1b_0': {'product': '6 Series/C200 Series '
                                         'Chipset Family High Definition '
@@ -310,6 +324,12 @@
                             'parent': 'computer',
                             'iommu_group': '4',
                             'vendor_id': '0x8086', 'capability': 'pci'}
+
+_NET_DEVICE_PARSED = {
+    'parent': 'pci_0000_00_19_0',
+    'capability': 'net',
+    'interface': 'em1',
+}
 
 DEVICE_TO_VM_MAPPING = {'usb_1_1_4': 'vmId1', 'pci_0000_00_19_0': 'vmId2'}
 
@@ -382,6 +402,11 @@
 
         self.assertEquals(ADDITIONAL_DEVICE_PARSED, deviceXML)
 
+    def testParseNetDeviceParams(self):
+        deviceXML = hostdev._parse_device_params(_NET_DEVICE)
+
+        self.assertEquals(_NET_DEVICE_PARSED, deviceXML)
+
     def testGetDevicesFromLibvirt(self):
         libvirt_devices = hostdev._get_devices_from_libvirt()
 
diff --git a/vdsm/hostdev.py b/vdsm/hostdev.py
index 510c567..5c90d4e 100644
--- a/vdsm/hostdev.py
+++ b/vdsm/hostdev.py
@@ -40,7 +40,7 @@
     caps = devXML.find('capability')
     params['capability'] = caps.attrib['type']
 
-    for element in ('vendor', 'product'):
+    for element in ('vendor', 'product', 'interface'):
         elementXML = caps.find(element)
         if elementXML is not None:
             if 'id' in elementXML.attrib:


-- 
To view, visit http://gerrit.ovirt.org/35912
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If70f9c1c679fc911284b2c34f962ac6057f7517c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list