• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python data_dir.get_data_dir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_asset_info

def get_asset_info(asset, ini_dir=None, section=None):
    """"
    Parse $asset.ini file and returns a dictionary suitable for
    asset.download_file()

    :param asset: Asset name. A file ending in .ini.
    :param ini_dir: Directory where to search .ini file.
    :param section: Name of the [] section in .ini file. If None, then use
                    asset name.
    """
    asset_info = {}
    ini_dir = ini_dir or data_dir.get_download_dir()
    asset_path = os.path.join(ini_dir, '%s.ini' % asset)
    assert os.path.exists(asset_path), "Missing asset file %s" % asset_path
    asset_cfg = ConfigLoader(asset_path)

    section = section or asset
    asset_info['url'] = asset_cfg.get(section, 'url')
    asset_info['sha1_url'] = asset_cfg.get(section, 'sha1_url')
    asset_info['title'] = asset_cfg.get(section, 'title')
    destination = asset_cfg.get(section, 'destination')
    if not os.path.isabs(destination):
        destination = os.path.join(data_dir.get_data_dir(), destination)
    asset_info['destination'] = destination
    asset_info['asset_exists'] = os.path.isfile(destination)

    # Optional fields
    d_uncompressed = asset_cfg.get(section, 'destination_uncompressed')
    if d_uncompressed is not None and not os.path.isabs(d_uncompressed):
        d_uncompressed = os.path.join(data_dir.get_data_dir(),
                                      d_uncompressed)
    asset_info['destination_uncompressed'] = d_uncompressed
    asset_info['uncompress_cmd'] = asset_cfg.get(section, 'uncompress_cmd')

    return asset_info
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:35,代码来源:asset.py


示例2: run

def run(test, params, env):
    """
    live_snapshot_base test:
    1). Boot up guest
    2). Create a file on host and record md5
    3). Copy the file to guest
    3). Create live snapshot
    4). Copy the file from guest,then check md5

    :param test: Kvm test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment.
    """
    vm = env.get_vm(params["main_vm"])
    vm.verify_alive()
    timeout = int(params.get("login_timeout", 3600))
    session = vm.wait_for_login(timeout=timeout)

    dd_timeout = params.get("dd_timeoout", 600)
    copy_timeout = params.get("copy_timeoout", 600)
    base_file = storage.get_image_filename(params, data_dir.get_data_dir())
    device = vm.get_block({"file": base_file})
    snapshot_file = "images/%s" % params.get("snapshot_name")
    snapshot_file = utils_misc.get_path(data_dir.get_data_dir(), snapshot_file)
    snapshot_format = params.get("snapshot_format", "qcow2")
    tmp_name = utils_misc.generate_random_string(5)
    src = dst = "/tmp/%s" % tmp_name
    if params.get("os_type") != "linux":
        dst = "c:\\users\\public\\%s" % tmp_name

    try:
        error_context.context("create file on host, copy it to guest",
                              logging.info)
        cmd = params.get("dd_cmd") % src
        process.system(cmd, timeout=dd_timeout, shell=True)
        md5 = crypto.hash_file(src, algorithm="md5")
        vm.copy_files_to(src, dst, timeout=copy_timeout)
        process.system("rm -f %s" % src)
        error_context.context("create live snapshot", logging.info)
        if vm.live_snapshot(base_file, snapshot_file,
                            snapshot_format) != device:
            test.fail("Fail to create snapshot")
        backing_file = vm.monitor.get_backingfile(device)
        if backing_file != base_file:
            logging.error(
                "backing file: %s, base file: %s", backing_file, base_file)
            test.fail("Got incorrect backing file")
        error_context.context("copy file to host, check content not changed",
                              logging.info)
        vm.copy_files_from(dst, src, timeout=copy_timeout)
        if md5 and (md5 != crypto.hash_file(src, algorithm="md5")):
            test.fail("diff md5 before/after create snapshot")
        session.cmd(params.get("alive_check_cmd", "dir"))
    finally:
        if session:
            session.close()
        process.system("rm -f %s %s" % (snapshot_file, src))
开发者ID:bssrikanth,项目名称:tp-qemu,代码行数:57,代码来源:live_snapshot_base.py


示例3: run

def run(test, params, env):
    """
    Create snapshot based on the target qcow2 image converted from raw image.

    1. boot a guest up with an initial raw image
    2. create a file on the initial image disk, calculate its md5sum
    3. shut the guest down
    4. convert initial raw image to a qcow2 image tgt, and check the tgt
    5. create a snapshot based on tgt
    6. boot a guest from the snapshot and check whether the
       file's md5sum stays same

    :param test: Qemu test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """
    def _get_img_obj_and_params(tag):
        """Get an QemuImg object and its params based on the tag."""
        img_param = params.object_params(tag)
        img = QemuImg(img_param, data_dir.get_data_dir(), tag)
        return img, img_param

    file = params["guest_file_name"]
    initial_tag = params["images"].split()[0]
    c_tag = params["image_convert"]

    logging.info("Boot a guest up with initial image: %s, and create a"
                 " file %s on the disk." % (initial_tag, file))
    base_qit = QemuImgTest(test, params, env, initial_tag)
    base_qit.start_vm()
    md5 = base_qit.save_file(file)
    logging.info("Got %s's md5 %s from the initial image disk." % (file, md5))
    base_qit.destroy_vm()

    logging.info("Convert initial image %s to %s" % (initial_tag, c_tag))
    img, img_param = _get_img_obj_and_params(initial_tag)
    img.convert(params.object_params(c_tag), data_dir.get_data_dir())

    logging.info("Check image %s." % (c_tag))
    tgt = {"image_name_%s" % c_tag: params["convert_name_%s" % c_tag],
           "image_format_%s" % c_tag: params["convert_format_%s" % c_tag]}
    params.update(tgt)
    tgt, tgt_img_param = _get_img_obj_and_params(c_tag)
    tgt.check_image(tgt_img_param, data_dir.get_data_dir())

    gen = generate_base_snapshot_pair(params["image_chain"])
    _, snapshot = next(gen)
    logging.info("Create a snapshot %s based on %s." % (snapshot, c_tag))
    sn_qit = QemuImgTest(test, params, env, snapshot)
    sn_qit.create_snapshot()
    sn_qit.start_vm()
    if not sn_qit.check_file(file, md5):
        test.fail("The file %s's md5 on initial image and"
                  " snapshot are different." % file)
    for qit in (base_qit, sn_qit):
        qit.clean()
开发者ID:ldoktor,项目名称:tp-qemu,代码行数:56,代码来源:qemu_img_create_snapshot_on_qcow2_target_from_raw_source.py


示例4: rebase_test

    def rebase_test(cmd):
        """
        Subcommand 'qemu-img rebase' test

        Change the backing file of a snapshot image in "unsafe mode":
        Assume the previous backing file had missed and we just have to change
        reference of snapshot to new one. After change the backing file of a
        snapshot image in unsafe mode, the snapshot should work still.

        :param cmd: qemu-img base command.
        """
        if not 'rebase' in utils.system_output(cmd + ' --help',
                                               ignore_status=True):
            raise error.TestNAError("Current kvm user space version does not"
                                    " support 'rebase' subcommand")
        sn_fmt = params.get("snapshot_format", "qcow2")
        sn1 = params["image_name_snapshot1"]
        sn1 = utils_misc.get_path(
            data_dir.get_data_dir(), sn1) + ".%s" % sn_fmt
        base_img = storage.get_image_filename(params, data_dir.get_data_dir())
        _create(cmd, sn1, sn_fmt, base_img=base_img, base_img_fmt=image_format)

        # Create snapshot2 based on snapshot1
        sn2 = params["image_name_snapshot2"]
        sn2 = utils_misc.get_path(
            data_dir.get_data_dir(), sn2) + ".%s" % sn_fmt
        _create(cmd, sn2, sn_fmt, base_img=sn1, base_img_fmt=sn_fmt)

        rebase_mode = params.get("rebase_mode")
        if rebase_mode == "unsafe":
            os.remove(sn1)

        _rebase(cmd, sn2, base_img, image_format, mode=rebase_mode)
        # Boot snapshot image after rebase
        img_name, img_format = sn2.split('.')
        _boot(img_name, img_format)

        # Check sn2's format and backing_file
        actual_base_img = _info(cmd, sn2, "backing file")
        base_img_name = os.path.basename(base_img)
        if not base_img_name in actual_base_img:
            raise error.TestFail("After rebase the backing_file of 'sn2' is "
                                 "'%s' which is not expected as '%s'"
                                 % (actual_base_img, base_img_name))
        status, output = _check(cmd, sn2)
        if not status:
            raise error.TestFail("Check image '%s' failed after rebase;"
                                 "got error: %s" % (sn2, output))
        try:
            os.remove(sn2)
            os.remove(sn1)
        except Exception:
            pass
开发者ID:QiuMike,项目名称:tp-qemu,代码行数:53,代码来源:qemu_img.py


示例5: _action_after_fsfreeze

    def _action_after_fsfreeze(self, *args):
        error.context("Run live snapshot for guest.", logging.info)

        image1 = self.params.get("image", "image1")
        image_params = self.params.object_params(image1)
        sn_params = image_params.copy()
        sn_params["image_name"] += "-snapshot"
        sn_file = storage.get_image_filename(sn_params, data_dir.get_data_dir())
        base_file = storage.get_image_filename(image_params, data_dir.get_data_dir())
        snapshot_format = image_params["image_format"]

        self.vm.live_snapshot(base_file, sn_file, snapshot_format)
开发者ID:wl59454024,项目名称:virt-test,代码行数:12,代码来源:qemu_guest_agent_snapshot.py


示例6: create_iso_image

    def create_iso_image(params, name, prepare=True, file_size=None):
        """
        Creates 'new' iso image with one file on it

        :param params: parameters for test
        :param name: name of new iso image file
        :param preapre: if True then it prepare cd images.
        :param file_size: Size of iso image in MB

        :return: path to new iso image file.
        """
        error.context("Creating test iso image '%s'" % name, logging.info)
        cdrom_cd = params["target_cdrom"]
        cdrom_cd = params[cdrom_cd]
        if not os.path.isabs(cdrom_cd):
            cdrom_cd = utils_misc.get_path(data_dir.get_data_dir(), cdrom_cd)
        iso_image_dir = os.path.dirname(cdrom_cd)
        if file_size is None:
            file_size = 10

        file_name = utils_misc.get_path(iso_image_dir, "%s.iso" % (name))
        if prepare:
            cmd = "dd if=/dev/urandom of=%s bs=1M count=%d"
            utils.run(cmd % (name, file_size))
            utils.run("mkisofs -o %s %s" % (file_name, name))
            utils.run("rm -rf %s" % (name))
        return file_name
开发者ID:QiuMike,项目名称:tp-qemu,代码行数:27,代码来源:cdrom.py


示例7: get_base_image

 def get_base_image(self):
     """
     Get base image.
     """
     base_file = storage.get_image_filename(self.params,
                                            data_dir.get_data_dir())
     return self.vm.get_block({"file": base_file})
开发者ID:gogoxiaoxiao,项目名称:tp-qemu,代码行数:7,代码来源:live_snapshot_basic.py


示例8: run_drive_mirror_complete

def run_drive_mirror_complete(test, params, env):
    """
    Test block mirroring functionality

    1) Mirror the guest and switch to the mirrored one

    "qemu-img compare" is used to verify disk is mirrored successfully.
    """
    tag = params.get("source_images", "image1")
    qemu_img = qemu_storage.QemuImg(params, data_dir.get_data_dir(), tag)
    mirror_test = drive_mirror.DriveMirror(test, params, env, tag)
    try:
        source_image = mirror_test.get_image_file()
        target_image = mirror_test.get_target_image()
        mirror_test.start()
        mirror_test.wait_for_steady()
        mirror_test.vm.pause()
        mirror_test.reopen()
        device_id = mirror_test.vm.get_block({"file": target_image})
        if device_id != mirror_test.device:
            raise error.TestError("Mirrored image not being used by guest")
        time.sleep(5)
        error.context("Compare fully mirrored images", logging.info)
        qemu_img.compare_images(source_image, target_image)
        mirror_test.vm.destroy()
    finally:
        mirror_test.clean()
开发者ID:LeiCui,项目名称:virt-test,代码行数:27,代码来源:drive_mirror_complete.py


示例9: run_qemu_img

def run_qemu_img(test, params, env):
    """
    'qemu-img' functions test:
    1) Judge what subcommand is going to be tested
    2) Run subcommand test

    @param test: kvm test object
    @param params: Dictionary with the test parameters
    @param env: Dictionary with test environment.
    """
    cmd = utils_misc.get_path(test.bindir, params.get("qemu_img_binary"))
    if not os.path.exists(cmd):
        raise error.TestError("Binary of 'qemu-img' not found")
    image_format = params.get("image_format")
    image_size = params.get("image_size", "10G")
    image_name = storage.get_image_filename(params, data_dir.get_data_dir())


    def _check(cmd, img):
        """
        Simple 'qemu-img check' function implementation.

        @param cmd: qemu-img base command.
        @param img: image to be checked
        """
        cmd += " check %s" % img
        logging.info("Checking image '%s'...", img)
        try:
            output = utils.system_output(cmd)
        except error.CmdError, e:
            if "does not support checks" in str(e):
                return (True, "")
            else:
                return (False, str(e))
        return (True, output)
开发者ID:HeidCloud,项目名称:virt-test,代码行数:35,代码来源:qemu_img.py


示例10: check_test

    def check_test(cmd):
        """
        Subcommand 'qemu-img check' test.

        This tests will 'dd' to create a specified size file, and check it.
        Then convert it to supported image_format in each loop and check again.

        @param cmd: qemu-img base command.
        """
        test_image = utils_misc.get_path(data_dir.get_data_dir(),
                                         params["image_name_dd"])
        create_image_cmd = params["create_image_cmd"]
        create_image_cmd = create_image_cmd % test_image
        msg = " Create image %s by command %s" % (test_image, create_image_cmd)
        error.context(msg, logging.info)
        utils.system(create_image_cmd, verbose=False)
        status, output = _check(cmd, test_image)
        if not status:
            raise error.TestFail("Check image '%s' failed with error: %s" %
                                                          (test_image, output))
        for fmt in params["supported_image_formats"].split():
            output_image = test_image + ".%s" % fmt
            _convert(cmd, fmt, test_image, output_image)
            status, output = _check(cmd, output_image)
            if not status:
                raise error.TestFail("Check image '%s' got error: %s" %
                                                     (output_image, output))
            os.remove(output_image)
        os.remove(test_image)
开发者ID:LeiCui,项目名称:virt-test,代码行数:29,代码来源:qemu_img.py


示例11: run

def run(test, params, env):
    """
    Downgrade qcow2 image version:
    1) Get the version of the image
    2) Compare the version with expect version. If they are different,
    Amend the image with new version
    3) Check the amend result

    :param test: QEMU test object
    :param params: Dictionary with the test parameters
    :param env: Dictionary with test environment
    """
    ver_to = params.get("lower_version_qcow2", "0.10")
    error_context.context("Downgrade qcow2 image version to '%s'"
                          % ver_to, logging.info)
    image = params.get("images").split()[0]
    t_params = params.object_params(image)
    qemu_image = qemu_storage.QemuImg(t_params, data_dir.get_data_dir(), image)
    ver_from = utils_test.get_image_version(qemu_image)
    utils_test.update_qcow2_image_version(qemu_image, ver_from, ver_to)
    actual_compat = utils_test.get_image_version(qemu_image)
    if actual_compat != ver_to:
        err_msg = "Fail to downgrade qcow2 image version!"
        err_msg += "Actual: %s, expect: %s" % (actual_compat, ver_to)
        raise error.TestFail(err_msg)
开发者ID:CongLi,项目名称:tp-qemu,代码行数:25,代码来源:downgrade_qcow2_version.py


示例12: copy_nfs_image

def copy_nfs_image(params, image_name, root_dir):
    """
    copy image from image_path to nfs mount dir if image is not available
    or corrupted.

    :param params: Test dict params
    :param image_name: Master image name.
    :param root_dir: Base directory for relative filenames.
    :raise: TestSetupFail if image is unavailable/corrupted
    """
    image_format = params.get("image_format", "qcow2")
    if params.get("setup_local_nfs", "no") == "yes":
        # check for image availability in NFS shared path
        base_dir = params.get("images_base_dir", data_dir.get_data_dir())
        dst = get_image_filename(params, base_dir)
        if(not os.path.isfile(dst) or
           utils_misc.get_image_info(dst)['lcounts'].lower() == "true"):
            source = os.path.join(root_dir, "images", image_name)
            if image_format not in source:
                source = "%s.%s" % (source, image_format)
            logging.debug("Checking for image available in image data "
                          "path - %s", source)
            # check for image availability in images data directory
            if(os.path.isfile(source) and not
               utils_misc.get_image_info(source)['lcounts'].lower() == "true"):
                logging.debug("Copying guest image from %s to %s", source,
                              dst)
                shutil.copy(source, dst)
            else:
                raise exceptions.TestSetupFail("Guest image is unavailable"
                                               "/corrupted in %s and %s" %
                                               (source, dst))
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:32,代码来源:storage.py


示例13: create_cdrom

    def create_cdrom(params, name, prepare=True, file_size=None):
        """
        Creates 'new' cdrom with one file on it

        @param params: paramters for test
        @param name: name of new cdrom file
        @param preapre: if True then it prepare cd images.
        @param file_size: Size of CDrom in MB

        @return: path to new cdrom file.
        """
        error.context("creating test cdrom")
        cdrom_cd1 = params.get("cdrom_cd1")
        if not os.path.isabs(cdrom_cd1):
            cdrom_cd1 = os.path.join(data_dir.get_data_dir(), cdrom_cd1)
        cdrom_dir = os.path.dirname(cdrom_cd1)
        if file_size is None:
            file_size = 10

        file_name = os.path.join(cdrom_dir, "%s.iso" % (name))
        if prepare:
            utils.run("dd if=/dev/urandom of=%s bs=1M count=%d" %
                                                            (name, file_size))
            utils.run("mkisofs -o %s %s" % (file_name, name))
            utils.run("rm -rf %s" % (name))
        return file_name
开发者ID:QiuMike,项目名称:virt-test,代码行数:26,代码来源:cdrom.py


示例14: get_snapshot_file

 def get_snapshot_file(self):
     """
     Get path of snapshot file.
     """
     image_format = self.params["image_format"]
     snapshot_file = "images/%s.%s" % (self.snapshot_file, image_format)
     return utils_misc.get_path(data_dir.get_data_dir(), snapshot_file)
开发者ID:bssrikanth,项目名称:tp-qemu,代码行数:7,代码来源:live_snapshot_basic.py


示例15: check_test

    def check_test(cmd):
        """
        Subcommand 'qemu-img check' test.

        This tests will 'dd' to create a specified size file, and check it.
        Then convert it to supported image_format in each loop and check again.

        @param cmd: qemu-img base command.
        """
        test_image = utils_misc.get_path(data_dir.get_data_dir(),
                                         params.get("image_name_dd"))
        print "test_image = %s" % test_image
        create_image_cmd = params.get("create_image_cmd")
        create_image_cmd = create_image_cmd % test_image
        print "create_image_cmd = %s" % create_image_cmd
        utils.system(create_image_cmd)
        s, o = _check(cmd, test_image)
        if not s:
            raise error.TestFail("Check image '%s' failed with error: %s" %
                                                           (test_image, o))
        for fmt in params.get("supported_image_formats").split():
            output_image = test_image + ".%s" % fmt
            _convert(cmd, fmt, test_image, output_image)
            s, o = _check(cmd, output_image)
            if not s:
                raise error.TestFail("Check image '%s' got error: %s" %
                                                     (output_image, o))
            os.remove(output_image)
        os.remove(test_image)
开发者ID:HeidCloud,项目名称:virt-test,代码行数:29,代码来源:qemu_img.py


示例16: find_image

 def find_image(image_name):
     """
     Find the path of the iamge.
     """
     image_params = params.object_params(image_name)
     o = storage.get_image_filename(image_params, data_dir.get_data_dir())
     return o
开发者ID:Zhengtong,项目名称:tp-qemu,代码行数:7,代码来源:block_hotplug.py


示例17: run_drive_mirror_continuous_backup

def run_drive_mirror_continuous_backup(test, params, env):
    """
    1) Synchronize disk and then do continuous backup

    "qemu-img compare" is used to verify disk is mirrored successfully.
    """
    tag = params.get("source_images", "image1")
    qemu_img = qemu_storage.QemuImg(params, data_dir.get_data_dir(), tag)
    mirror_test = drive_mirror.DriveMirror(test, params, env, tag)
    tmp_dir = params.get("tmp_dir", "c:\\")
    clean_cmd = params.get("clean_cmd", "del /f /s /q tmp*.file")
    dd_cmd = "dd if=/dev/zero bs=1024 count=1024 of=tmp%s.file"
    dd_cmd = params.get("dd_cmd", dd_cmd)
    try:
        source_image = mirror_test.get_image_file()
        target_image = mirror_test.get_target_image()
        mirror_test.start()
        mirror_test.wait_for_steady()
        error.context("Testing continuous backup")
        session = mirror_test.get_session()
        session.cmd("cd %s" % tmp_dir)
        for fn in range(0, 128):
            session.cmd(dd_cmd % fn)
        time.sleep(10)
        mirror_test.vm.pause()
        time.sleep(5)
        error.context("Compare original and backup images", logging.info)
        qemu_img.compare_images(source_image, target_image)
        mirror_test.vm.resume()
        session = mirror_test.get_session()
        session.cmd("cd %s" % tmp_dir)
        session.cmd(clean_cmd)
        mirror_test.vm.destroy()
    finally:
        mirror_test.clean()
开发者ID:Antique,项目名称:virt-test,代码行数:35,代码来源:drive_mirror_continuous_backup.py


示例18: prepare_gluster_disk

    def prepare_gluster_disk(disk_img, disk_format):
        """
        Setup glusterfs and prepare disk image.
        """
        # Get the image path and name from parameters
        data_path = data_dir.get_data_dir()
        image_name = params.get("image_name")
        image_format = params.get("image_format")
        image_source = os.path.join(data_path,
                                    image_name + '.' + image_format)

        # Setup gluster.
        host_ip = libvirt.setup_or_cleanup_gluster(True, vol_name,
                                                   brick_path, pool_name)
        logging.debug("host ip: %s ", host_ip)
        image_info = utils_misc.get_image_info(image_source)
        if image_info["format"] == disk_format:
            disk_cmd = ("cp -f %s /mnt/%s" % (image_source, disk_img))
        else:
            # Convert the disk format
            disk_cmd = ("qemu-img convert -f %s -O %s %s /mnt/%s" %
                        (image_info["format"], disk_format, image_source, disk_img))

        # Mount the gluster disk and create the image.
        utils.run("mount -t glusterfs %s:%s /mnt;"
                  " %s; chmod a+rw /mnt/%s; umount /mnt"
                  % (host_ip, vol_name, disk_cmd, disk_img))

        return host_ip
开发者ID:noxdafox,项目名称:tp-libvirt,代码行数:29,代码来源:virtual_disks_gluster.py


示例19: create_gluster_vol

def create_gluster_vol(params):
    vol_name = params.get("gluster_volume_name")
    force = params.get('force_recreate_gluster') == "yes"

    brick_path = params.get("gluster_brick")
    if not os.path.isabs(brick_path):  # do nothing when path is absolute
        base_dir = params.get("images_base_dir", data_dir.get_data_dir())
        brick_path = os.path.join(base_dir, brick_path)

    error_context.context("Host name lookup failed")
    hostname = socket.gethostname()
    if not hostname or hostname == "(none)":
        if_up = utils_net.get_net_if(state="UP")
        for i in if_up:
            ipv4_value = utils_net.get_net_if_addrs(i)["ipv4"]
            logging.debug("ipv4_value is %s", ipv4_value)
            if ipv4_value != []:
                ip_addr = ipv4_value[0]
                break
        hostname = ip_addr

    # Start the gluster dameon, if not started
    glusterd_start()
    # Check for the volume is already present, if not create one.
    if not is_gluster_vol_avail(vol_name) or force:
        return gluster_vol_create(vol_name, hostname, brick_path, force)
    else:
        return True
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:28,代码来源:gluster.py


示例20: check_cluster_size

    def check_cluster_size(parttern, expect, csize_set):
        cfail = 0
        fail_log = ""
        image_name = params.get("images")
        image_params = params.object_params(image_name)
        image = qemu_storage.QemuImg(image_params, data_dir.get_data_dir(),
                                     image_name)

        image.create(image_params)
        output = image.info()
        error.context("Check the cluster size from output", logging.info)
        cluster_size = re.findall(parttern, output)
        if cluster_size:
            if cluster_size[0] != expect:
                logging.error("Cluster size mismatch")
                logging.error("Cluster size report by command: %s"
                              % cluster_size)
                logging.error("Cluster size expect: %s" % expect)
                cfail += 1
                fail_log += "Cluster size mismatch when set it to "
                fail_log += "%s.\n" % csize_set
        else:
            logging.error("Can not get the cluster size from command: %s"
                           % output)
            cfail += 1
            fail_log += "Can not get the cluster size from command:"
            fail_log += " %s\n" % output
        return cfail, fail_log
开发者ID:FengYang,项目名称:virt-test,代码行数:28,代码来源:cluster_size_check.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python data_dir.get_deps_dir函数代码示例发布时间:2022-05-26
下一篇:
Python compat_52lts.results_stdout_52lts函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap