Piotr Kliczewski has uploaded a new change for review. Change subject: yml: return type fixes for Host.hostdevListByCaps ......................................................................
yml: return type fixes for Host.hostdevListByCaps Signed-off-by: Piotr Kliczewski <[email protected]> Change-Id: I6ad09c310a76dde9267824a337fadf3b1c02bd45 --- M lib/api/vdsm-api.yml M tests/vdsmapi_test.py 2 files changed, 178 insertions(+), 54 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/03/59703/1 diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml index 6cb6c9a..a289b7f 100644 --- a/lib/api/vdsm-api.yml +++ b/lib/api/vdsm-api.yml @@ -1382,57 +1382,119 @@ type: *BandwidthCurve type: object + HostDeviceAddress: &HostDeviceAddress + description: A host device address + name: HostDeviceAddress + properties: + - description: bus + name: bus + type: string + datatype: uint + + - defaultvalue: no-default + description: device + name: device + type: string + datatype: uint + + - defaultvalue: no-default + description: slot + name: slot + type: string + datatype: uint + + - defaultvalue: no-default + description: domain + name: domain + type: string + datatype: uint + + - defaultvalue: no-default + description: function + name: function + type: string + datatype: uint + + - defaultvalue: no-default + description: host + name: host + type: string + datatype: uint + + - defaultvalue: no-default + description: target + name: target + type: string + datatype: uint + + - defaultvalue: no-default + description: lun + name: lun + type: string + datatype: uint + type: object + HostDeviceParams: &HostDeviceParams added: '3.6' description: A host device parameters name: HostDeviceParams properties: - - description: The iommu group which the device belongs - to - name: iommu_group - type: uint - - description: The capability of the device (usually pci, usb_device, scsi) name: capability type: string - - description: String representation of the vendor + - defaultvalue: no-default + description: String representation of the vendor name: vendor type: string - - defaultvalue: null - description: Name of the physical function that this - VF belongs to. Also reported for physical function - itself, therefore in order to detect PF one must - consider the tuple (totalvfs, physfn). (if sriov - capable) - name: physfn - type: string - - - defaultvalue: null - description: Number of available virtual functions - (if sriov capable) - name: totalvfs - type: uint - - - description: Hexadecimal representation of the vendor + - defaultvalue: no-default + description: Hexadecimal representation of the vendor name: vendor_id type: string - - description: String representation of the product + - defaultvalue: no-default + description: String representation of the product specified by vendor name: product type: string - - description: Name of the parent device + - defaultvalue: no-default + description: Name of the parent device name: parent type: string - - description: Hexadecimal representation of the product + - defaultvalue: no-default + description: Hexadecimal representation of the product specified by vendor name: product_id type: string + + - defaultvalue: no-default + description: Assignable flag + name: is_assignable + type: boolean + + - defaultvalue: no-default + description: Values like usbhid, usb, qxl or sd + name: driver + type: string + + - defaultvalue: no-default + description: Network interface assigned to a device + name: interface + type: string + + - defaultvalue: no-default + description: device udev path + name: udev_path + type: string + + - defaultvalue: no-default + description: device address + name: address + type: *HostDeviceAddress type: object HostDevice: &HostDevice @@ -1447,13 +1509,12 @@ HostDevices: &HostDevices added: '3.6' - description: Mapping of devices to their assignments + description: Mapping of device names to device details name: HostDevices - properties: - - description: Name of the device - name: deviceName - type: *HostDevice - type: object + key-type: string + name: HostDevices + type: map + value-type: *HostDevice HostJobStatus: &HostJobStatus added: '4.0' @@ -7432,8 +7493,7 @@ - string return: description: A list of devices on the host - type: - - *HostDevices + type: *HostDevices Host.hostdevChangeNumvfs: added: '3.6' diff --git a/tests/vdsmapi_test.py b/tests/vdsmapi_test.py index fac3bf4..bff578c 100644 --- a/tests/vdsmapi_test.py +++ b/tests/vdsmapi_test.py @@ -270,27 +270,6 @@ _schema.schema().verify_retval( vdsmapi.MethodRep('Host', 'getStats'), ret) - def test_badly_defined_ret_type(self): - ret = {u'pci_0000_00_1b_0': - {u'params': - {u'product': u'7 Series/C210 Series Chipset Family ', - u'vendor': u'Intel Corporation', - u'product_id': u'0x1e20', - u'parent': u'computer', - u'vendor_id': u'0x8086', - u'capability': u'pci', - u'address': {u'slot': u'27', - u'bus': u'0', - u'domain': u'0', - u'function': u'0'}}}} - - # type definition is broken for this verb - with self.assertRaises(JsonRpcError) as e: - _schema.schema().verify_retval( - vdsmapi.MethodRep('Host', 'hostdevListByCaps'), ret) - - self.assertIn('is not a list', e.exception.message) - def test_allvmstats(self): ret = [{'vcpuCount': '1', 'displayInfo': [{'tlsPort': u'5900', @@ -516,3 +495,88 @@ _schema.schema().verify_args( vdsmapi.MethodRep('StoragePool', 'connect'), params) + + def test_host_list_caps(self): + ret = {'net_eth0_52_54_00_56_00_39': + {'params': {'capability': 'net', + 'interface': 'eth0', + 'parent': 'pci_0000_00_03_0', + 'is_assignable': 'true'}}, + 'computer': + {'params': {'capability': 'system', + 'is_assignable': 'true', + 'product': 'Standard PC (i440FX + PIIX, 1996)'}}, + 'usb_1_1_1_0': + {'params': {'capability': 'usb', + 'is_assignable': 'true', + 'driver': 'usbhid', + 'parent': 'usb_1_1'}}, + 'scsi_target7_0_0': + {'params': {'capability': 'scsi_target', + 'is_assignable': 'true', + 'parent': 'scsi_host7'}}, + 'usb_usb1': + {'params': {'product': '2.0 root hub', + 'vendor': 'Linux Foundation', + 'product_id': '0x0002', + 'parent': 'pci_0000_00_05_7', + 'vendor_id': '0x1d6b', + 'driver': 'usb', + 'capability': 'usb_device', + 'is_assignable': 'true', + 'address': {'device': '1', 'bus': '1'}}}, + 'pci_0000_00_02_0': + {'params': {'product': 'QXL paravirtual graphic card', + 'vendor': 'Red Hat, Inc.', + 'product_id': '0x0100', + 'parent': 'computer', + 'vendor_id': '0x1b36', + 'driver': 'qxl', + 'capability': 'pci', + 'is_assignable': 'true', + 'address': {'slot': '2', + 'bus': '0', + 'domain': '0', + 'function': '0'}}}, + 'scsi_5_0_0_18': + {'params': {'product': 'target1-18', + 'vendor': 'LIO-ORG', + 'parent': 'scsi_target5_0_0', + 'driver': 'sd', + 'capability': 'scsi', + 'is_assignable': 'true', + 'udev_path': '/dev/sg2', + 'address': {'bus': '0', + 'host': '5', + 'target': '0', + 'lun': '18'}}}, + 'scsi_host5': + {'params': {'capability': 'scsi_host', + 'is_assignable': 'true', + 'parent': 'computer'}}, + 'scsi_generic_sg26': + {'params': {'capability': 'scsi_generic', + 'is_assignable': 'true', + 'udev_path': '/dev/sg26', + 'parent': 'scsi_6_0_0_14'}}, + 'scsi_6_0_0_14': + {'params': {'product': 'target2-14', + 'vendor': 'LIO-ORG', + 'parent': 'scsi_target6_0_0', + 'driver': 'sd', + 'capability': 'scsi', + 'is_assignable': 'true', + 'udev_path': '/dev/sg26', + 'address': {'bus': '0', + 'host': '6', + 'target': '0', + 'lun': '14'}}}, + 'block_sdr_36001405292bb96f19064f81b884fa63f': + {'params': {'capability': 'storage', + 'is_assignable': 'true', + 'product': 'target1-03', + 'vendor': 'LIO-ORG', + 'parent': 'scsi_5_0_0_3'}}} + + _schema.schema().verify_retval( + vdsmapi.MethodRep('Host', 'hostdevListByCaps'), ret) -- To view, visit https://gerrit.ovirt.org/59703 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6ad09c310a76dde9267824a337fadf3b1c02bd45 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Piotr Kliczewski <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
