-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
source "vbmc-funcs.sh" | ||
|
||
CLUSTER_NAME=${1:-testing} | ||
|
||
LIBVIRT_STORAGE_POOL="default" | ||
|
||
for i in $(sudo virsh list --all | grep $CLUSTER_NAME | awk '{print $2}'); do | ||
delete_vbmc "$i" | ||
sudo virsh destroy $i > /dev/null 2>&1 | ||
sudo virsh vol-delete $i.qcow2 --pool=$LIBVIRT_STORAGE_POOL | ||
sudo virsh undefine $i | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
delete_vbmc() { | ||
local name="$1" | ||
|
||
if vbmc show "$name" > /dev/null 2>&1; then | ||
vbmc stop "$name" > /dev/null 2>&1 | ||
vbmc delete "$name" > /dev/null 2>&1 | ||
fi | ||
} | ||
|
||
create_vbmc() { | ||
local name="$1" | ||
local port="$2" | ||
|
||
vbmc add "$name" --port "$port" --username ADMIN --password ADMIN | ||
vbmc start "$name" > /dev/null 2>&1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
CLUSTER_NAME=${1:-testing} | ||
|
||
LIBVIRT_STORAGE_POOL="default" | ||
|
||
while true; do | ||
cluster_present=$(sudo virsh list --all | grep $CLUSTER_NAME) | ||
|
||
if [[ -z "$cluster_present" ]]; then | ||
echo "Cluster '$CLUSTER_NAME' VMs not detected; exiting..." | ||
break | ||
fi | ||
|
||
for i in $(sudo virsh list --all | grep $CLUSTER_NAME | grep "shut off" | awk '{print $2}'); do | ||
echo "Cluster '$CLUSTER_NAME' node '$i' is offline; booting..." | ||
virsh start $i | ||
done | ||
|
||
sleep 5 | ||
done |