Skip to content

Instantly share code, notes, and snippets.

@kvaps
Last active March 16, 2020 18:23
Show Gist options
  • Save kvaps/92db240ef9976372c672fd46a639222f to your computer and use it in GitHub Desktop.
Save kvaps/92db240ef9976372c672fd46a639222f to your computer and use it in GitHub Desktop.
OpenNeubla script to find duplicated VMs on the hosts
#/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