Пример #1
0
def list_templates():
    """ Prints all local and remote templates """
    # local templates
    for vm_type in ["openvz", "kvm"]:
        print "%s local templates:" % vm_type.upper()
        for storage_pool in storage.list_pools():
            print "\t", "Storage:", os.path.join(config.c("general", "storage-endpoint"),
                                                 storage_pool, vm_type)
            for tmpl in get_local_templates(storage_pool, vm_type):
                print "\t\t", tmpl
            print
    # remote templates
    repo_groups = re.split(",\s*", config.c("general", "repo-groups"))
    repo_groups = [repo_group + "-repo" for repo_group in repo_groups]
    for repo_group in repo_groups:
        url, vm_type = config.c(repo_group, "url"), config.c(repo_group, "type")
        print "%s remote templates:" % vm_type.upper()
        print "\t", "Repository:", url
        for tmpl in get_template_list(repo_group):
            print "\t\t",  tmpl
        print
Пример #2
0
def list_templates():
    """ Prints all local and remote templates """
    # local templates
    config = get_config()
    for vm_type in ["openvz", "kvm"]:
        log.info("%s local templates:", vm_type.upper())
        for storage_pool in storage.list_pools():
            log.info("\t Storage: %s",
                     os.path.join(config.getstring("general", "storage-endpoint"),
                                  storage_pool[0], vm_type))
            for tmpl in get_local_templates(vm_type, storage_pool[0]):
                log.info("\t\t %s", tmpl)
            log.info('')
    # remote templates
    repo_groups = re.split(",\s*", config.getstring("general", "repo-groups"))
    repo_groups = [repo_group + "-repo" for repo_group in repo_groups]
    for repo_group in repo_groups:
        url, vm_type = config.getstring(repo_group, "url"), config.getstring(repo_group, "type")
        log.info("%s remote templates:", vm_type.upper())
        log.info("\t Repository: %s", url)
        for tmpl in get_template_list(repo_group):
            log.info("\t\t %s", tmpl)
        log.info('')
Пример #3
0
def list_templates():
    """ Prints all local and remote templates """
    # local templates
    config = get_config()
    for vm_type in ["openvz", "kvm"]:
        log.info("%s local templates:", vm_type.upper())
        for storage_pool in storage.list_pools():
            log.info("\t Storage: %s",
                     os.path.join(config.getstring("general", "storage-endpoint"),
                                  storage_pool[0], vm_type))
            for tmpl in get_local_templates(vm_type, storage_pool[0]):
                log.info("\t\t %s", tmpl)
            log.info('')
    # remote templates
    repo_groups = re.split(",\s*", config.getstring("general", "repo-groups"))
    repo_groups = [repo_group + "-repo" for repo_group in repo_groups]
    for repo_group in repo_groups:
        url, vm_type = config.getstring(repo_group, "url"), config.getstring(repo_group, "type")
        log.info("%s remote templates:", vm_type.upper())
        log.info("\t Repository: %s", url)
        for tmpl in get_template_list(repo_group):
            log.info("\t\t %s", tmpl)
        log.info('')