fix(tooling): added missing steps to virtd reset task
This commit is contained in:
parent
7342cf1c50
commit
75f18e2ac7
2 changed files with 15 additions and 2 deletions
|
@ -70,12 +70,13 @@ tasks:
|
||||||
vars:
|
vars:
|
||||||
VIRSH_CONNECT: '{{.VIRSH_CONNECT | default "qemu:///system"}}'
|
VIRSH_CONNECT: '{{.VIRSH_CONNECT | default "qemu:///system"}}'
|
||||||
cmds:
|
cmds:
|
||||||
- ./scripts/purge_virsh.sh
|
- ./scripts/reset_virtd.sh
|
||||||
- task: 'molecule'
|
- task: 'molecule'
|
||||||
vars:
|
vars:
|
||||||
CLI_ARGS: 'destroy'
|
CLI_ARGS: 'destroy'
|
||||||
- sudo systemctl restart nftables.service
|
- sudo systemctl restart nftables.service
|
||||||
- sudo systemctl restart libvirtd.service
|
- sudo systemctl restart libvirtd.service # reset libvirtd related nft rules
|
||||||
|
- sudo systemctl restart docker.service # reset docker related nft rules
|
||||||
|
|
||||||
ansible:new:role:*:
|
ansible:new:role:*:
|
||||||
desc: create a new role for the specified collection
|
desc: create a new role for the specified collection
|
||||||
|
|
12
scripts/reset_virtd.sh
Normal file
12
scripts/reset_virtd.sh
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
VIRSH_CONNECT="${VIRSH_CONNECT:=qemu:///system}"
|
||||||
|
VIRSH_VOL_POOL="${VIRSH_VOL_POOL:=default}"
|
||||||
|
|
||||||
|
for domain in $(virsh -c "${VIRSH_CONNECT}" list --name --all); do
|
||||||
|
virsh -c "${VIRSH_CONNECT}" destroy "${domain}" || true
|
||||||
|
virsh -c "${VIRSH_CONNECT}" undefine "${domain}" || true
|
||||||
|
done
|
||||||
|
|
||||||
|
for volume in $(virsh -c "${VIRSH_CONNECT}" vol-list --pool "${VIRSH_VOL_POOL}" | tail -n +3 | sed -E 's/^\s*([^\s]+)\s+.*$/\1/'); do
|
||||||
|
virsh -c "${VIRSH_CONNECT}" vol-delete --pool "${VIRSH_VOL_POOL}" "${volume}" || true
|
||||||
|
done
|
Loading…
Add table
Reference in a new issue