Commit 2d2cef06 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Merge branch 'amiranda/133-use-configured-scripts-for-adhoc-deployment-teardown' into 'main'

Resolve "Use configured scripts for adhoc deployment/teardown"

This MR updates the deployment and termination RPCs so that they are
executed by `scord-ctl`. The mechanism takes advantage of the 
configuration information added in !93 to generate generic commands
for each configured adhoc storage instance.

This MR also updates `ADM_register_adhoc_storage`, making it generate
and record an internal `adhoc_uuid` that can be forwarded to `scord-ctl`
to refer to running adhoc storage instances.

This MR also renames the RPC `ADM_tear_down_adhoc_storage` to
`ADM_terminate_adhoc_storage`.

Closes #133

See merge request !94
parents 1d6e45a2 74025603
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ find_package(RedisPlusPlus 1.3.3 REQUIRED)
# set compile flags
add_compile_options("-Wall" "-Wextra" "-Werror" "$<$<CONFIG:RELEASE>:-O3>")
add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:SCORD_DEBUG_BUILD>")
add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:__LOGGER_ENABLE_DEBUG__>")
add_compile_definitions("$<$<CONFIG:DEBUG,ASan>:LOGGER_ENABLE_DEBUG>")

add_subdirectory(etc)
add_subdirectory(src)
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ RPC_NAMES = {
    'ADM_register_job', 'ADM_update_job', 'ADM_remove_job',
    'ADM_register_adhoc_storage', 'ADM_update_adhoc_storage',
    'ADM_remove_adhoc_storage', 'ADM_deploy_adhoc_storage',
    'ADM_tear_down_adhoc_storage',
    'ADM_terminate_adhoc_storage',
    'ADM_register_pfs_storage', 'ADM_update_pfs_storage',
    'ADM_remove_pfs_storage',
    'ADM_transfer_datasets', 'ADM_get_transfer_priority',
+7 −4
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ main(int argc, char* argv[]) {
    ADM_adhoc_context_t adhoc_ctx = NULL;
    ADM_adhoc_context_t new_adhoc_ctx = NULL;
    ADM_adhoc_storage_t adhoc_storage = NULL;
    char* adhoc_storage_path = NULL;


    // Let's prepare all the information required by the API calls.
@@ -101,9 +102,9 @@ main(int argc, char* argv[]) {
    }

    // 2. Register the adhoc storage
    if(ADM_register_adhoc_storage(
               server, adhoc_name, ADM_ADHOC_STORAGE_DATACLAY, adhoc_ctx,
               adhoc_resources, &adhoc_storage) != ADM_SUCCESS) {
    if(ADM_register_adhoc_storage(server, adhoc_name, ADM_ADHOC_STORAGE_GEKKOFS,
                                  adhoc_ctx, adhoc_resources,
                                  &adhoc_storage) != ADM_SUCCESS) {
        fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n",
                ADM_strerror(ret));
        goto cleanup;
@@ -124,7 +125,8 @@ main(int argc, char* argv[]) {
    }

    // We can now request the deployment to the server
    if((ret = ADM_deploy_adhoc_storage(server, adhoc_storage)) != ADM_SUCCESS) {
    if((ret = ADM_deploy_adhoc_storage(server, adhoc_storage,
                                       &adhoc_storage_path)) != ADM_SUCCESS) {
        fprintf(stderr, "ADM_deploy_adhoc_storage() failed: %s\n",
                ADM_strerror(ret));
        goto cleanup;
@@ -144,6 +146,7 @@ main(int argc, char* argv[]) {


cleanup:
    free(adhoc_storage_path);
    ADM_server_destroy(server);
    ADM_adhoc_context_destroy(new_adhoc_ctx);
    ADM_adhoc_context_destroy(adhoc_ctx);
+9 −6
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ main(int argc, char* argv[]) {
    ADM_adhoc_context_t adhoc_ctx = NULL;
    ADM_adhoc_context_t new_adhoc_ctx = NULL;
    ADM_adhoc_storage_t adhoc_storage = NULL;
    char* adhoc_storage_path = NULL;


    // Let's prepare all the information required by the API calls.
@@ -101,9 +102,9 @@ main(int argc, char* argv[]) {
    }

    // 2. Register the adhoc storage
    if(ADM_register_adhoc_storage(
               server, adhoc_name, ADM_ADHOC_STORAGE_DATACLAY, adhoc_ctx,
               adhoc_resources, &adhoc_storage) != ADM_SUCCESS) {
    if(ADM_register_adhoc_storage(server, adhoc_name, ADM_ADHOC_STORAGE_GEKKOFS,
                                  adhoc_ctx, adhoc_resources,
                                  &adhoc_storage) != ADM_SUCCESS) {
        fprintf(stderr, "ADM_register_adhoc_storage() failed: %s\n",
                ADM_strerror(ret));
        goto cleanup;
@@ -124,16 +125,17 @@ main(int argc, char* argv[]) {
    }

    // We can now request the deployment to the server
    if((ret = ADM_deploy_adhoc_storage(server, adhoc_storage)) != ADM_SUCCESS) {
    if((ret = ADM_deploy_adhoc_storage(server, adhoc_storage,
                                       &adhoc_storage_path)) != ADM_SUCCESS) {
        fprintf(stderr, "ADM_deploy_adhoc_storage() failed: %s\n",
                ADM_strerror(ret));
        goto cleanup;
    }

    // We can noe request the tear down of the adhoc storage
    if((ret = ADM_tear_down_adhoc_storage(server, adhoc_storage)) !=
    if((ret = ADM_terminate_adhoc_storage(server, adhoc_storage)) !=
       ADM_SUCCESS) {
        fprintf(stderr, "ADM_tear_down_adhoc_storage() failed: %s\n",
        fprintf(stderr, "ADM_terminate_adhoc_storage() failed: %s\n",
                ADM_strerror(ret));
        goto cleanup;
    }
@@ -152,6 +154,7 @@ main(int argc, char* argv[]) {


cleanup:
    free(adhoc_storage_path);
    ADM_server_destroy(server);
    ADM_adhoc_context_destroy(new_adhoc_ctx);
    ADM_adhoc_context_destroy(adhoc_ctx);
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ list(APPEND c_examples_with_controller
  ADM_register_job ADM_update_job ADM_remove_job
  # adhoc storage
  ADM_register_adhoc_storage ADM_update_adhoc_storage ADM_remove_adhoc_storage
  ADM_deploy_adhoc_storage ADM_tear_down_adhoc_storage
  ADM_deploy_adhoc_storage ADM_terminate_adhoc_storage
  # transfers
  ADM_transfer_datasets ADM_get_transfer_priority ADM_set_transfer_priority
  ADM_cancel_transfer ADM_get_pending_transfers
Loading