Last active
March 16, 2020 18:23
-
-
Save kvaps/92db240ef9976372c672fd46a639222f to your computer and use it in GitHub Desktop.
OpenNeubla script to find duplicated VMs on the hosts
This file contains hidden or 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
#/bin/sh | |
onehost list -x | xmlstarlet sel -t -v '/HOST_POOL/HOST/VMS/ID' -n | sort | uniq -c | sort | while read dup vm; do | |
if [ "$dup" != "1" ]; then | |
echo "vm $vm duplicated $dup times, on hosts:" | |
onehost list -x | xmlstarlet sel -t -v "/HOST_POOL/HOST[VMS/ID/.=${vm}]/ID" -n | |
fi | |
done | |
# # remove vm from host | |
# onedb change-body host --id "${HOSTID}" "HOST/VMS/ID[.=${VMID}]" -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment