summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2012-09-11 11:15:54 -0400
committerSimo Sorce <simo@redhat.com>2012-09-11 11:15:54 -0400
commitfe666302366c0af4da843b04c2f8b62b29c2129a (patch)
tree4661c164655795e1549294c5e42b073ecc396746
parent66830832af6b4d5db3c9adaa0239b72e6e4af9f4 (diff)
downloadauto-win-vm-ad-fe666302366c0af4da843b04c2f8b62b29c2129a.tar.gz
auto-win-vm-ad-fe666302366c0af4da843b04c2f8b62b29c2129a.tar.xz
auto-win-vm-ad-fe666302366c0af4da843b04c2f8b62b29c2129a.zip
Get all IP infor from /etc/hostsmy-master
-rwxr-xr-xmake-ad-vm.sh10
1 files changed, 2 insertions, 8 deletions
diff --git a/make-ad-vm.sh b/make-ad-vm.sh
index 015b192..921d3b0 100755
--- a/make-ad-vm.sh
+++ b/make-ad-vm.sh
@@ -51,14 +51,8 @@ fi
if [ -z "$VM_FQDN" ] ; then
# try to get the ip addr from virsh
- VM_IP=`$SUDOCMD virsh net-dumpxml default | grep "'"$VM_NAME"'"|sed "s/^.*ip='\([^']*\)'.*$/\1/"`
- if [ -z "$VM_IP" ] ; then
- echo Error: your machine $VM_NAME has no IP address in virsh net-dumpxml default
- echo Please use virsh net-edit default to specify the IP address for $VM_NAME
- echo or set VM_FQDN=full.host.domain in the environment
- exit 1
- fi
- VM_FQDN=`getent hosts $VM_IP|awk '{print $2}'`
+ VM_IP=`getent hosts $VM_NAME|awk '{print $1}'`
+ VM_FQDN=`getent hosts $VM_NAME|awk '{print $2}'`
echo using hostname $VM_FQDN for $VM_NAME with IP address $VM_IP
fi