Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(15)  |  Call(7)  |  Derive(0)  |  Import(8)
<comment-ja>
</comment-ja>
<comment-en>
get list of libvirt's uri
</comment-en>

        def available_virt_uris():
    """
    
    
    get list of libvirt's uri
    
    """
    from karesansui.lib.const import VIRT_LIBVIRTD_CONFIG_FILE, \
               VIRT_LIBVIRT_SOCKET_RW, VIRT_LIBVIRT_SOCKET_RO, \
               KVM_VIRT_URI_RW, KVM_VIRT_URI_RO, \
               XEN_VIRT_URI_RW, XEN_VIRT_URI_RO

    uris = {}
    mechs = available_virt_mechs()
    if len(mechs) == 0:
        mechs = ['KVM']

    for _mech in mechs:
        hostname = "127.0.0.1"
        if _mech == "XEN":
            uris[_mech] = XEN_VIRT_URI_RW
        if _mech == "KVM":
            if os.path.exists(VIRT_LIBVIRTD_CONFIG_FILE):
                opts = sh_config_read(VIRT_LIBVIRTD_CONFIG_FILE)
                uri_prefix = "qemu"
                uri_suffix = ""
                uri_args = ""

                try:
                    if opts["listen_tcp"] == "1":
                        uri_prefix = "qemu+tcp"
                        try:
                            opts["tcp_port"]
                            port_number = opts["tcp_port"]
                        except:
                            port_number = "16509"
                except:
                    pass

                try:
                    if opts["listen_tls"] == "1":
                        uri_prefix = "qemu+tls"
                        try:
                            opts["tls_port"]
                            port_number = opts["tls_port"]
                        except:
                            port_number = "16514"
                        uri_args += "?no_verify=1"
                        hostname = os.uname()[1]
                except:
                    pass

                try:
                    port_number
                    uri_suffix += ":%s/system%s" % (port_number, uri_args,)
                except:
                    uri_suffix += "/system%s" % (uri_args,)

                #print "%s://%s%s" % (uri_prefix,hostname,uri_suffix,)
                uris[_mech] = "%s://%s%s" % (uri_prefix,hostname,uri_suffix,)
            else:
                uris[_mech] = KVM_VIRT_URI_RW

    return uris
        


src/k/a/karesansui-HEAD/karesansui/lib/virt/virt.py   karesansui(Download)
from karesansui.lib.utils import copy_file            as CopyFile
from karesansui.lib.net.http import wget              as DownloadFile
from karesansui.lib.utils import is_uuid, get_ifconfig_info, r_chgrp, r_chmod, \
  getfilesize_str, get_filesize_MB, get_disk_img_info, available_virt_uris, \
  is_iso9660_filesystem_format, is_windows_bootable_iso, is_darwin_bootable_iso, \
        """
        if uri == None:
            uris = available_virt_uris()
            try:
                uri = uris["KVM"]

src/k/a/karesansui-HEAD/karesansui/gadget/guest.py   karesansui(Download)
from karesansui.lib.const import XEN_KEYMAP_DIR, KVM_KEYMAP_DIR, KVM_BRIDGE_PREFIX
 
from karesansui.lib.utils import comma_split, \
     generate_mac_address, is_param, \
     next_number, generate_uuid, string_from_uuid, uniq_sort, \
 
        model = findbyhost1(self.orm, host_id)
        uris = available_virt_uris()
 
        #import pdb; pdb.set_trace()

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1.py   karesansui(Download)
from karesansui.lib.merge import MergeHost
from karesansui.lib.virt.virt import KaresansuiVirtConnection, KaresansuiVirtConnectionAuth
from karesansui.lib.utils import \
    comma_split, uniq_sort, is_param, json_dumps, \
    get_proc_cpuinfo, get_proc_meminfo, get_partition_info, \
        model = findbyhost1(self.orm, host_id)
 
        uris = available_virt_uris()
        if model.attribute == 0 and model.hypervisor == 1:
            uri = uris["XEN"]

src/k/a/karesansui-HEAD/bin/karesansui_sysinfo.py   karesansui(Download)
    from karesansui.lib.utils import load_locale
    from karesansui.lib.utils import is_executable, execute_command
    from karesansui.lib.utils import available_virt_uris
    from karesansui.lib.utils import available_virt_mechs
 

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1network.py   karesansui(Download)
    CHECK_UNIQUE
 
from karesansui.lib.utils import is_param, is_empty, available_virt_uris
 
def validates_network(obj, network_name=None):
        model = findbyhost1(self.orm, host_id)
 
        uris = available_virt_uris()
        if model.attribute == 0 and model.hypervisor == 1:
            uri = uris["XEN"]
        model = findbyhost1(self.orm, host_id)
 
        uris = available_virt_uris()
        if model.attribute == 0 and model.hypervisor == 1:
            uri = uris["XEN"]

src/k/a/karesansui-HEAD/karesansui/lib/collectd/config.py   karesansui(Download)
    dop.cdp_set("collectdplugin",keys,value,multiple_file=True)
 
    from karesansui.lib.utils import available_virt_mechs, available_virt_uris
    keys = _keys + ["Connection"]
    mech = available_virt_mechs()[0]
    value = "\"%s\"" % available_virt_uris()[mech]

src/k/a/karesansui-HEAD/karesansui/gadget/hostby1networkby1.py   karesansui(Download)
    CHECK_UNIQUE
 
from karesansui.lib.utils import is_param, is_empty, available_virt_uris
 
def validates_network(obj, network_name=None):

src/k/a/karesansui-HEAD/karesansui/gadget/tree.py   karesansui(Download)
from karesansui.lib.merge import MergeHost
from karesansui.db.access.machine import findbyhostall
from karesansui.lib.utils import available_virt_uris
 
class Tree(Rest):
    def _GET(self, *param, **params):
        models = findbyhostall(self.orm)
        uris = available_virt_uris()
 
        try: