Esempio n. 1
0
def choose_best_store_schemes(source_endpoint, dest_endpoint):
    global GLANCE_STORES
    source_host = s_utils.get_host_from_ep(source_endpoint)
    dest_host = s_utils.get_host_from_ep(dest_endpoint)
    source_store = GLANCE_STORES.get_glance_store(source_host)
    dest_store = GLANCE_STORES.get_glance_store(dest_host)
    tmp_dict = {}
    for s_scheme in source_store.schemes:
        s_scheme_name = s_scheme['name']
        for d_scheme in dest_store.schemes:
            d_scheme_name = d_scheme['name']
            if s_scheme_name == d_scheme_name:
                tmp_dict[s_scheme_name] = (s_scheme, d_scheme)
    if tmp_dict:
        return tmp_dict[sorted(tmp_dict, key=lambda scheme:
                               PRIOR_SOTRE_SCHEMES.index(scheme))[0]]

    return (source_store.schemes[0], dest_store.schemes[0])
Esempio n. 2
0
 def generate_Image_obj(self, image_id, endpoint):
     g_store = self.get_glance_store(s_utils.get_host_from_ep(endpoint))
     return ImageObject(image_id, g_store)