コード例 #1
0
ファイル: sriov.py プロジェクト: nirs/vdsm
def _wait_for_udev_events():
    # FIXME: This is an ugly hack that is meant to prevent VDSM to report VFs
    # that are not yet named by udev or not report all of. This is a blocking
    # call that should wait for all udev events to be handled. a proper fix
    # should be registering and listening to the proper netlink and udev
    # events. The sleep prior to observing udev is meant to decrease the
    # chances that we wait for udev before it knows from the kernel about the
    # new devices.
    time.sleep(0.5)
    udevadm.settle(timeout=10)
コード例 #2
0
def _wait_for_udev_events():
    # FIXME: This is an ugly hack that is meant to prevent VDSM to report VFs
    # that are not yet named by udev or not report all of. This is a blocking
    # call that should wait for all udev events to be handled. a proper fix
    # should be registering and listening to the proper netlink and udev
    # events. The sleep prior to observing udev is meant to decrease the
    # chances that we wait for udev before it knows from the kernel about the
    # new devices.
    time.sleep(0.5)
    udevadm.settle(timeout=10)
コード例 #3
0
    def _wait_for_events(self):
        """
        This is an ugly hack to wait until the udev events generated when
        adding or removing a mount are processed.

        Note that we may wait for unrelated events, or wait too little if the
        system is overloaded.

        TODO: find a way to wait for the specific event.
        """
        with utils.stopwatch("Waiting for udev mount events", log=self.log):
            timeout = config.getint('irs', 'udev_settle_timeout')
            udevadm.settle(timeout)
コード例 #4
0
ファイル: multipath.py プロジェクト: xiaojiongming/vdsm
def rescan():
    """
    Forces multipath daemon to rescan the list of available devices and
    refresh the mapping table. New devices can be found under /dev/mapper

    Should only be called from hsm._rescanDevices()
    """

    # First rescan iSCSI and FCP connections
    iscsi.rescan()
    hba.rescan()

    # Scanning SCSI interconnects starts a storm of udev events. Wait until all
    # events are processed, ensuring detection of new devices and creation or
    # update of multipath devices.
    timeout = config.getint('irs', 'udev_settle_timeout')
    udevadm.settle(timeout)
コード例 #5
0
 def detach(self):
     if self._path is None:
         raise AssertionError("Device is detached: %s" % self)
     commands.run(["losetup", "--detach", self._path])
     self._path = None
     # After deactivating lvs backed by loop device, we get tons of udev
     # events. We must wait for the events or we may get stale lvs that
     # would fail the next tests.
     #
     # $ udevadm monitor -u
     # ...
     # UDEV  [314195.642497] remove   /devices/virtual/block/dm-4 (block)
     # UDEV  [314195.643032] remove   /devices/virtual/block/dm-4 (block)
     # UDEV  [314195.653214] remove   /devices/virtual/bdi/253:4 (bdi)
     # UDEV  [314195.664478] remove   /devices/virtual/block/dm-5 (block)
     # UDEV  [314195.664863] remove   /devices/virtual/block/dm-5 (block)
     # UDEV  [314195.674426] remove   /devices/virtual/bdi/253:5 (bdi)
     # UDEV  [314195.807277] change   /devices/virtual/block/loop0 (block)
     udevadm.settle(5)
コード例 #6
0
def wait_until_ready():
    """
    Wait until multipathd is ready after new devices were added.

    SCSI rescan or connecting to new target trigger udev events when the
    kernel add the new SCSI devices. We can use udevadm to wait for
    these events.  We see in the logs that udevadm returns quickly,
    before multipathd started to process the new devices, but we can use
    "multipathd show status" to wait until multipathd processed all the
    new devices.
    """
    timeout = config.getint('multipath', 'wait_timeout')
    start = time.monotonic()
    deadline = start + timeout

    log.info("Waiting until multipathd is ready")

    udevadm.settle(timeout)

    # We treat multipath as ready it reaches steady state - reporting
    # that it is ready in the last 2 intervals.
    ready = 0
    tries = 0

    while ready < 2:
        tries += 1

        time.sleep(POLL_INTERVAL)

        if is_ready():
            ready += 1
        else:
            ready = 0

        if time.monotonic() >= deadline:
            log.warning("Timeout waiting for multipathd (tries=%s, ready=%s)",
                        tries, ready)
            return

    log.info("Waited %.2f seconds for multipathd (tries=%s, ready=%s)",
             time.monotonic() - start, tries, ready)
コード例 #7
0
ファイル: loopback.py プロジェクト: nirs/vdsm
 def detach(self):
     if self._path is None:
         raise AssertionError("Device is detached: %s" % self)
     cmd = ["losetup", "--detach", self._path]
     rc, out, err = commands.execCmd(cmd, raw=True)
     if rc != 0:
         raise cmdutils.Error(cmd, rc, out, err)
     self._path = None
     # After deactivating lvs backed by loop device, we get tons of udev
     # events. We must wait for the events or we may get stale lvs that
     # would fail the next tests.
     #
     # $ udevadm monitor -u
     # ...
     # UDEV  [314195.642497] remove   /devices/virtual/block/dm-4 (block)
     # UDEV  [314195.643032] remove   /devices/virtual/block/dm-4 (block)
     # UDEV  [314195.653214] remove   /devices/virtual/bdi/253:4 (bdi)
     # UDEV  [314195.664478] remove   /devices/virtual/block/dm-5 (block)
     # UDEV  [314195.664863] remove   /devices/virtual/block/dm-5 (block)
     # UDEV  [314195.674426] remove   /devices/virtual/bdi/253:5 (bdi)
     # UDEV  [314195.807277] change   /devices/virtual/block/loop0 (block)
     udevadm.settle(5)
コード例 #8
0
ファイル: storageServer.py プロジェクト: SanderSander/vdsm
 def connect(self):
     iscsi.addIscsiNode(self._iface, self._target, self._cred)
     timeout = config.getint("irs", "udev_settle_timeout")
     udevadm.settle(timeout)
コード例 #9
0
 def settle_devices(cls):
     timeout = config.getint("irs", "udev_settle_timeout")
     udevadm.settle(timeout)
コード例 #10
0
ファイル: storageServer.py プロジェクト: nirs/vdsm
 def connect(self):
     iscsi.addIscsiNode(self._iface, self._target, self._cred)
     timeout = config.getint("irs", "udev_settle_timeout")
     udevadm.settle(timeout)