[ungleich-tools] create script for VM ID
This commit is contained in:
parent
9cdcacaeac
commit
abc7b5d790
1 changed files with 19 additions and 0 deletions
19
k8s/k8s-opennebul-get-vmip.sh
Executable file
19
k8s/k8s-opennebul-get-vmip.sh
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
# get VM_ID via IPv6 address
|
||||
|
||||
TARGET="${1:-}"
|
||||
|
||||
if [ -z "$TARGET" ]; then
|
||||
echo "Usage: $0 <IPv6-address only>" >&2
|
||||
echo "Example: $0 2a0a:e5c0:2:2:0:c8ff:fe68:bee8" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
POD=$(kubectl -n ungleich get pods \
|
||||
-l app.kubernetes.io/component=opennebula --output=jsonpath={.items..metadata.name})
|
||||
|
||||
IDS=$(kubectl exec -ti $POD -n ungleich -c oned -- /bin/bash -c "onevm list --xml | xmllint --xpath '//VM[TEMPLATE/NIC/IP6_GLOBAL=\"$TARGET\"]/ID/text()' -")
|
||||
|
||||
printf 'VM ID: %s\n' "$IDS"
|
||||
|
||||
# kubectl -n ungleich exec -ti $POD -c oned -- /bin/bash
|
||||
Loading…
Add table
Add a link
Reference in a new issue