-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cluster: better scripts and no downscaling
- Loading branch information
Showing
5 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
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,28 @@ | ||
#!/bin/bash | ||
|
||
warn() { | ||
echo "$*" 1>&2 | ||
} | ||
|
||
fail() { | ||
echo "$*" 1>&2 | ||
exit 1 | ||
} | ||
|
||
# attempt to name every running vm on this node | ||
for VM in $( virsh list | grep running | awk '{print $2}'); do | ||
# get VM name from config xml | ||
UUID=$(virsh dumpxml "$VM" | xmllint --xpath 'string(/domain/uuid/text())' -) | ||
[ -z "$UUID" ] && fail "$VM does not have uuid?" | ||
XML_FILE=$(grep -l "<name>$VM</name>" /var/lib/virtual/conf/*.xml) | ||
[ -f "$XML_FILE" ] || fail "$VM does not have XML file" | ||
NAME=$(cat "$XML_FILE" | xmllint --xpath '/domain/metadata/fqdn/text()' - 2>/dev/null) | ||
[ -z "$NAME" ] && fail "$VM does not have a fqdn defined in its metadata!" | ||
|
||
# check if VM is defined in corosync | ||
crm conf show | grep "${VM}_vm" > /dev/null | ||
[ $? -ne 0 ] && warn "$NAME ($VM) is not defined in corosync!" && continue | ||
|
||
# print vm name | ||
echo "$NAME ($VM)" | ||
done |
Empty file.
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