コード例 #1
0
ファイル: vm_actions_rv.py プロジェクト: spiceqa/tp-spice
def rv_basic_opts(vmi):
    """Command line parameters for RV.

    """
    cfg = vmi.cfg
    rv_cmd = utils.Cmd()
    rv_cmd.append(cfg.rv_binary)
    if cfg.rv_debug:
        rv_cmd.append("--spice-debug")
    if cfg.full_screen:
        rv_cmd.append("--full-screen")
    if cfg.disable_audio:
        rv_cmd.append("--spice-disable-audio")
    if cfg.smartcard:
        rv_cmd.append("--spice-smartcard")
        if cfg.certdb:
            rv_cmd.append("--spice-smartcard-db")
            rv_cmd.append(cfg.certdb)
        if cfg.gencerts:
            rv_cmd.append("--spice-smartcard-certificates")
            rv_cmd.append(cfg.gencerts)
    if cfg.usb_redirection_add_device:
        logger.info("Auto USB redirect for devices class == 0x08.")
        opt = r'--spice-usbredir-redirect-on-connect="0x08,-1,-1,-1,1"'
        rv_cmd.append(opt)
    if utils.is_yes(vmi.test.kvm_g.spice_ssl):
        cacert_host = utils.cacert_path_host(vmi.test)
        cacert_client = act.cp_file(vmi, cacert_host)
        opt = "--spice-ca-file=%s" % cacert_client
        rv_cmd.append(opt)
        if cfg.spice_client_host_subject:
            host_subj = utils.get_host_subj(vmi.test)
            opt = '--spice-host-subject=%s' % host_subj
            rv_cmd.append(opt)
    return rv_cmd
コード例 #2
0
def rv_basic_opts(vmi):
    """Command line parameters for RV.

    """
    cfg = vmi.cfg
    rv_cmd = utils.Cmd()
    rv_cmd.append(cfg.rv_binary)
    if cfg.rv_debug:
        rv_cmd.append("--spice-debug")
    if cfg.full_screen:
        rv_cmd.append("--full-screen")
    if cfg.disable_audio:
        rv_cmd.append("--spice-disable-audio")
    if cfg.smartcard:
        rv_cmd.append("--spice-smartcard")
        if cfg.certdb:
            rv_cmd.append("--spice-smartcard-db")
            rv_cmd.append(cfg.certdb)
        if cfg.gencerts:
            rv_cmd.append("--spice-smartcard-certificates")
            rv_cmd.append(cfg.gencerts)
    if cfg.usb_redirection_add_device:
        logger.info("Auto USB redirect for devices class == 0x08.")
        opt = r'--spice-usbredir-redirect-on-connect="0x08,-1,-1,-1,1"'
        rv_cmd.append(opt)
    if utils.is_yes(vmi.test.kvm_g.spice_ssl):
        cacert_host = utils.cacert_path_host(vmi.test)
        cacert_client = act.cp_file(vmi, cacert_host)
        opt = "--spice-ca-file=%s" % cacert_client
        rv_cmd.append(opt)
        if cfg.spice_client_host_subject:
            host_subj = utils.get_host_subj(vmi.test)
            opt = '--spice-host-subject=%s' % host_subj
            rv_cmd.append(opt)
    return rv_cmd
コード例 #3
0
def gen_vv_file(vmi):
    """Generates vv file for remote-viewer.

    Parameters
    ----------
    test : SpiceTest
        Spice test object.

    """
    test = vmi.test
    cfg = vmi.cfg
    host_dir = os.path.expanduser('~')
    fpath = os.path.join(host_dir, cfg.rv_file)
    rv_file = open(fpath, 'w')
    rv_file.write("[virt-viewer]\n")
    rv_file.write("type=%s\n" % cfg.display)
    rv_file.write("host=%s\n" % utils.get_host_ip(test))
    rv_file.write("port=%s\n" % test.kvm_g.spice_port)
    if cfg.ticket_send:
        rv_file.write("password=%s\n" % cfg.ticket_send)
    if utils.is_yes(test.kvm_g.spice_ssl):
        rv_file.write("tls-port=%s\n" % test.kvm_g.spice_tls_port)
        rv_file.write("tls-ciphers=DEFAULT\n")
    host_subj = utils.get_host_subj(test)
    if host_subj:
        rv_file.write("host-subject=%s\n" % host_subj)
    cacert_host = utils.cacert_path_host(test)
    if cacert_host:
        cert = open(cacert_host)
        cert_auth = cert.read()
        cert_auth = cert_auth.replace('\n', r'\n')
        rv_file.write("ca=%s\n" % cert_auth)
    if cfg.full_screen:
        rv_file.write("fullscreen=1\n")
    if cfg.spice_proxy:
        rv_file.write("proxy=%s\n" % cfg.spice_proxy)
    if cfg.min_ver:
        if cfg.min_ver == "higher":
            real_ver = act.rpm_version(vmi, "virt-viewer")[0]
            v, rev = real_ver.split('.')
            ver = v + '.' + str(int(rev) + 1)
        else:
            ver = cfg.min_ver
        rv_file.write("versions=%s:%s\n" % (cfg.os_variant, ver))
    if cfg.new_ver:
        rv_file.write("newer-version-url=%s\n" % cfg.new_ver)
    if cfg.rv_debug:
        """TODO"""
        # rv_cmd.append("--spice-debug")  ..todo:: XXX TODO
    rv_file.close()
    return fpath
コード例 #4
0
ファイル: vm_actions_rv.py プロジェクト: spiceqa/tp-spice
def gen_vv_file(vmi):
    """Generates vv file for remote-viewer.

    Parameters
    ----------
    test : SpiceTest
        Spice test object.

    """
    test = vmi.test
    cfg = vmi.cfg
    host_dir = os.path.expanduser('~')
    fpath = os.path.join(host_dir, cfg.rv_file)
    rv_file = open(fpath, 'w')
    rv_file.write("[virt-viewer]\n")
    rv_file.write("type=%s\n" % cfg.display)
    rv_file.write("host=%s\n" % utils.get_host_ip(test))
    rv_file.write("port=%s\n" % test.kvm_g.spice_port)
    if cfg.ticket_send:
        rv_file.write("password=%s\n" % cfg.ticket_send)
    if utils.is_yes(test.kvm_g.spice_ssl):
        rv_file.write("tls-port=%s\n" % test.kvm_g.spice_tls_port)
        rv_file.write("tls-ciphers=DEFAULT\n")
    host_subj = utils.get_host_subj(test)
    if host_subj:
        rv_file.write("host-subject=%s\n" % host_subj)
    cacert_host = utils.cacert_path_host(test)
    if cacert_host:
        cert = open(cacert_host)
        cert_auth = cert.read()
        cert_auth = cert_auth.replace('\n', r'\n')
        rv_file.write("ca=%s\n" % cert_auth)
    if cfg.full_screen:
        rv_file.write("fullscreen=1\n")
    if cfg.spice_proxy:
        rv_file.write("proxy=%s\n" % cfg.spice_proxy)
    if cfg.rv_debug:
        """TODO"""
        # rv_cmd.append("--spice-debug")  ..todo:: XXX TODO
    rv_file.close()
    return fpath