def checker():
    request = Request()
    
    token = keystone_api.simple_auth(settings.ADMIN_USER_NAME,settings.ADMIN_PASSWORD)
    
    _set_request_data(request,token)
    
    
    request.ouser = User()
    
    request.ouser = User(id=request.session['user_id'],
                        token=request.session['token'],
                        name=request.session['user_name'],
                        tenant_id=request.session['tenant_id'],
                        tenant_name=request.session['tenant'],
                        service_catalog=request.session['serviceCatalog'],
                        roles=request.session['roles'])
    
    instances = nova_api.server_list(request,all_tenants=True)
    
    flavors = nova_api.flavor_list(request)
    full_flavors = SortedDict([(str(flavor.id), flavor) for flavor in flavors])
    for instance in instances:
        _extra_instance(request, instance, detailed=True, full_flavors=full_flavors)
    
    ins_list = list()
    for i in instances:
        ins = dict()
        ins['ip_address'] = i.addresses
        ins['name'] = i.name
        ins['power_state'] = i.power_state
        ins['id'] = i.id
        ins['physical_host'] = i.physical_host
        ins['full_flavor'] = i.full_flavor.id
        ins_list.append(ins)
    #return ins_list

    instance_id = '1e79faf8-7522-42b0-8034-9a108cf11ee2'
    
    snapshots = nova_api.snapshot_list(request, detailed=True)
    for snapshot in snapshots:
        src_server_id = getattr(snapshot,'server',{}).get('id',None)
        if src_server_id == instance_id:
            image_id = snapshot.id
            break
    
    if src_server_id:
        server_instance = nova_api.server_get(request,src_server_id)
        
        flavor_id = server_instance.flavor.get('id')
        name = server_instance.name + '-lb'
        
        second_instance = nova_api.server_create(request,name,image_id,flavor_id,key_name=None,user_data=None)
        
        lb_first_instance = server_instance
        lb_second_instance = second_instance
        
    else:
        print "%s has no snapshot!" % instance_id
    
    _set_request_data(request,token)
    
    
    request.ouser = User()
    
    request.ouser = User(id=request.session['user_id'],
                        #account_id=request.session['account_id'],
                        token=request.session['token'],
                        name=request.session['user_name'],
                        tenant_id=request.session['tenant_id'],
                        tenant_name=request.session['tenant'],
                        service_catalog=request.session['serviceCatalog'],
                        roles=request.session['roles'])
    try:
        ins = nova_api.server_get(request,uuid)
    except:
        return False
    else:
        return True


def checker():
    request = Request()
    
    token = keystone_api.simple_auth(settings.ADMIN_USER_NAME,settings.ADMIN_PASSWORD)
    
    _set_request_data(request,token)
    
    
    request.ouser = User()