This is an automated email from the ASF dual-hosted git repository.
ssulav pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone-installer.git
The following commit(s) were added to refs/heads/master by this push:
new 7cabe0e HDDS-14675. Move s3g smoke test to run from s3g host instead
of om host (#3)
7cabe0e is described below
commit 7cabe0ebb234f50e2e470ff8b323b0d1dcc59e06
Author: Soumitra Sulav <[email protected]>
AuthorDate: Fri Feb 20 23:21:03 2026 +0530
HDDS-14675. Move s3g smoke test to run from s3g host instead of om host (#3)
---
ozone_installer.py | 43 ++++++++----
playbooks/cluster.yml | 27 ++++++--
.../tasks/main.yml | 46 +------------
roles/ozone_smoke_s3g/defaults/main.yml | 17 +++++
roles/ozone_smoke_s3g/tasks/main.yml | 79 ++++++++++++++++++++++
roles/ozone_ui/tasks/main.yml | 2 +
6 files changed, 150 insertions(+), 64 deletions(-)
diff --git a/ozone_installer.py b/ozone_installer.py
index ce669a2..106e097 100755
--- a/ozone_installer.py
+++ b/ozone_installer.py
@@ -62,9 +62,8 @@ def get_logger(log_path: Optional[Path] = None) ->
logging.Logger:
pass
logger = logging.getLogger("ozone_installer")
logger.setLevel(logging.INFO)
- # Avoid duplicate handlers if re-invoked
+ dest = log_path or (LOGS_DIR / "ansible.log")
if not logger.handlers:
- dest = log_path or (LOGS_DIR / "ansible.log")
fh = logging.FileHandler(dest)
fh.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s | %(levelname)s |
%(message)s")
@@ -72,6 +71,17 @@ def get_logger(log_path: Optional[Path] = None) ->
logging.Logger:
logger.addHandler(fh)
sh = logging.StreamHandler(sys.stdout)
logger.addHandler(sh)
+ elif log_path:
+ # Replace FileHandler when a new run-specific path is requested
+ for h in list(logger.handlers):
+ if isinstance(h, logging.FileHandler):
+ logger.removeHandler(h)
+ h.close()
+ fh = logging.FileHandler(dest)
+ fh.setLevel(logging.INFO)
+ formatter = logging.Formatter("%(asctime)s | %(levelname)s |
%(message)s")
+ fh.setFormatter(formatter)
+ logger.addHandler(fh)
return logger
def parse_args(argv: List[str]) -> argparse.Namespace:
@@ -648,13 +658,18 @@ def main(argv: List[str]) -> int:
local_path = str(candidate)
# Build a human-friendly summary table of inputs before continuing
- host_list_display = (
- f"Masters: {masters_raw or ''} | Workers: {workers_raw or ''}"
- if use_master_worker
- else str(hosts_raw or "")
- )
- summary_rows: List[Tuple[str, str]] = [
- ("Hosts", host_list_display),
+ if use_master_worker:
+ m_count = len(master_hosts)
+ w_count = len(worker_hosts)
+ summary_host_rows: List[Tuple[str, str]] = [
+ ("Masters", f"{m_count} host{'s' if m_count != 1 else ''}"),
+ ("Workers", f"{w_count} host{'s' if w_count != 1 else ''}"),
+ ]
+ else:
+ h_count = len(hosts)
+ summary_host_rows = [("Hosts", f"{h_count} host{'s' if h_count != 1
else ''}")]
+
+ summary_rows = summary_host_rows + [
("Cluster mode", cluster_mode),
("Ozone version", str(ozone_version)),
("JDK major", str(jdk_major)),
@@ -665,10 +680,12 @@ def main(argv: List[str]) -> int:
]
if keyfile:
summary_rows.append(("Key file", str(keyfile)))
- summary_rows.extend([("Use sudo", str(bool(use_sudo))),
- ("Service user", str(service_user)),
- ("Service group", str(service_group)),
- ("Start after install",
str(bool(start_after_install)))])
+ summary_rows.extend([
+ ("Use sudo", str(bool(use_sudo))),
+ ("Service user", str(service_user)),
+ ("Service group", str(service_group)),
+ ("Start after install", str(bool(start_after_install))),
+ ])
if ozone_version and str(ozone_version).lower() == "local":
summary_rows.append(("Local Ozone path", str(local_path or "")))
if not _confirm_summary(summary_rows, yes_mode=yes):
diff --git a/playbooks/cluster.yml b/playbooks/cluster.yml
index b705b33..e25b2f7 100644
--- a/playbooks/cluster.yml
+++ b/playbooks/cluster.yml
@@ -65,15 +65,25 @@
tags: ["ozone_service"]
when: start_after_install | bool
-- name: "Ozone Smoke Test"
+- name: "Ozone Cluster Smoke Test"
hosts: "{{ groups['om'] | list | first }}"
gather_facts: false
roles:
- role: ozone_ui
tags: ["ozone_ui"]
- - role: ozone_smoke
- tags: ["ozone_smoke"]
+ - role: ozone_smoke_cluster
+ tags: ["ozone_smoke_cluster"]
+- name: "Ozone S3G Smoke Test"
+ hosts: "{{ (groups.get('s3g', []) | list)[0] if (groups.get('s3g', []) |
length) > 0 else 'never' }}"
+ gather_facts: false
+ roles:
+ - role: ozone_smoke_s3g
+ tags: ["ozone_smoke_s3g"]
+
+- name: "Display UI Endpoints"
+ hosts: "{{ groups['om'] | list | first }}"
+ gather_facts: false
post_tasks:
- name: "Build UI endpoints display lines"
set_fact:
@@ -97,12 +107,17 @@
)) +
['', 'S3 Gateway (HTTP):'] +
((endpoint_urls.s3g_http | length > 0) | ternary(
- endpoint_urls.s3g_http | map('regex_replace', '^', ' - ') |
list,
+ [' - ' ~ (endpoint_urls.s3g_http | first)],
[' - Not configured']
)) +
- ['', 'S3 Gateway (Admin):'] +
+ ['', 'S3 Gateway (Web Admin):'] +
((endpoint_urls.s3g_admin | length > 0) | ternary(
- endpoint_urls.s3g_admin | map('regex_replace', '^', ' - ') |
list,
+ [' - ' ~ (endpoint_urls.s3g_admin | first)],
+ [' - Not configured']
+ )) +
+ ['', 'Datanode UI:'] +
+ ((endpoint_urls.datanode | length > 0) | ternary(
+ [' - ' ~ (endpoint_urls.datanode | first)],
[' - Not configured']
)) +
[
diff --git a/roles/ozone_smoke/tasks/main.yml
b/roles/ozone_smoke_cluster/tasks/main.yml
similarity index 61%
rename from roles/ozone_smoke/tasks/main.yml
rename to roles/ozone_smoke_cluster/tasks/main.yml
index 69337b2..2f2be78 100644
--- a/roles/ozone_smoke/tasks/main.yml
+++ b/roles/ozone_smoke_cluster/tasks/main.yml
@@ -19,7 +19,6 @@
create_key_cmd: "{{ 'sh key put --type RATIS --replication ONE' if
groups.get('datanodes', []) | length < 3 else 'sh key put' }}"
vol: "demovol"
bucket: "demobuck"
- s3g_bucket: "demos3g"
key: "demokey"
ozone_bin: "{{ install_base }}/current/bin/ozone"
@@ -60,47 +59,4 @@
msg:
- "Stdout: {{ (key_info.stdout_lines | default([])) | join('\n') }}"
- "Stderr: {{ (key_info.stderr_lines | default([])) | join('\n') }}"
- run_once: true
-
-- name: "Create test bucket on S3G host (if present)"
- block:
- - name: "Install awscli on S3G host"
- package:
- name: awscli
- state: present
- become: true
-
- - name: "AWS CLI configure dummy credentials for S3G tests"
- shell: |
- set -euo pipefail
- aws configure set aws_access_key_id dummy
- aws configure set aws_secret_access_key dummy
- args:
- executable: /bin/bash
-
- - name: "AWS CLI S3G: create test bucket '{{ s3g_bucket }}'"
- shell: |
- set -o pipefail
- aws s3api create-bucket --bucket {{ s3g_bucket }} --endpoint-url
"http://{{ groups['s3g'][0] }}:9878" || true
- args:
- executable: /bin/bash
- register: aws_create_result
- changed_when: false
-
- - name: "AWS CLI S3G: list buckets"
- shell: |
- set -o pipefail
- aws s3api list-buckets --endpoint-url "http://{{ groups['s3g'][0]
}}:9878"
- args:
- executable: /bin/bash
- register: aws_list_result
- changed_when: false
-
- - name: "Show AWS CLI S3G check output"
- debug:
- msg:
- - "Create bucket output: {{ (aws_create_result.stdout | default(''))
}}"
- - "List buckets output: {{ (aws_list_result.stdout | default('')) }}"
- when:
- - groups.get('s3g', []) | length > 0
- - inventory_hostname == groups['s3g'][0]
\ No newline at end of file
+ run_once: true
\ No newline at end of file
diff --git a/roles/ozone_smoke_s3g/defaults/main.yml
b/roles/ozone_smoke_s3g/defaults/main.yml
new file mode 100644
index 0000000..1d4b836
--- /dev/null
+++ b/roles/ozone_smoke_s3g/defaults/main.yml
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT. In no event shall the ASF be liable for any
+# claim, damages or other liability.
+#
+s3g_bucket: demos3gbuck
+s3g_key: demos3gkey
diff --git a/roles/ozone_smoke_s3g/tasks/main.yml
b/roles/ozone_smoke_s3g/tasks/main.yml
new file mode 100644
index 0000000..02851e4
--- /dev/null
+++ b/roles/ozone_smoke_s3g/tasks/main.yml
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+# PURPOSE AND NONINFRINGEMENT. In no event shall the ASF be liable for any
+# claim, damages or other liability.
+#
+---
+- name: "Set S3G endpoint argument"
+ set_fact:
+ s3g_endpoint_arg: '--endpoint-url "http://{{ inventory_hostname }}:9878"'
+
+- name: "Install awscli on S3G host"
+ package:
+ name: awscli
+ state: present
+ become: true
+
+- name: "AWS CLI configure dummy credentials for S3G tests"
+ shell: |
+ set -euo pipefail
+ aws configure set aws_access_key_id dummy
+ aws configure set aws_secret_access_key dummy
+ args:
+ executable: /bin/bash
+
+- name: "AWS CLI S3G: create test bucket '{{ s3g_bucket }}'"
+ shell: |
+ set -o pipefail
+ aws s3api create-bucket --bucket {{ s3g_bucket }} {{ s3g_endpoint_arg }}
|| true
+ args:
+ executable: /bin/bash
+ register: aws_create_result
+ changed_when: false
+
+- name: "AWS CLI S3G: list buckets"
+ shell: |
+ set -o pipefail
+ aws s3api list-buckets {{ s3g_endpoint_arg }}
+ args:
+ executable: /bin/bash
+ register: aws_list_result
+ changed_when: false
+
+- name: "AWS CLI S3G: put object (key put)"
+ shell: |
+ set -euo pipefail
+ dd if=/dev/zero of=/tmp/oz_s3g_smoke.bin bs=1M count=1 status=none
+ aws s3api put-object --bucket {{ s3g_bucket }} --key {{ s3g_key }} --body
/tmp/oz_s3g_smoke.bin {{ s3g_endpoint_arg }}
+ rm -f /tmp/oz_s3g_smoke.bin
+ args:
+ executable: /bin/bash
+ register: aws_put_result
+ changed_when: false
+
+- name: "AWS CLI S3G: list objects"
+ shell: |
+ set -o pipefail
+ aws s3api list-objects-v2 --bucket {{ s3g_bucket }} {{ s3g_endpoint_arg }}
+ args:
+ executable: /bin/bash
+ register: aws_list_objects_result
+ changed_when: false
+
+- name: "Show AWS CLI S3G check output"
+ debug:
+ msg:
+ - "Create bucket output: {{ (aws_create_result.stdout | default('')) }}"
+ - "List buckets output: {{ (aws_list_result.stdout | default('')) }}"
+ - "Put object output: {{ (aws_put_result.stdout | default('')) }}"
+ - "List objects output: {{ (aws_list_objects_result.stdout |
default('')) }}"
diff --git a/roles/ozone_ui/tasks/main.yml b/roles/ozone_ui/tasks/main.yml
index 692550b..bf7167b 100644
--- a/roles/ozone_ui/tasks/main.yml
+++ b/roles/ozone_ui/tasks/main.yml
@@ -20,6 +20,7 @@
_scm_hosts_ui: "{{ groups.get('scm', []) | list }}"
_recon_hosts_ui: "{{ groups.get('recon', []) | list }}"
_s3g_hosts_ui: "{{ groups.get('s3g', []) | list }}"
+ _datanodes_ui: "{{ groups.get('datanodes', []) | list }}"
- name: "Compute service UI URLs"
set_fact:
@@ -29,6 +30,7 @@
recon: "{{ (_recon_hosts_ui | length > 0) | ternary(['http://' +
_recon_hosts_ui[0] + ':9888'], []) }}"
s3g_http: "{{ _s3g_hosts_ui |
map('regex_replace','^(.*)$','http://\\1:9878') | list }}"
s3g_admin: "{{ _s3g_hosts_ui |
map('regex_replace','^(.*)$','http://\\1:19878') | list }}"
+ datanode: "{{ (_datanodes_ui | length > 0) | ternary(['http://' +
_datanodes_ui[0] + ':9882'], []) }}"
- name: "Export UI endpoints to controller logs directory"
copy:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]