From dd11a14ede835899db20ff169e2360002dc000d0 Mon Sep 17 00:00:00 2001 From: Matt Spilchen Date: Wed, 25 Oct 2023 10:14:03 -0400 Subject: [PATCH] Sync from server repo (e1bd36a236) --- vclusterops/adapter_pool.go | 33 +++++++++++++++++++ vclusterops/cluster_op.go | 13 +++++++- vclusterops/cluster_op_engine.go | 1 + vclusterops/http_request.go | 1 + vclusterops/https_add_subcluster_op.go | 4 --- vclusterops/https_check_db_running.go | 4 --- vclusterops/https_check_node_state_op.go | 4 --- vclusterops/https_check_subcluster_op.go | 4 --- vclusterops/https_create_cluster_depot_op.go | 4 --- vclusterops/https_create_node_op.go | 4 --- vclusterops/https_create_nodes_depot_op.go | 4 --- vclusterops/https_drop_node_op.go | 4 --- vclusterops/https_drop_subcluster_op.go | 4 --- vclusterops/https_find_subcluster_op.go | 4 --- vclusterops/https_get_cluster_info_op.go | 4 --- vclusterops/https_get_nodes_info_op.go | 4 --- vclusterops/https_get_up_nodes_op.go | 4 --- ...ckages.go => https_install_packages_op.go} | 4 --- vclusterops/https_mark_design_ksafe_op.go | 4 --- vclusterops/https_mark_nodes_ephemeral_op.go | 4 --- vclusterops/https_poll_node_state_op.go | 4 --- .../https_poll_subscription_state_op.go | 4 --- vclusterops/https_re_ip_op.go | 4 --- vclusterops/https_rebalance_cluster_op.go | 4 --- .../https_rebalance_subcluster_shards_op.go | 4 --- vclusterops/https_reload_spread_op.go | 4 --- vclusterops/https_spread_remove_node_op.go | 4 --- vclusterops/https_startup_command_op.go | 4 --- vclusterops/https_stop_db_op.go | 4 --- vclusterops/https_sync_catalog_op.go | 4 --- vclusterops/nma_bootstrap_catalog_op.go | 6 ++-- vclusterops/nma_delete_dir_op.go | 4 --- vclusterops/nma_download_config.go | 4 --- vclusterops/nma_download_file_op.go | 4 --- vclusterops/nma_get_nodes_info_op.go | 4 --- vclusterops/nma_health_op.go | 4 --- vclusterops/nma_load_remote_catalog_op.go | 4 --- vclusterops/nma_network_profile_op.go | 4 --- vclusterops/nma_prepare_directories_op.go | 4 --- vclusterops/nma_re_ip_op.go | 4 --- vclusterops/nma_read_catalog_editor_op.go | 4 --- vclusterops/nma_spread_security_op.go | 4 --- vclusterops/nma_start_node_op.go | 4 --- vclusterops/nma_upload_config.go | 4 --- vclusterops/nma_vertica_version_op.go | 4 --- 45 files changed, 49 insertions(+), 165 deletions(-) rename vclusterops/{https_install_packages.go => https_install_packages_op.go} (95%) diff --git a/vclusterops/adapter_pool.go b/vclusterops/adapter_pool.go index 37b8003..5234b77 100644 --- a/vclusterops/adapter_pool.go +++ b/vclusterops/adapter_pool.go @@ -16,8 +16,10 @@ package vclusterops import ( + "context" "fmt" "sync" + "time" "github.com/vertica/vcluster/vclusterops/vlog" ) @@ -80,6 +82,10 @@ func (pool *AdapterPool) sendRequest(clusterHTTPRequest *ClusterHTTPRequest) err // result channel to collect result from each host resultChannel := make(chan HostHTTPResult, hostCount) + // use context to check whether a step has completed + ctx, cancel := context.WithCancel(context.Background()) + go progressCheck(ctx, clusterHTTPRequest.Name, pool.log) + for i := 0; i < len(adapterToRequestCollection); i++ { ar := adapterToRequestCollection[i] // send request to the hosts @@ -100,5 +106,32 @@ func (pool *AdapterPool) sendRequest(clusterHTTPRequest *ClusterHTTPRequest) err } close(resultChannel) + // cancel the progress check context when the result channel is closed + cancel() + return nil } + +// progressCheck checks whether a step (operation) has been completed. +// Elapsed time of the step in seconds will be displayed. +func progressCheck(ctx context.Context, name string, log vlog.Printer) { + const progressCheckInterval = 5 + startTime := time.Now() + + ticker := time.NewTicker(progressCheckInterval * time.Second) + defer ticker.Stop() + + for { + select { + case <-ctx.Done(): + // context is canceled + // - when the requests to each host are completed, or + // - when the timeout is reached + return + case tickTime := <-ticker.C: + elapsedTime := tickTime.Sub(startTime) + log.PrintInfo("[%s] is still running. %.f seconds spent at this step.", + name, elapsedTime.Seconds()) + } + } +} diff --git a/vclusterops/cluster_op.go b/vclusterops/cluster_op.go index a22c8e3..bb12728 100644 --- a/vclusterops/cluster_op.go +++ b/vclusterops/cluster_op.go @@ -178,6 +178,7 @@ type ClusterOp interface { logPrepare() logExecute() logFinalize() + setupBasicInfo() loadCertsIfNeeded(certs *HTTPSCerts, findCertsInOptions bool) error isSkipExecute() bool } @@ -218,11 +219,20 @@ func (op *OpBase) parseAndCheckMapResponse(host, responseContent string) (OpResp return responseObj, err } +func (op *OpBase) setClusterHTTPRequestName() { + op.clusterHTTPRequest.Name = op.name +} + func (op *OpBase) setVersionToSemVar() { op.clusterHTTPRequest.SemVar = SemVer{Ver: "1.0.0"} } -// TODO: implement another parse function for list response +func (op *OpBase) setupBasicInfo() { + op.clusterHTTPRequest = ClusterHTTPRequest{} + op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) + op.setClusterHTTPRequestName() + op.setVersionToSemVar() +} func (op *OpBase) logResponse(host string, result HostHTTPResult) { op.log.PrintInfo("[%s] result from host %s summary %s, details: %+v", @@ -235,6 +245,7 @@ func (op *OpBase) logPrepare() { func (op *OpBase) logExecute() { op.log.Info("Execute() called", "name", op.name) + op.log.PrintInfo("[%s] is running", op.name) } func (op *OpBase) logFinalize() { diff --git a/vclusterops/cluster_op_engine.go b/vclusterops/cluster_op_engine.go index 3c7793b..22db09d 100644 --- a/vclusterops/cluster_op_engine.go +++ b/vclusterops/cluster_op_engine.go @@ -45,6 +45,7 @@ func (opEngine *VClusterOpEngine) Run(log vlog.Printer) error { findCertsInOptions := opEngine.shouldGetCertsFromOptions() for _, op := range opEngine.instructions { + op.setupBasicInfo() op.logPrepare() err := op.prepare(&execContext) if err != nil { diff --git a/vclusterops/http_request.go b/vclusterops/http_request.go index 62dfdc1..3621107 100644 --- a/vclusterops/http_request.go +++ b/vclusterops/http_request.go @@ -52,4 +52,5 @@ type ClusterHTTPRequest struct { RequestCollection map[string]HostHTTPRequest ResultCollection map[string]HostHTTPResult SemVar SemVer + Name string } diff --git a/vclusterops/https_add_subcluster_op.go b/vclusterops/https_add_subcluster_op.go index 15bc606..decb5f9 100644 --- a/vclusterops/https_add_subcluster_op.go +++ b/vclusterops/https_add_subcluster_op.go @@ -79,10 +79,6 @@ func (op *HTTPSAddSubclusterOp) setupRequestBody(hosts []string) error { } func (op *HTTPSAddSubclusterOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_check_db_running.go b/vclusterops/https_check_db_running.go index 4ecac7c..2911a2b 100644 --- a/vclusterops/https_check_db_running.go +++ b/vclusterops/https_check_db_running.go @@ -76,10 +76,6 @@ func makeHTTPCheckRunningDBOp(log vlog.Printer, hosts []string, } func (op *HTTPCheckRunningDBOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_check_node_state_op.go b/vclusterops/https_check_node_state_op.go index abf2588..7852142 100644 --- a/vclusterops/https_check_node_state_op.go +++ b/vclusterops/https_check_node_state_op.go @@ -53,10 +53,6 @@ func makeHTTPCheckNodeStateOp(log vlog.Printer, hosts []string, } func (op *HTTPCheckNodeStateOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_check_subcluster_op.go b/vclusterops/https_check_subcluster_op.go index ccff427..35b399a 100644 --- a/vclusterops/https_check_subcluster_op.go +++ b/vclusterops/https_check_subcluster_op.go @@ -52,10 +52,6 @@ func makeHTTPSCheckSubclusterOp(log vlog.Printer, useHTTPPassword bool, userName } func (op *HTTPSCheckSubclusterOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_create_cluster_depot_op.go b/vclusterops/https_create_cluster_depot_op.go index 71f84ce..39034db 100644 --- a/vclusterops/https_create_cluster_depot_op.go +++ b/vclusterops/https_create_cluster_depot_op.go @@ -63,10 +63,6 @@ func makeHTTPSCreateClusterDepotOp(log vlog.Printer, vdb *VCoordinationDatabase, } func (op *HTTPSCreateDepotOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_create_node_op.go b/vclusterops/https_create_node_op.go index 7388990..d6ef03a 100644 --- a/vclusterops/https_create_node_op.go +++ b/vclusterops/https_create_node_op.go @@ -51,10 +51,6 @@ func makeHTTPSCreateNodeOp(log vlog.Printer, newNodeHosts []string, bootstrapHos } func (op *HTTPSCreateNodeOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_create_nodes_depot_op.go b/vclusterops/https_create_nodes_depot_op.go index 21caa7c..3760927 100644 --- a/vclusterops/https_create_nodes_depot_op.go +++ b/vclusterops/https_create_nodes_depot_op.go @@ -53,10 +53,6 @@ func makeHTTPSCreateNodesDepotOp(log vlog.Printer, vdb *VCoordinationDatabase, n } func (op *HTTPSCreateNodesDepotOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_drop_node_op.go b/vclusterops/https_drop_node_op.go index d60817b..2854447 100644 --- a/vclusterops/https_drop_node_op.go +++ b/vclusterops/https_drop_node_op.go @@ -57,10 +57,6 @@ func makeHTTPSDropNodeOp(log vlog.Printer, vnode string, } func (op *HTTPSDropNodeOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_drop_subcluster_op.go b/vclusterops/https_drop_subcluster_op.go index 85b55c5..d2cd9f7 100644 --- a/vclusterops/https_drop_subcluster_op.go +++ b/vclusterops/https_drop_subcluster_op.go @@ -50,10 +50,6 @@ func makeHTTPSDropSubclusterOp(hosts []string, scName string, } func (op *httpsDropSubclusterOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_find_subcluster_op.go b/vclusterops/https_find_subcluster_op.go index b51a342..a4b64bf 100644 --- a/vclusterops/https_find_subcluster_op.go +++ b/vclusterops/https_find_subcluster_op.go @@ -51,10 +51,6 @@ func makeHTTPSFindSubclusterOp(log vlog.Printer, hosts []string, useHTTPPassword } func (op *HTTPSFindSubclusterOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_get_cluster_info_op.go b/vclusterops/https_get_cluster_info_op.go index fbd657e..28b95cf 100644 --- a/vclusterops/https_get_cluster_info_op.go +++ b/vclusterops/https_get_cluster_info_op.go @@ -54,10 +54,6 @@ func makeHTTPSGetClusterInfoOp(log vlog.Printer, dbName string, hosts []string, } func (op *httpsGetClusterInfoOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_get_nodes_info_op.go b/vclusterops/https_get_nodes_info_op.go index 2cd4a48..e678e7a 100644 --- a/vclusterops/https_get_nodes_info_op.go +++ b/vclusterops/https_get_nodes_info_op.go @@ -48,10 +48,6 @@ func makeHTTPSGetNodesInfoOp(log vlog.Printer, dbName string, hosts []string, } func (op *httpsGetNodesInfoOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_get_up_nodes_op.go b/vclusterops/https_get_up_nodes_op.go index f9449c7..2b68e2e 100644 --- a/vclusterops/https_get_up_nodes_op.go +++ b/vclusterops/https_get_up_nodes_op.go @@ -52,10 +52,6 @@ func makeHTTPSGetUpNodesOp(log vlog.Printer, dbName string, hosts []string, } func (op *HTTPSGetUpNodesOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_install_packages.go b/vclusterops/https_install_packages_op.go similarity index 95% rename from vclusterops/https_install_packages.go rename to vclusterops/https_install_packages_op.go index 246e2d2..5e085dd 100644 --- a/vclusterops/https_install_packages.go +++ b/vclusterops/https_install_packages_op.go @@ -47,10 +47,6 @@ func makeHTTPSInstallPackagesOp(log vlog.Printer, hosts []string, useHTTPPasswor } func (op *HTTPSInstallPackagesOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_mark_design_ksafe_op.go b/vclusterops/https_mark_design_ksafe_op.go index a9f1c33..b744993 100644 --- a/vclusterops/https_mark_design_ksafe_op.go +++ b/vclusterops/https_mark_design_ksafe_op.go @@ -64,10 +64,6 @@ func makeHTTPSMarkDesignKSafeOp( } func (op *HTTPSMarkDesignKSafeOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - // in practice, initiator only for _, host := range hosts { httpRequest := HostHTTPRequest{} diff --git a/vclusterops/https_mark_nodes_ephemeral_op.go b/vclusterops/https_mark_nodes_ephemeral_op.go index a03c1bd..3b69e06 100644 --- a/vclusterops/https_mark_nodes_ephemeral_op.go +++ b/vclusterops/https_mark_nodes_ephemeral_op.go @@ -49,10 +49,6 @@ func makeHTTPSMarkEphemeralNodeOp(log vlog.Printer, nodeName string, } func (op *HTTPSMarkEphemeralNodeOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_poll_node_state_op.go b/vclusterops/https_poll_node_state_op.go index 7f0fdf9..53c86d7 100644 --- a/vclusterops/https_poll_node_state_op.go +++ b/vclusterops/https_poll_node_state_op.go @@ -112,10 +112,6 @@ func (op *HTTPSPollNodeStateOp) getPollingTimeout() int { } func (op *HTTPSPollNodeStateOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_poll_subscription_state_op.go b/vclusterops/https_poll_subscription_state_op.go index db7ed06..e59c34b 100644 --- a/vclusterops/https_poll_subscription_state_op.go +++ b/vclusterops/https_poll_subscription_state_op.go @@ -52,10 +52,6 @@ func (op *httpsPollSubscriptionStateOp) getPollingTimeout() int { } func (op *httpsPollSubscriptionStateOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_re_ip_op.go b/vclusterops/https_re_ip_op.go index 304f321..47e2fdd 100644 --- a/vclusterops/https_re_ip_op.go +++ b/vclusterops/https_re_ip_op.go @@ -53,10 +53,6 @@ func makeHTTPSReIPOp(nodeNamesList, hostToReIP []string, } func (op *httpsReIPOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for i, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PutMethod diff --git a/vclusterops/https_rebalance_cluster_op.go b/vclusterops/https_rebalance_cluster_op.go index 6e35d16..eb7e8a7 100644 --- a/vclusterops/https_rebalance_cluster_op.go +++ b/vclusterops/https_rebalance_cluster_op.go @@ -50,10 +50,6 @@ func makeHTTPSRebalanceClusterOp(log vlog.Printer, initiatorHost []string, useHT } func (op *HTTPSRebalanceClusterOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_rebalance_subcluster_shards_op.go b/vclusterops/https_rebalance_subcluster_shards_op.go index 11fb204..e53b679 100644 --- a/vclusterops/https_rebalance_subcluster_shards_op.go +++ b/vclusterops/https_rebalance_subcluster_shards_op.go @@ -53,10 +53,6 @@ func makeHTTPSRebalanceSubclusterShardsOp(log vlog.Printer, bootstrapHost []stri } func (op *HTTPSRebalanceSubclusterShardsOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_reload_spread_op.go b/vclusterops/https_reload_spread_op.go index 60685f6..b036317 100644 --- a/vclusterops/https_reload_spread_op.go +++ b/vclusterops/https_reload_spread_op.go @@ -52,10 +52,6 @@ func makeHTTPSReloadSpreadOp(log vlog.Printer, useHTTPPassword bool, } func (op *HTTPSReloadSpreadOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_spread_remove_node_op.go b/vclusterops/https_spread_remove_node_op.go index 6ba31ce..1193122 100644 --- a/vclusterops/https_spread_remove_node_op.go +++ b/vclusterops/https_spread_remove_node_op.go @@ -53,10 +53,6 @@ func makeHTTPSSpreadRemoveNodeOp(log vlog.Printer, hostsToRemove []string, initi } func (op *HTTPSSpreadRemoveNodeOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_startup_command_op.go b/vclusterops/https_startup_command_op.go index 8b5b96d..0598955 100644 --- a/vclusterops/https_startup_command_op.go +++ b/vclusterops/https_startup_command_op.go @@ -51,10 +51,6 @@ func makeHTTPSStartUpCommandOp(log vlog.Printer, useHTTPPassword bool, userName } func (op *httpsStartUpCommandOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/https_stop_db_op.go b/vclusterops/https_stop_db_op.go index 81baaa7..7735af2 100644 --- a/vclusterops/https_stop_db_op.go +++ b/vclusterops/https_stop_db_op.go @@ -56,10 +56,6 @@ func makeHTTPSStopDBOp(log vlog.Printer, useHTTPPassword bool, userName string, } func (op *HTTPSStopDBOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/https_sync_catalog_op.go b/vclusterops/https_sync_catalog_op.go index 43f4921..d2c31d0 100644 --- a/vclusterops/https_sync_catalog_op.go +++ b/vclusterops/https_sync_catalog_op.go @@ -53,10 +53,6 @@ func makeHTTPSSyncCatalogOpWithoutHosts(log vlog.Printer, useHTTPPassword bool, } func (op *HTTPSSyncCatalogOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_bootstrap_catalog_op.go b/vclusterops/nma_bootstrap_catalog_op.go index c11b6c4..8db29ab 100644 --- a/vclusterops/nma_bootstrap_catalog_op.go +++ b/vclusterops/nma_bootstrap_catalog_op.go @@ -47,6 +47,7 @@ type bootstrapCatalogRequestData struct { Ipv6 bool `json:"ipv6"` NumShards int `json:"num_shards"` CommunalStorageURL string `json:"communal_storage"` + SuperuserName string `json:"superuser_name"` SensitiveFields } @@ -104,6 +105,7 @@ func (op *NMABootstrapCatalogOp) setupRequestBody(vdb *VCoordinationDatabase, op bootstrapData.SpreadLogging = *options.SpreadLogging bootstrapData.SpreadLoggingLevel = *options.SpreadLoggingLevel bootstrapData.Ipv6 = options.Ipv6.ToBool() + bootstrapData.SuperuserName = *options.UserName bootstrapData.DBPassword = *options.Password // Eon params @@ -146,10 +148,6 @@ func (op *NMABootstrapCatalogOp) updateRequestBody(execContext *OpEngineExecCont } func (op *NMABootstrapCatalogOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - // usually, only one node need bootstrap catalog for _, host := range hosts { httpRequest := HostHTTPRequest{} diff --git a/vclusterops/nma_delete_dir_op.go b/vclusterops/nma_delete_dir_op.go index bb8a1ae..f99b4d4 100644 --- a/vclusterops/nma_delete_dir_op.go +++ b/vclusterops/nma_delete_dir_op.go @@ -78,10 +78,6 @@ func (op *NMADeleteDirectoriesOp) buildRequestBody( } func (op *NMADeleteDirectoriesOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_download_config.go b/vclusterops/nma_download_config.go index 04413e8..386e578 100644 --- a/vclusterops/nma_download_config.go +++ b/vclusterops/nma_download_config.go @@ -51,10 +51,6 @@ func makeNMADownloadConfigOp( } func (op *NMADownloadConfigOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/nma_download_file_op.go b/vclusterops/nma_download_file_op.go index badedf0..7b6d093 100644 --- a/vclusterops/nma_download_file_op.go +++ b/vclusterops/nma_download_file_op.go @@ -128,10 +128,6 @@ func makeNMADownloadFileOpForRevive(log vlog.Printer, newNodes []string, sourceF } func (op *NMADownloadFileOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_get_nodes_info_op.go b/vclusterops/nma_get_nodes_info_op.go index 80e8b67..fe5dded 100644 --- a/vclusterops/nma_get_nodes_info_op.go +++ b/vclusterops/nma_get_nodes_info_op.go @@ -45,10 +45,6 @@ func makeNMAGetNodesInfoOp(log vlog.Printer, hosts []string, } func (op *nmaGetNodesInfoOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/nma_health_op.go b/vclusterops/nma_health_op.go index 824f3b8..0e7c4cd 100644 --- a/vclusterops/nma_health_op.go +++ b/vclusterops/nma_health_op.go @@ -35,10 +35,6 @@ func makeNMAHealthOp(log vlog.Printer, hosts []string) NMAHealthOp { // setupClusterHTTPRequest works as the module setup in Admintools func (op *NMAHealthOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/nma_load_remote_catalog_op.go b/vclusterops/nma_load_remote_catalog_op.go index a16d5ab..7875528 100644 --- a/vclusterops/nma_load_remote_catalog_op.go +++ b/vclusterops/nma_load_remote_catalog_op.go @@ -111,10 +111,6 @@ func (op *nmaLoadRemoteCatalogOp) setupRequestBody(execContext *OpEngineExecCont } func (op *nmaLoadRemoteCatalogOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_network_profile_op.go b/vclusterops/nma_network_profile_op.go index 143122e..b0219d2 100644 --- a/vclusterops/nma_network_profile_op.go +++ b/vclusterops/nma_network_profile_op.go @@ -36,10 +36,6 @@ func makeNMANetworkProfileOp(log vlog.Printer, hosts []string) NMANetworkProfile } func (op *NMANetworkProfileOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/nma_prepare_directories_op.go b/vclusterops/nma_prepare_directories_op.go index c2a7aec..012cc4c 100644 --- a/vclusterops/nma_prepare_directories_op.go +++ b/vclusterops/nma_prepare_directories_op.go @@ -85,10 +85,6 @@ func (op *NMAPrepareDirectoriesOp) setupRequestBody(hostNodeMap vHostNodeMap) er } func (op *NMAPrepareDirectoriesOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_re_ip_op.go b/vclusterops/nma_re_ip_op.go index f4884dc..bcd0bc1 100644 --- a/vclusterops/nma_re_ip_op.go +++ b/vclusterops/nma_re_ip_op.go @@ -75,10 +75,6 @@ func (op *NMAReIPOp) updateRequestBody(_ *OpEngineExecContext) error { } func (op *NMAReIPOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PutMethod diff --git a/vclusterops/nma_read_catalog_editor_op.go b/vclusterops/nma_read_catalog_editor_op.go index 65575e4..8561b36 100644 --- a/vclusterops/nma_read_catalog_editor_op.go +++ b/vclusterops/nma_read_catalog_editor_op.go @@ -52,10 +52,6 @@ func makeNMAReadCatalogEditorOp(log vlog.Printer, vdb *VCoordinationDatabase) (N } func (op *NMAReadCatalogEditorOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod diff --git a/vclusterops/nma_spread_security_op.go b/vclusterops/nma_spread_security_op.go index 7e96da4..7cb7c67 100644 --- a/vclusterops/nma_spread_security_op.go +++ b/vclusterops/nma_spread_security_op.go @@ -89,10 +89,6 @@ func (op *nmaSpreadSecurityOp) setupRequestBody() (map[string]string, error) { } func (op *nmaSpreadSecurityOp) setupClusterHTTPRequest(hostRequestBodyMap map[string]string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest, len(hostRequestBodyMap)) - op.setVersionToSemVar() - for host, requestBody := range hostRequestBodyMap { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_start_node_op.go b/vclusterops/nma_start_node_op.go index 42c8548..c9adde7 100644 --- a/vclusterops/nma_start_node_op.go +++ b/vclusterops/nma_start_node_op.go @@ -98,10 +98,6 @@ func (op *nmaStartNodeOp) updateHostRequestBodyMapFromNodeStartCommand(host stri } func (op *nmaStartNodeOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_upload_config.go b/vclusterops/nma_upload_config.go index 2d93075..34bf4c0 100644 --- a/vclusterops/nma_upload_config.go +++ b/vclusterops/nma_upload_config.go @@ -91,10 +91,6 @@ func (op *NMAUploadConfigOp) setupRequestBody(hosts []string) error { } func (op *NMAUploadConfigOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = PostMethod diff --git a/vclusterops/nma_vertica_version_op.go b/vclusterops/nma_vertica_version_op.go index a2a8518..2fbedde 100644 --- a/vclusterops/nma_vertica_version_op.go +++ b/vclusterops/nma_vertica_version_op.go @@ -42,10 +42,6 @@ func makeNMAVerticaVersionOp(log vlog.Printer, hosts []string, sameVersion bool) } func (op *NMAVerticaVersionOp) setupClusterHTTPRequest(hosts []string) error { - op.clusterHTTPRequest = ClusterHTTPRequest{} - op.clusterHTTPRequest.RequestCollection = make(map[string]HostHTTPRequest) - op.setVersionToSemVar() - for _, host := range hosts { httpRequest := HostHTTPRequest{} httpRequest.Method = GetMethod