Changeset 8353

Show
Ignore:
Timestamp:
06/02/10 11:35:38 (3 years ago)
Author:
wligon
Message:

*** empty log message ***

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/Orange-Migrate-Tools/src/client/sysint/mgmt-migrate.sm

    r8346 r8353  
    2222extern job_context_id pint_client_sm_context; 
    2323 
     24static int mgmt_migrate_comp_fn( 
     25                void *v_p, struct PVFS_server_resp *resp, int i); 
    2426 
    2527%% 
     
    2931        state init{ 
    3032                run mgmt_migrate_init; 
    31                 default => validate_inputs 
    32         } 
    33          
    34         //Validate inputs- filename, destination server 
    35         state validate_inputs{ 
    36                 run mgmt_migrate_validate_inputs; 
    37                 success => migrate_setup_msgpair; 
    38                 default => cleanup; 
    39         } 
    40          
    41         //Setup a PVFS_mgmt_migrate request 
     33                default => migrate_setup_msgpair; 
     34        } 
    4235         
    4336        state migrate_setup_msgpair{ 
     
    6053 
    6154%% 
     55 
    6256 
    6357PVFS_error PVFS_imgmt_migrate( 
     
    7165    PINT_smcb *smcb = NULL; 
    7266    PINT_client_sm *sm_p = NULL; 
     67     
     68     gossip_debug(GOSSIP_CLIENT_DEBUG, 
     69                 "PVFS_imgmt_migrate entered\n"); 
     70                  
     71                  
     72      
     73    if ((ref.handle == PVFS_HANDLE_NULL) || 
     74        (ref.fs_id == PVFS_FS_ID_NULL)) 
     75    { 
     76        gossip_err("invalid (NULL) required argument\n"); 
     77        return ret; 
     78    } 
     79              
    7380     
    7481    PINT_smcb_alloc(&smcb, PVFS_MGMT_MIGRATE, 
     
    8087        return -PVFS_ENOMEM; 
    8188    } 
    82      
    83      
     89        
    8490    sm_p = PINT_sm_frame(smcb, PINT_CURRENT_FRAME); 
    8591    PINT_init_msgarray_params(sm_p, ref.fs_id); 
    8692    PINT_init_sysint_credentials(sm->cred_p, credentials); 
     93     
    8794    /* fill in stuff in the union */ 
     95     
    8896    sm_p->error_code = 0; 
    8997    sm_p->object_ref = ref; 
     
    106114                         
    107115        ret = PVFS_imgmt_migrate(credentials, &op_id, hints) 
    108          
    109                          
    110                          
     116        if(ret) 
     117        { 
     118                PVFS_perror_gossip("PVFS_imgmt_migrate call", ret); 
     119        error = ret;                     
     120        } 
     121        else 
     122        { 
     123                ret = PVFS_mgmt_wait(op_id, "migrate", &error); 
     124        if (ret) 
     125        { 
     126            PVFS_perror_gossip("PVFS_mgmt_wait call", ret); 
     127            error = ret; 
     128        } 
     129    }            
    111130                         
    112131         
     
    115134} 
    116135/************************************************************************/ 
     136 
     137static int mgmt_migrate_comp_fn( 
     138                void *v_p, struct PVFS_server_resp *resp, int i) 
     139{ 
     140        /*need to know what this does */ 
     141        gossip_debug(GOSSIP_CLIENT_DEBUG, "mgmt_migrate_comp_fn\n"); 
     142         
     143         
     144        return resp->status;                     
     145} 
     146 
    117147 
    118148static PINT_sm_action mgmt_migrate_init( 
     
    124154} 
    125155 
    126 static PINT_sm_action mgmt_migrate_validate_inputs( 
    127                 struct PINT_smcb *smcb, job_status_s js_p) 
    128 { 
    129         PVFS_error ret = PVFS_sys_lookup(fs_id, name            //needs to be looked at and fixed up 
    130                                                 credentials, PVFS_sysresp_lookup, 
    131                                                 int32_t follow_link, hints); 
    132  
    133          
    134 } 
    135  
    136156static PINT_sm_action mgmt_migrate_setup_msgpair( 
    137157                struct PINT_smcb *smcb, job_status_s js_p) 
    138158{ 
     159        gossip_debug(GOSSIP_CLIENT_DEBUG, "mgmt_migrate_setup_msgpair called\n"); 
     160         
    139161        struct PINT_client_sm *sm_p = PINT_sm_frame(smbc, PINT_FRAME_CURRET); 
    140162        int ret = -PVFS_EINVAL; 
     
    154176     
    155177    /*stuff here as well */ 
    156          
     178     
     179        msg_p->comp_fn = mgmt_migrate_comp_fn; 
     180                 
    157181        ret = PINT_cached_config_map_to_server( 
    158182        &msg_p->svr_addr, msg_p->handle, msg_p->fs_id); 
     
    168192        return SM_ACTION_COMPLETE; 
    169193}                
     194                 
     195 
     196static PINT_sm_action mgmt_migrate_cleanup( 
     197                struct PINT_smcb *smcb, job_status_s js_p) 
     198{ 
     199        stuct PINT_client_sm *sm_p = PINT_sm_frame(smcb, PINT_CURRENT_FRAME); 
     200         
     201        gossip_debug(GOSSIP_CLIENT_DEBUG, 
     202                "mgmt_migrate state: mgmt_migrate_cleanup\n"); 
     203                 
     204        sm_p->error_code = js_p->error_code;     
     205                 
     206        /*do something involving cache or free allocated stuff*/         
     207                 
     208        PINT_SET_OP_COMPLETE; 
     209        return SM_ACTION_TERMINATE;      
     210} 
     211 
     212/* 
     213 * Local variables: 
     214 *  mode: c 
     215 *  c-indent-level: 4 
     216 *  c-basic-offset: 4 
     217 * End: 
     218 * 
     219 * vim: ft=c ts=8 sts=4 sw=4 expandtab 
     220 */