コード例 #1
0
    def test_update_numvfs(self, mock_open):
        fd = six.StringIO()
        mock_open.return_value.__enter__.return_value = fd

        sriov.update_numvfs(PCI1, NUMVFS)

        expected_sysfs_path = '/sys/bus/pci/devices/' + PCI1 + '/sriov_numvfs'
        mock_open.assert_called_once_with(expected_sysfs_path, 'w', 0)
        self.assertEqual(fd.getvalue(), '0' + str(NUMVFS))
コード例 #2
0
ファイル: sriov_test.py プロジェクト: nirs/vdsm
    def test_update_numvfs(self, mock_open):
        fd = six.StringIO()
        mock_open.return_value.__enter__.return_value = fd

        sriov.update_numvfs(PCI1, NUMVFS)

        expected_sysfs_path = '/sys/bus/pci/devices/' + PCI1 + '/sriov_numvfs'
        mock_open.assert_called_once_with(expected_sysfs_path, 'w', 0)
        self.assertEqual(fd.getvalue(), '0' + str(NUMVFS))
コード例 #3
0
ファイル: api.py プロジェクト: vjuranek/vdsm
def change_numvfs(pci_path, numvfs, devname):
    """Change number of virtual functions of a device.

    The persistence is stored in the same place as other network persistence is
    stored. A call to setSafeNetworkConfig() will persist it across reboots.
    """
    logging.info('Changing number of vfs on device %s -> %s.', pci_path,
                 numvfs)
    sriov.update_numvfs(pci_path, numvfs)
    sriov.persist_numvfs(devname, numvfs)

    link_iface.iface(devname).up()
コード例 #4
0
ファイル: api.py プロジェクト: oVirt/vdsm
def change_numvfs(pci_path, numvfs, devname):
    """Change number of virtual functions of a device.

    The persistence is stored in the same place as other network persistence is
    stored. A call to setSafeNetworkConfig() will persist it across reboots.
    """
    logging.info('Changing number of vfs on device %s -> %s.',
                 pci_path, numvfs)
    sriov.update_numvfs(pci_path, numvfs)
    sriov.persist_numvfs(devname, numvfs)

    link_iface.iface(devname).up()
コード例 #5
0
ファイル: api.py プロジェクト: asasuou/vdsm
def change_numvfs(pci_path, numvfs, net_name):
    """Change number of virtual functions of a device.

    The persistence is stored in the same place as other network persistence is
    stored. A call to setSafeNetworkConfig() will persist it across reboots.
    """
    # TODO: net_name is here only because it is hard to call pf_to_net_name
    # TODO: from here. once all our code will be under lib/vdsm this should be
    # TODO: removed.
    logging.info('Changing number of vfs on device %s -> %s.', pci_path,
                 numvfs)
    sriov.update_numvfs(pci_path, numvfs)
    sriov.persist_numvfs(pci_path, numvfs)

    link_iface.iface(net_name).up()
コード例 #6
0
ファイル: api.py プロジェクト: EdDev/vdsm
def change_numvfs(pci_path, numvfs, net_name):
    """Change number of virtual functions of a device.

    The persistence is stored in the same place as other network persistence is
    stored. A call to setSafeNetworkConfig() will persist it across reboots.
    """
    # TODO: net_name is here only because it is hard to call pf_to_net_name
    # TODO: from here. once all our code will be under lib/vdsm this should be
    # TODO: removed.
    logging.info('Changing number of vfs on device %s -> %s.',
                 pci_path, numvfs)
    sriov.update_numvfs(pci_path, numvfs)
    sriov.persist_numvfs(pci_path, numvfs)

    link_iface.up(net_name)
コード例 #7
0
 def test_update_numvfs_1_to_2(self, mock_open):
     fd = _create_fd(mock_open)
     sriov.update_numvfs(PCI1, NUMVFS)
     _assert_open_was_called(mock_open)
     assert fd.getvalue() == b'0%d' % NUMVFS
コード例 #8
0
 def test_update_numvfs_0_to_0(self, mock_open):
     fd = _create_fd(mock_open)
     sriov.update_numvfs(PCI1, 0)
     _assert_open_was_called(mock_open)
     assert fd.getvalue() == b''
コード例 #9
0
ファイル: sriov_test.py プロジェクト: wuyeliang/vdsm
 def test_update_numvfs_0_to_2(self, mock_open):
     fd = _create_fd(mock_open)
     sriov.update_numvfs(PCI1, NUMVFS)
     _assert_open_was_called(mock_open)
     self.assertEqual(fd.getvalue(), str(NUMVFS))
コード例 #10
0
ファイル: sriov_test.py プロジェクト: wuyeliang/vdsm
 def test_update_numvfs_2_to_0(self, mock_open):
     fd = _create_fd(mock_open)
     sriov.update_numvfs(PCI1, 0)
     _assert_open_was_called(mock_open)
     self.assertEqual(fd.getvalue(), '0')