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 (merged) 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 (closed)

Edited by Alberto Miranda

Merge request reports

Loading
+1 −1
Changes for ci/check_rpcs.py: 1 added line, 1 removed line.
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
Changes for examples/c/ADM_deploy_adhoc_storage.c: 7 added lines, 4 removed lines.
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
Changes for examples/c/ADM_terminate_adhoc_storage.c: 9 added lines, 6 removed lines.
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
Changes for examples/c/CMakeLists.txt: 1 added line, 1 removed line.
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
+2 −1
Changes for examples/cxx/ADM_deploy_adhoc_storage.cpp: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -57,13 +57,14 @@ main(int argc, char* argv[]) {

    try {
        const auto adhoc_storage = scord::register_adhoc_storage(
                server, name, scord::adhoc_storage::type::dataclay,
                server, name, scord::adhoc_storage::type::gekkofs,
                adhoc_storage_ctx, adhoc_resources);

        fmt::print(stdout,
                   "ADM_register_adhoc_storage() remote procedure completed "
                   "successfully\n");

        [[maybe_unused]] const auto adhoc_storage_path =
                scord::deploy_adhoc_storage(server, adhoc_storage);

    } catch(const std::exception& e) {
Loading
Loading