コード例 #1
0
ファイル: sysfs_driver.py プロジェクト: gobindadas/vdsm
 def add_slaves(self, slaves):
     for slave in slaves:
         with _preserve_iface_state(slave):
             iface.down(slave)
             with open(self.BONDING_SLAVES % self._master, 'w') as f:
                 f.write('+%s' % slave)
         logging.info('Slave {} has been added to bond {}.'.format(
             slave, self._master))
         self._slaves.add(slave)
コード例 #2
0
ファイル: sysfs_driver.py プロジェクト: gobindadas/vdsm
 def del_slaves(self, slaves):
     for slave in slaves:
         with _preserve_iface_state(slave):
             iface.down(slave)
             with open(self.BONDING_SLAVES % self._master, 'w') as f:
                 f.write('-%s' % slave)
         logging.info('Slave {} has been removed from bond {}.'.format(
             slave, self._master))
         self._slaves.remove(slave)
コード例 #3
0
 def set_options(self, options):
     current_options = sysfs_options.get_options(self._master)
     if options != current_options:
         mode_will_be_changed = ('mode' in options and
                                 current_options['mode'] != options['mode'])
         if mode_will_be_changed:
             with _preserve_iface_state(self._master):
                 iface.down(self._master)
                 with self._temporarily_detached_slaves():
                     sysfs_options.set_options(self._master, options)
         else:
             sysfs_options.set_options(self._master, options)
     logging.info('Bond {} options set: {}.'.format(self._master, options))
     self._options = options
コード例 #4
0
 def test_iface_down(self):
     with dummy_device() as nic:
         iface.up(nic)
         iface.down(nic)
         self.assertFalse(iface.is_up(nic))
コード例 #5
0
ファイル: link_iface_test.py プロジェクト: nirs/vdsm
 def test_iface_down(self):
     with dummy_device() as nic:
         iface.up(nic)
         iface.down(nic)
         self.assertFalse(iface.is_up(nic))
コード例 #6
0
ファイル: nmnettestlib.py プロジェクト: gobindadas/vdsm
def _add_slaves_to_bond(bond, slaves):
    for slave in slaves:
        linkiface.down(slave)
        command = [IP_BINARY.cmd, 'link', 'set', slave, 'master', bond]
        _exec_cmd(command)
コード例 #7
0
ファイル: nmnettestlib.py プロジェクト: EdDev/vdsm
def _add_slaves_to_bond(bond, slaves):
    for slave in slaves:
        linkiface.down(slave)
        command = [IP_BINARY.cmd, 'link', 'set', slave, 'master', bond]
        _exec_cmd(command)