Skip to content

Commit

Permalink
Merge pull request #202 from jacobweinstock/librvirt-storage
Browse files Browse the repository at this point in the history
Handle create/delete of storage pool for bootMode iso:

## Description

<!--- Please describe what this PR is going to change -->
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.


## Why is this needed

<!--- Link to issue you have raised -->

Fixes: #

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->


## How are existing users impacted? What migration steps/scripts do we need?

<!--- Fixes a bug, unblocks installation, removes a component of the stack etc -->
<!--- Requires a DB migration script, etc. -->


## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
jacobweinstock authored Dec 6, 2024
2 parents db84082 + 891010d commit 3ae8ee4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion capt/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion capt/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 10 additions & 0 deletions capt/tasks/Taskfile-create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
11 changes: 11 additions & 0 deletions capt/tasks/Taskfile-delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tasks:
- task: vbmc-container
- task: vbmc-generated-files
- task: vms
- task: default-storage-pool
- task: output-dir

kind-cluster:
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3ae8ee4

Please sign in to comment.