XenServer get VM by MAC
Using the GUI, it could be somewhat complex identifying a VM based on its MAC address. There are several solutions on the network using PowerShell, but I will demonstrate it using a simple bash script, below. Save, make executable, and run.
Enjoy
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/bash if [ -z "$1" ] then echo "Requires parameter - MAC address" exit 1 fi MAC=$1 # You might want to check MAC correctness here. Enjoy doing it. RegExp, man! # XenServer is agnostic to case for MAC addresses, so we don't care VIF_UUID=`xe vif-list MAC=$MAC | grep ^uuid | awk '{print $NF}'` VM=`xe vif-param-list uuid=$VIF_UUID | grep vm-name-label | awk '{print $NF}'` echo "MAC $MAC has VM $VM" |
Tags: bash, ethernet, Virtualization, XenServer
August 27th, 2014 at 3:17 pm
Hi,
you can try this:
xe vif-param MAC=$MAC params=all
It will produce some unneeded data, but still you can find it useful. Or if you don’t need the whole package, you can play with the params option:
xe vif-param MAC=$MAC params=uuid,vm-name-label
Regards,
September 21st, 2014 at 12:24 am
Thanks! Noted.
January 29th, 2015 at 2:24 pm
Correction:
xe vif-list params=vm-name-label,MAC MAC=96:f4:60:b2:f7:f7
XenServer release 6.2.0-70446c (xenenterprise)
March 13th, 2015 at 1:46 am
Thanks!
Ez
June 18th, 2019 at 11:38 pm
Hey there just wanteԁ to give you a quick heads up.
The text in your post sеem to be running ᧐ff thе screen in Opera.
І’m not surе if this iѕ a format issue or sоmething to do
wіth web browser compatibility ƅut I figured I’d post to ⅼеt you know.
The design and style look great tһough! Hope yоu get the issue solved ѕoon. Many thanks
June 21st, 2019 at 6:42 am
Thanks for the heads up. I have checked it on several browsers. It is true that I need to fix something to the right of the screen (but I am a bit lazy here…), but the text seems fine on several browsers I’ve tested, following your comments. Anyhow – thanks!