From 839bc1fe02fee469bae9f87cfd38d556d8a7f747 Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Thu, 5 Dec 2024 18:21:30 -0700 Subject: [PATCH 1/2] Handle create/delete of storage pool for bootMode iso: In the bootMode: iso, the redfish emulator needs a storage location named "default" to exist for media mounting. So we create it. To clean it up, we need to delete all the ISO files that get put into there. Signed-off-by: Jacob Weinstock --- capt/Taskfile.yaml | 2 +- capt/config.yaml | 2 +- capt/tasks/Taskfile-create.yaml | 10 ++++++++++ capt/tasks/Taskfile-delete.yaml | 11 +++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/capt/Taskfile.yaml b/capt/Taskfile.yaml index fd6cbbf8..254019ff 100644 --- a/capt/Taskfile.yaml +++ b/capt/Taskfile.yaml @@ -19,7 +19,7 @@ tasks: create-playground: silent: true summary: | - Create the CAPT playground. Use the .playground file to define things like cluster size and Kubernetes version. + Create the CAPT playground. Use the config.yaml file to define things like cluster size and Kubernetes version. cmds: - task: system-deps-warnings - task: validate-binaries diff --git a/capt/config.yaml b/capt/config.yaml index f8f131be..27145888 100644 --- a/capt/config.yaml +++ b/capt/config.yaml @@ -9,7 +9,7 @@ counts: versions: capt: v0.6.1 chart: 0.6.1 - kube: v1.28.9 + kube: v1.29.4 os: 20.04 kubevip: 0.8.7 capt: diff --git a/capt/tasks/Taskfile-create.yaml b/capt/tasks/Taskfile-create.yaml index 032be518..53efbaf6 100644 --- a/capt/tasks/Taskfile-create.yaml +++ b/capt/tasks/Taskfile-create.yaml @@ -21,6 +21,7 @@ tasks: - task: bmc-secret - task: vms - task: vbmc:start-vbmcs + - task: default-storage-pool - task: apply-bmc-secret - task: apply-bmc-machines - task: apply-hardware @@ -240,3 +241,12 @@ tasks: - echo "Workload cluster kubeconfig saved to {{.OUTPUT_DIR}}/{{.CLUSTER_NAME}}.kubeconfig." status: - echo ; [ -f {{.OUTPUT_DIR}}/{{.CLUSTER_NAME}}.kubeconfig ] + + default-storage-pool: + summary: | + Create the default storage pool for the redfish emulator to work properly. + cmds: + - virsh --connect qemu:///system pool-define-as --name default --type dir --target /tmp/iso + - virsh --connect qemu:///system pool-start --build default + status: + - virsh --connect qemu:///system pool-info default \ No newline at end of file diff --git a/capt/tasks/Taskfile-delete.yaml b/capt/tasks/Taskfile-delete.yaml index f6d22dea..4699003d 100644 --- a/capt/tasks/Taskfile-delete.yaml +++ b/capt/tasks/Taskfile-delete.yaml @@ -9,6 +9,7 @@ tasks: - task: vbmc-container - task: vbmc-generated-files - task: vms + - task: default-storage-pool - task: output-dir kind-cluster: @@ -38,6 +39,16 @@ tasks: status: - got=$(virsh --connect qemu:///system list --all --name | grep -ce "{{.VM_BASE_NAME}}*" || :); [[ "$got" == "0" ]] + default-storage-pool: + summary: | + Delete the default storage pool. + cmds: + - for vol in $(virsh --connect qemu:///system -q vol-list default | xargs | cut -d " " -f1,3,5,7,9); do virsh --connect qemu:///system vol-delete --pool default $vol; done + - virsh --connect qemu:///system pool-destroy default || true + - virsh --connect qemu:///system pool-undefine default + status: + - (! virsh --connect qemu:///system pool-info default ) + vbmc-container: summary: | Delete the Virtual BMC container. From 891010d5a63aa5db60e5c3cb3f3dad964db37d4f Mon Sep 17 00:00:00 2001 From: Jacob Weinstock Date: Thu, 5 Dec 2024 18:36:17 -0700 Subject: [PATCH 2/2] Fix linting issue Signed-off-by: Jacob Weinstock --- capt/tasks/Taskfile-create.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/capt/tasks/Taskfile-create.yaml b/capt/tasks/Taskfile-create.yaml index 53efbaf6..ef954f5b 100644 --- a/capt/tasks/Taskfile-create.yaml +++ b/capt/tasks/Taskfile-create.yaml @@ -249,4 +249,4 @@ tasks: - virsh --connect qemu:///system pool-define-as --name default --type dir --target /tmp/iso - virsh --connect qemu:///system pool-start --build default status: - - virsh --connect qemu:///system pool-info default \ No newline at end of file + - virsh --connect qemu:///system pool-info default