当前位置: 首页>>代码示例>>Python>>正文


Python misc.get_clients函数代码示例

本文整理汇总了Python中teuthology.misc.get_clients函数的典型用法代码示例。如果您正苦于以下问题:Python get_clients函数的具体用法?Python get_clients怎么用?Python get_clients使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_clients函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self, ctx, fscid=None, name=None, create=False,
                 ec_profile=None):
        super(Filesystem, self).__init__(ctx)

        self.name = name
        self.ec_profile = ec_profile
        self.id = None
        self.metadata_pool_name = None
        self.metadata_overlay = False
        self.data_pool_name = None
        self.data_pools = None

        client_list = list(misc.all_roles_of_type(self._ctx.cluster, 'client'))
        self.client_id = client_list[0]
        self.client_remote = list(misc.get_clients(ctx=ctx, roles=["client.{0}".format(self.client_id)]))[0][1]

        if name is not None:
            if fscid is not None:
                raise RuntimeError("cannot specify fscid when creating fs")
            if create and not self.legacy_configured():
                self.create()
        else:
            if fscid is not None:
                self.id = fscid
                self.getinfo(refresh = True)

        # Stash a reference to the first created filesystem on ctx, so
        # that if someone drops to the interactive shell they can easily
        # poke our methods.
        if not hasattr(self._ctx, "filesystem"):
            self._ctx.filesystem = self
开发者ID:xiaoxichen,项目名称:ceph,代码行数:31,代码来源:filesystem.py

示例2: task

def task(ctx, config):
    """
    Mount/unmount a ``kernel`` client.

    The config is optional and defaults to mounting on all clients. If
    a config is given, it is expected to be a list of clients to do
    this operation on. This lets you e.g. set up one client with
    ``ceph-fuse`` and another with ``kclient``.

    Example that mounts all clients::

        tasks:
        - ceph:
        - kclient:
        - interactive:

    Example that uses both ``kclient` and ``ceph-fuse``::

        tasks:
        - ceph:
        - ceph-fuse: [client.0]
        - kclient: [client.1]
        - interactive:

    :param ctx: Context
    :param config: Configuration
    """
    log.info('Mounting kernel clients...')
    assert config is None or isinstance(config, list), \
        "task kclient got invalid config"

    if config is None:
        config = ['client.{id}'.format(id=id_)
                  for id_ in misc.all_roles_of_type(ctx.cluster, 'client')]
    clients = list(misc.get_clients(ctx=ctx, roles=config))

    test_dir = misc.get_testdir(ctx)

    # Assemble mon addresses
    remotes_and_roles = ctx.cluster.remotes.items()
    roles = [roles for (remote_, roles) in remotes_and_roles]
    ips = [remote_.ssh.get_transport().getpeername()[0]
           for (remote_, _) in remotes_and_roles]
    mons = misc.get_mons(roles, ips).values()

    mounts = {}
    for id_, remote in clients:
        kernel_mount = KernelMount(mons, test_dir, id_, remote)
        mounts[id_] = kernel_mount

        kernel_mount.mount()

    ctx.mounts = mounts
    try:
        yield mounts
    finally:
        log.info('Unmounting kernel clients...')
        for mount in mounts.values():
            mount.umount()
开发者ID:andrewschoen,项目名称:ceph-qa-suite,代码行数:59,代码来源:kclient.py

示例3: task

def task(ctx, config):
    """
    Enable most ceph console logging

    Example that enables logging on all clients::

        tasks:
        - ceph:
        - kclient:
        - kcon_most
        - interactive:

    Example that enables logging only on the client using kclient::

        tasks:
        - ceph:
        - kclient: [client.0]
        - kcon_most [client.0]
        - interactive:
    """
    log.info('Enable additional kernel logging...')
    assert config is None or isinstance(config, list), \
        "task kcon_most got invalid config"

    if config is None:
        config = ['client.{id}'.format(id=id_)
                  for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client')]
    clients = list(teuthology.get_clients(ctx=ctx, roles=config))

    testdir = teuthology.get_testdir(ctx)

    for id_, remote in clients:
        # TODO: Don't have to run this more than once per node (remote)
        log.info('Enable logging on client.{id} at {remote} ...'.format(
                id=id_, remote=remote))
        remote.run(
            args=[
                'sudo',
                'kcon_most',
                'on'
                ],
            )

    try:
        yield
    finally:
        log.info('Disable extra kernel logging on clients...')
        for id_, remote in clients:
            log.debug('Disable extra kernel logging on client.{id}...'.format(id=id_))
            remote.run(
                args=[
                    'sudo',
                    'kcon_most',
                    'off'
                    ],
                )
开发者ID:kri5,项目名称:teuthology,代码行数:56,代码来源:kcon_most.py

示例4: task

def task(ctx, config):
    """
    Create a mount dir 'client' that is just the local disk:

    Example that "mounts" all clients:

        tasks:
        - localdir:
        - interactive:

    Example for a specific client:

        tasks:
        - localdir: [client.2]
        - interactive:

    :param ctx: Context
    :param config: Configuration
    """
    log.info('Creating local mnt dirs...')

    testdir = teuthology.get_testdir(ctx)

    if config is None:
        config = list('client.{id}'.format(id=id_)
                      for id_ in teuthology.all_roles_of_type(ctx.cluster,
                                                              'client'))

    clients = list(teuthology.get_clients(ctx=ctx, roles=config))
    for id_, remote in clients:
        mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
        log.info('Creating dir {remote} {mnt}...'.format(
                remote=remote, mnt=mnt))
        remote.run(
            args=[
                'mkdir',
                '--',
                mnt,
                ],
            )

    try:
        yield

    finally:
        log.info('Removing local mnt dirs...')
        for id_, remote in clients:
            mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
            remote.run(
                args=[
                    'rm',
                    '-rf',
                    '--',
                    mnt,
                    ],
                )
开发者ID:AlfredChenxf,项目名称:teuthology,代码行数:56,代码来源:localdir.py

示例5: __init__

    def __init__(self, ctx, name=None):
        super(Filesystem, self).__init__(ctx)

        if name is None:
            name = "cephfs"

        self.name = name
        self.metadata_pool_name = "{0}_metadata".format(name)
        self.data_pool_name = "{0}_data".format(name)

        client_list = list(misc.all_roles_of_type(self._ctx.cluster, 'client'))
        self.client_id = client_list[0]
        self.client_remote = list(misc.get_clients(ctx=ctx, roles=["client.{0}".format(self.client_id)]))[0][1]
开发者ID:dvanders,项目名称:ceph-qa-suite,代码行数:13,代码来源:filesystem.py

示例6: __init__

    def __init__(self, ctx):
        self._ctx = ctx

        self.mds_ids = list(misc.all_roles_of_type(ctx.cluster, 'mds'))
        if len(self.mds_ids) == 0:
            raise RuntimeError("This task requires at least one MDS")

        first_mon = misc.get_first_mon(ctx, None)
        (self.mon_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
        self.mon_manager = ceph_manager.CephManager(self.mon_remote, ctx=ctx, logger=log.getChild('ceph_manager'))
        self.mds_daemons = dict([(mds_id, self._ctx.daemons.get_daemon('mds', mds_id)) for mds_id in self.mds_ids])

        client_list = list(misc.all_roles_of_type(self._ctx.cluster, 'client'))
        self.client_id = client_list[0]
        self.client_remote = list(misc.get_clients(ctx=ctx, roles=["client.{0}".format(self.client_id)]))[0][1]
开发者ID:yghannam,项目名称:ceph-qa-suite,代码行数:15,代码来源:filesystem.py

示例7: __init__

    def __init__(self, ctx, admin_remote=None):
        self._ctx = ctx

        self.mds_ids = list(misc.all_roles_of_type(ctx.cluster, 'mds'))
        if len(self.mds_ids) == 0:
            raise RuntimeError("This task requires at least one MDS")

        first_mon = misc.get_first_mon(ctx, None)
        if admin_remote is None:
            (self.admin_remote,) = ctx.cluster.only(first_mon).remotes.iterkeys()
        else:
            self.admin_remote = admin_remote
        self.mon_manager = ceph_manager.CephManager(self.admin_remote, ctx=ctx, logger=log.getChild('ceph_manager'))
        if hasattr(self._ctx, "daemons"):
            # Presence of 'daemons' attribute implies ceph task rather than ceph_deploy task
            self.mds_daemons = dict([(mds_id, self._ctx.daemons.get_daemon('mds', mds_id)) for mds_id in self.mds_ids])

        client_list = list(misc.all_roles_of_type(self._ctx.cluster, 'client'))
        self.client_id = client_list[0]
        self.client_remote = list(misc.get_clients(ctx=ctx, roles=["client.{0}".format(self.client_id)]))[0][1]
开发者ID:dreamhost,项目名称:ceph-qa-suite,代码行数:20,代码来源:filesystem.py

示例8: __init__

    def __init__(self, ctx, config):
        self._ctx = ctx
        self._config = config

        mds_list = list(misc.all_roles_of_type(ctx.cluster, 'mds'))
        if len(mds_list) != 1:
            # Require exactly one MDS, the code path for creation failure when
            # a standby is available is different
            raise RuntimeError("This task requires exactly one MDS")

        self.mds_id = mds_list[0]

        (mds_remote,) = ctx.cluster.only('mds.{_id}'.format(_id=self.mds_id)).remotes.iterkeys()
        manager = ceph_manager.CephManager(
            mds_remote, ctx=ctx, logger=log.getChild('ceph_manager'),
        )
        self.mds_manager = manager

        client_list = list(misc.all_roles_of_type(self._ctx.cluster, 'client'))
        self.client_id = client_list[0]
        self.client_remote = list(misc.get_clients(ctx=ctx, roles=["client.{0}".format(self.client_id)]))[0][1]

        self.test_files = ['a', 'b', 'c']
开发者ID:XinzeChi,项目名称:teuthology,代码行数:23,代码来源:mds_journal_migration.py

示例9: task

def task(ctx, config):
    """
    Export/Unexport a ``nfs server`` client.

    The config is optional and defaults to exporting on all clients. If
    a config is given, it is expected to be a list or dict of clients to do
    this operation on. You must have specified ``ceph-fuse`` or
    ``kclient`` on all clients specified for knfsd.

    Example that exports all clients::

        tasks:
        - ceph:
        - kclient:
        - knfsd:
        - interactive:

    Example that uses both ``kclient` and ``ceph-fuse``::

        tasks:
        - ceph:
        - ceph-fuse: [client.0]
        - kclient: [client.1]
        - knfsd: [client.0, client.1]
        - interactive:

    Example that specifies export options::

        tasks:
        - ceph:
        - kclient: [client.0, client.1]
        - knfsd:
            client.0:
              options: [rw,root_squash]
            client.1:
        - interactive:

    Note that when options aren't specified, rw,no_root_squash is the default.
    When you specify options, the defaults are as specified by exports(5).

    So if empty options are specified, i.e. options: [] these are the defaults:
        ro,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,
        no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534

    """
    log.info("Exporting nfs server...")

    if config is None:
        config = dict(
            ("client.{id}".format(id=id_), None) for id_ in teuthology.all_roles_of_type(ctx.cluster, "client")
        )
    elif isinstance(config, list):
        config = dict((name, None) for name in config)

    clients = list(teuthology.get_clients(ctx=ctx, roles=config.keys()))

    for id_, remote in clients:
        mnt = os.path.join("/tmp/cephtest", "mnt.{id}".format(id=id_))
        client_config = config.get("client.%s" % id_)
        if client_config is None:
            client_config = {}
        log.debug("Client client.%s config is %s" % (id_, client_config))

        if client_config.get("options") is not None:
            opts = ",".join(client_config.get("options"))
        else:
            opts = "rw,no_root_squash"

        # Undocumented option to export to any client in case
        # testing in interactive mode from other unspecified clients.
        wildcard = False
        if client_config.get("wildcard") is not None:
            wildcard = True

        log.info(
            "Exporting knfsd client.{id} at {remote} *:{mnt} ({opt})...".format(
                id=id_, remote=remote, mnt=mnt, opt=opts
            )
        )

        """
        Should the user want to run with root_squash enabled, there is no
        way to write anything to the initial ceph root dir which is set to
        rwxr-xr-x root root.

        This could possibly break test cases that make assumptions about
        the initial state of the root dir.
        """
        remote.run(args=["sudo", "chmod", "777", "{MNT}".format(MNT=mnt)])
        args = ["sudo", "exportfs", "-o", "fsid=123{id},{opt}".format(id=id_, opt=opts)]

        if wildcard:
            args += ["*:{MNT}".format(MNT=mnt)]
        else:
            """
            DEFAULT
            Prevent bogus clients from old runs from access our 
            export.  Specify all specify node addresses for this run.
            """
            ips = [
#.........这里部分代码省略.........
开发者ID:jdurgin,项目名称:teuthology,代码行数:101,代码来源:knfsd.py

示例10: task

def task(ctx, config):
    """
    Given a Ceph cluster has already been set up, exercise the migration
    of the CephFS journal from an older format to the latest format.  On
    successful completion the filesystem will be running with a journal
    in the new format.

    Optionally specify which client to use like this:

    - mds-journal_migration:
        client: client.0

    """
    if not hasattr(ctx, 'ceph'):
        raise RuntimeError("This task must be nested in 'ceph' task")

    if not hasattr(ctx, 'mounts'):
        raise RuntimeError("This task must be nested inside 'kclient' or 'ceph_fuse' task")

    # Determine which client we will use
    if config and 'client' in config:
        # Use client specified in config
        client_role = config['client']
        client_list = list(misc.get_clients(ctx, [client_role]))
        try:
            client_id = client_list[0][0]
        except IndexError:
            raise RuntimeError("Client role '{0}' not found".format(client_role))
    else:
        # Pick one arbitrary client to use
        client_list = list(misc.all_roles_of_type(ctx.cluster, 'client'))
        try:
            client_id = client_list[0]
        except IndexError:
            raise RuntimeError("This task requires at least one client")

    fs = Filesystem(ctx)
    ctx.fs = fs
    old_journal_version = JOURNAL_FORMAT_LEGACY
    new_journal_version = JOURNAL_FORMAT_RESILIENT

    fs.set_ceph_conf('mds', 'mds journal format', old_journal_version)

    # Create a filesystem using the older journal format.
    for mount in ctx.mounts.values():
        mount.umount_wait()
    fs.mds_stop()
    fs.reset()
    fs.mds_restart()

    # Do some client work so that the log is populated with something.
    mount = ctx.mounts[client_id]
    with mount.mounted():
        mount.create_files()
        mount.check_files()  # sanity, this should always pass

        # Run a more substantial workunit so that the length of the log to be
        # coverted is going span at least a few segments
        workunit(ctx, {
            'clients': {
                "client.{0}".format(client_id): ["suites/fsstress.sh"],
            },
            "timeout": "3h"
        })

    # Modify the ceph.conf to ask the MDS to use the new journal format.
    fs.set_ceph_conf('mds', 'mds journal format', new_journal_version)

    # Restart the MDS.
    fs.mds_fail_restart()
    fs.wait_for_daemons()

    # This ensures that all daemons come up into a valid state
    fs.wait_for_daemons()

    # Check that files created in the initial client workload are still visible
    # in a client mount.
    with mount.mounted():
        mount.check_files()

    # Verify that the journal really has been rewritten.
    journal_version = fs.get_journal_version()
    if journal_version != new_journal_version:
        raise RuntimeError("Journal was not upgraded, version should be {0} but is {1}".format(
            new_journal_version, journal_version()
        ))

    # Verify that cephfs-journal-tool can now read the rewritten journal
    proc = mount.client_remote.run(
        args=["cephfs-journal-tool", "journal", "inspect"],
        stdout=StringIO())
    if not proc.stdout.getvalue().strip().endswith(": OK"):
        raise RuntimeError("Unexpected journal-tool result: '{0}'".format(
            proc.stdout.getvalue()
        ))

    mount.client_remote.run(
        args=["sudo", "cephfs-journal-tool", "event", "get", "json", "--path", "/tmp/journal.json"])
    proc = mount.client_remote.run(
        args=[
#.........这里部分代码省略.........
开发者ID:hgichon,项目名称:anycloud-test,代码行数:101,代码来源:mds_journal_migration.py

示例11: task

def task(ctx, config):
    """
    Mount/unmount a cifs client.

    The config is optional and defaults to mounting on all clients. If
    a config is given, it is expected to be a list of clients to do
    this operation on.

    Example that starts smbd and mounts cifs on all nodes::

        tasks:
        - ceph:
        - samba:
        - cifs-mount:
        - interactive:

    Example that splits smbd and cifs:

        tasks:
        - ceph:
        - samba: [samba.0]
        - cifs-mount: [client.0]
        - ceph-fuse: [client.1]
        - interactive:

    Example that specifies the share name:

        tasks:
        - ceph:
        - ceph-fuse:
        - samba:
            samba.0:
                cephfuse: "{testdir}/mnt.0"
        - cifs-mount:
            client.0:
                share: cephfuse
    """
    log.info('Mounting cifs clients...')

    if config is None:
        config = dict(('client.{id}'.format(id=id_), None)
                  for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client'))
    elif isinstance(config, list):
        config = dict((name, None) for name in config)

    clients = list(teuthology.get_clients(ctx=ctx, roles=config.keys()))

    from teuthology.task.samba import get_sambas
    samba_roles = ['samba.{id_}'.format(id_=id_) for id_ in teuthology.all_roles_of_type(ctx.cluster, 'samba')]
    sambas = list(get_sambas(ctx=ctx, roles=samba_roles))
    (ip, port) = sambas[0][1].ssh.get_transport().getpeername()
    log.info('samba ip: {ip}'.format(ip=ip))

    for id_, remote in clients:
        mnt = os.path.join(teuthology.get_testdir(ctx), 'mnt.{id}'.format(id=id_))
        log.info('Mounting cifs client.{id} at {remote} {mnt}...'.format(
                id=id_, remote=remote,mnt=mnt))

        remote.run(
            args=[
                'mkdir',
                '--',
                mnt,
                ],
            )

        rolestr = 'client.{id_}'.format(id_=id_)
        unc = "ceph"
        log.info("config: {c}".format(c=config))
        if config[rolestr] is not None and 'share' in config[rolestr]:
            unc = config[rolestr]['share']

        remote.run(
            args=[
                'sudo',
                'mount',
                '-t',
                'cifs',
                '//{sambaip}/{unc}'.format(sambaip=ip, unc=unc),
                '-o',
                'username=ubuntu,password=ubuntu',
                mnt,
                ],
            )

        remote.run(
            args=[
                'sudo',
                'chown',
                'ubuntu:ubuntu',
                '{m}/'.format(m=mnt),
                ],
            )

    try:
        yield
    finally:
        log.info('Unmounting cifs clients...')
        for id_, remote in clients:
            remote.run(
#.........这里部分代码省略.........
开发者ID:gregsfortytwo,项目名称:teuthology,代码行数:101,代码来源:cifs-mount.py

示例12: task

def task(ctx, config):
    """
    Mount/unmount a ``kernel`` client.

    The config is optional and defaults to mounting on all clients. If
    a config is given, it is expected to be a list of clients to do
    this operation on. This lets you e.g. set up one client with
    ``ceph-fuse`` and another with ``kclient``.

    Example that mounts all clients::

        tasks:
        - ceph:
        - kclient:
        - interactive:

    Example that uses both ``kclient` and ``ceph-fuse``::

        tasks:
        - ceph:
        - ceph-fuse: [client.0]
        - kclient: [client.1]
        - interactive:


    Pass a dictionary instead of lists to specify per-client config:

        tasks:
        -kclient:
            client.0:
                debug: true

    :param ctx: Context
    :param config: Configuration
    """
    log.info('Mounting kernel clients...')
    assert config is None or isinstance(config, list) or isinstance(config, dict), \
        "task kclient got invalid config"

    if config is None:
        config = ['client.{id}'.format(id=id_)
                  for id_ in misc.all_roles_of_type(ctx.cluster, 'client')]

    if isinstance(config, list):
        client_roles = config
        config = dict([r, dict()] for r in client_roles)
    elif isinstance(config, dict):
        client_roles = config.keys()
    else:
        raise ValueError("Invalid config object: {0} ({1})".format(config, config.__class__))

    # config has been converted to a dict by this point
    overrides = ctx.config.get('overrides', {})
    deep_merge(config, overrides.get('kclient', {}))

    clients = list(misc.get_clients(ctx=ctx, roles=client_roles))

    test_dir = misc.get_testdir(ctx)

    # Assemble mon addresses
    remotes_and_roles = ctx.cluster.remotes.items()
    roles = [roles for (remote_, roles) in remotes_and_roles]
    ips = [remote_.ssh.get_transport().getpeername()[0]
           for (remote_, _) in remotes_and_roles]
    mons = misc.get_mons(roles, ips).values()

    mounts = {}
    for id_, remote in clients:
        kernel_mount = KernelMount(
            mons,
            test_dir,
            id_,
            remote,
            ctx.teuthology_config.get('ipmi_user', None),
            ctx.teuthology_config.get('ipmi_password', None),
            ctx.teuthology_config.get('ipmi_domain', None)
        )

        mounts[id_] = kernel_mount

        client_config = config["client.{0}".format(id_)]
        if client_config.get('debug', False):
            remote.run(args=["sudo", "bash", "-c", "echo 'module ceph +p' > /sys/kernel/debug/dynamic_debug/control"])
            remote.run(args=["sudo", "bash", "-c", "echo 'module libceph +p' > /sys/kernel/debug/dynamic_debug/control"])

        kernel_mount.mount()

    ctx.mounts = mounts
    try:
        yield mounts
    finally:
        log.info('Unmounting kernel clients...')
        for mount in mounts.values():
            mount.umount()
开发者ID:Abhishekvrshny,项目名称:ceph-qa-suite,代码行数:94,代码来源:kclient.py

示例13: task

def task(ctx, config):
    """
    Mount/unmount a ``ceph-fuse`` client.

    The config is optional and defaults to mounting on all clients. If
    a config is given, it is expected to be a list of clients to do
    this operation on. This lets you e.g. set up one client with
    ``ceph-fuse`` and another with ``kclient``.

    Example that mounts all clients::

        tasks:
        - ceph:
        - ceph-fuse:
        - interactive:

    Example that uses both ``kclient` and ``ceph-fuse``::

        tasks:
        - ceph:
        - ceph-fuse: [client.0]
        - kclient: [client.1]
        - interactive:

    Example that enables valgrind:

        tasks:
        - ceph:
        - ceph-fuse:
            client.0:
              valgrind: [--tool=memcheck, --leak-check=full, --show-reachable=yes]
        - interactive:

    """
    log.info('Mounting ceph-fuse clients...')
    fuse_daemons = {}

    if config is None:
        config = dict(('client.{id}'.format(id=id_), None)
                  for id_ in teuthology.all_roles_of_type(ctx.cluster, 'client'))
    elif isinstance(config, list):
        config = dict((name, None) for name in config)

    overrides = ctx.config.get('overrides', {})
    teuthology.deep_merge(config, overrides.get('ceph-fuse', {}))

    clients = list(teuthology.get_clients(ctx=ctx, roles=config.keys()))

    for id_, remote in clients:
        mnt = os.path.join('/tmp/cephtest', 'mnt.{id}'.format(id=id_))
        log.info('Mounting ceph-fuse client.{id} at {remote} {mnt}...'.format(
                id=id_, remote=remote,mnt=mnt))

        client_config = config.get("client.%s" % id_)
        if client_config is None:
            client_config = {}
        log.info("Client client.%s config is %s" % (id_, client_config))

        daemon_signal = 'kill'
        if client_config.get('coverage') or client_config.get('valgrind') is not None:
            daemon_signal = 'term'

        remote.run(
            args=[
                'mkdir',
                '--',
                mnt,
                ],
            )

        run_cmd=[
            '/tmp/cephtest/enable-coredump',
            '/tmp/cephtest/binary/usr/local/bin/ceph-coverage',
            '/tmp/cephtest/archive/coverage',
            '/tmp/cephtest/daemon-helper',
            daemon_signal,
            ]
        run_cmd_tail=[
            '/tmp/cephtest/binary/usr/local/bin/ceph-fuse',
            '-f',
            '--name', 'client.{id}'.format(id=id_),
            '-c', '/tmp/cephtest/ceph.conf',
            # TODO ceph-fuse doesn't understand dash dash '--',
            mnt,
            ]

        if client_config.get('valgrind') is not None:
            run_cmd.extend(
                teuthology.get_valgrind_args(
                    'client.{id}'.format(id=id_),
                    client_config.get('valgrind'),
                    )
                )

        run_cmd.extend(run_cmd_tail)

        proc = remote.run(
            args=run_cmd,
            logger=log.getChild('ceph-fuse.{id}'.format(id=id_)),
            stdin=run.PIPE,
#.........这里部分代码省略.........
开发者ID:dzafman,项目名称:teuthology,代码行数:101,代码来源:ceph-fuse.py

示例14: task

def task(ctx, config):
    """
    Mount nfs client (requires nfs server export like knfsd or ganesh)

    Example that mounts a single nfs client::

        tasks:
        - ceph:
        - kclient: [client.0]
        - knfsd: [client.0]
        - nfs:
            client.1:
                server: client.0
        - interactive:

    Example that mounts multiple nfs clients with options::

        tasks:
        - ceph:
        - kclient: [client.0, client.1]
        - knfsd: [client.0, client.1]
        - nfs:
            client.2:
                server: client.0
                options: [rw,hard,intr,nfsvers=3]
            client.3:
                server: client.1
                options: [ro]
        - workunit:
            clients:
                client.2:
                    - suites/dbench.sh
                client.3:
                    - suites/blogbench.sh

    It is not recommended that the nfs client and nfs server reside on the same node.  So in the example above client.0-3 should be on 4 distinct
    nodes.  The client nfs testing would be using only client.2 and client.3.
    """
    log.info('Mounting nfs clients...')
    assert isinstance(config, dict)

    clients = list(teuthology.get_clients(ctx=ctx, roles=config.keys()))

    testdir = teuthology.get_testdir(ctx)
    for id_, remote in clients:
        mnt = os.path.join(testdir, 'mnt.{id}'.format(id=id_))
        client_config = config.get("client.%s" % id_)
        if client_config is None:
            client_config = {}
        log.debug("Client client.%s config is %s" % (id_, client_config))

        assert client_config.get('server') is not None
        server = client_config.get('server');

        svr_id = server[len('client.'):]
        svr_mnt = os.path.join(testdir, 'mnt.{id}'.format(id=svr_id))

        svr_remote  = None
        all_config = ['client.{id}'.format(id=tmpid)
                  for tmpid in teuthology.all_roles_of_type(ctx.cluster, 'client')]
        all_clients = list(teuthology.get_clients(ctx=ctx, roles=all_config))
        for tmpid, tmpremote in all_clients:
            if tmpid == svr_id:
                svr_remote = tmpremote
                break

        assert svr_remote is not None 
        svr_remote = svr_remote.name.split('@', 2)[1]

        if client_config.get('options') is not None:
            opts = ','.join(client_config.get('options'))
        else:
            opts = 'rw'

        log.info('Mounting client.{id} from client.{sid}'.format(id=id_, sid=svr_id))
        log.debug('mount -o {opts} {remote}:{svr_mnt} {mnt}'.format(
                remote=svr_remote, svr_mnt=svr_mnt, opts=opts, mnt=mnt))

        remote.run(
            args=[
                'mkdir',
                '--',
                mnt,
                ],
            )

        remote.run(
            args=[
                'sudo',
                "mount",
                "-o",
                opts,
                '{remote}:{mnt}'.format(remote=svr_remote, mnt=svr_mnt),
                mnt
                ],
            )

    try:
        yield
    finally:
#.........这里部分代码省略.........
开发者ID:BlaXpirit,项目名称:teuthology,代码行数:101,代码来源:nfs.py

示例15: task

def task(ctx, config):
    """
    Given a Ceph cluster has already been set up, exercise the migration
    of the CephFS journal from an older format to the latest format.  On
    successful completion the filesystem will be running with a journal
    in the new format.

    Optionally specify which client to use like this:

    - mds-journal_migration:
        client: client.0

    """
    if not hasattr(ctx, 'ceph'):
        raise RuntimeError("This task must be nested in 'ceph' task")

    if not hasattr(ctx, 'mounts'):
        raise RuntimeError("This task must be nested inside 'kclient' or 'ceph_fuse' task")

    # Determine which client we will use
    if config and 'client' in config:
        # Use client specified in config
        client_role = config['client']
        client_list = list(misc.get_clients(ctx, [client_role]))
        try:
            client_id = client_list[0][0]
        except IndexError:
            raise RuntimeError("Client role '{0}' not found".format(client_role))
    else:
        # Pick one arbitrary client to use
        client_list = list(misc.all_roles_of_type(ctx.cluster, 'client'))
        try:
            client_id = client_list[0]
        except IndexError:
            raise RuntimeError("This task requires at least one client")

    fs = Filesystem(ctx, config)
    ctx.fs = fs
    old_journal_version = JOURNAL_FORMAT_LEGACY
    new_journal_version = JOURNAL_FORMAT_RESILIENT

    # Set config so that journal will be created in older format
    if 'mds' not in ctx.ceph.conf:
        ctx.ceph.conf['mds'] = {}
    ctx.ceph.conf['mds']['mds journal format'] = old_journal_version
    write_conf(ctx)  # XXX because we don't have the ceph task's config object, if they
                     # used a different config path this won't work.

    # Create a filesystem using the older journal format.
    for mount in ctx.mounts.values():
        mount.umount_wait()
    fs.mds_stop()
    fs.reset()
    fs.mds_restart()

    # Do some client work so that the log is populated with something.
    mount = ctx.mounts[client_id]
    with mount.mounted():
        mount.create_files()
        mount.check_files()  # sanity, this should always pass

    # Modify the ceph.conf to ask the MDS to use the new journal format.
    ctx.ceph.conf['mds']['mds journal format'] = new_journal_version
    write_conf(ctx)

    # Restart the MDS.
    fs.mds_fail_restart()
    fs.wait_for_daemons()

    # This ensures that all daemons come up into a valid state
    fs.wait_for_daemons()

    # Check that files created in the initial client workload are still visible
    # in a client mount.
    with mount.mounted():
        mount.check_files()

    # Verify that the journal really has been rewritten.
    journal_version = fs.get_journal_version()
    if journal_version != new_journal_version:
        raise RuntimeError("Journal was not upgraded, version should be {0} but is {1}".format(
            new_journal_version, journal_version()
        ))

    # Leave all MDSs and clients running for any child tasks
    for mount in ctx.mounts.values():
        mount.mount()
        mount.wait_until_mounted()

    yield
开发者ID:athanatos,项目名称:ceph-qa-suite,代码行数:90,代码来源:mds_journal_migration.py


注:本文中的teuthology.misc.get_clients函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。