Hi Folks:
I am stuck and need a bit of help. I am trying to install a guest on my XCP server using the following script. Everything works well except at the end when the network address (VM_HTTP=http://10.45.2.1/tcc/os/CentOS-5.5-x86_64) is not found. I verified that the address works on the XCP server. What is going on? Why can’t it see the network address.
Here is the script.
#!/bin/bash
#
# Make a CentOS 5.5 (64 bit) VM.
#
VM_OS='CentOS 5.5 (64-bit)'
VM_NAME='vm007'
VM_HTTP='http://10.45.2.1/tcc/os/CentOS-5.5-x86_64/'
#VM_HTTP='http://mirror.clarkson.edu/centos/5.5/os/x86_64/'
VM_RAM='2048MiB'
VM_CPUS='2'
XCP_SERVER='10.45.2.101'
XCP_LOGIN='root'
XCP_PASSWD='test'
XCP_ID="-s $XCP_SERVER -u $XCP_LOGIN -pw $XCP_PASSWD"
# Get the VM OS template.
echo 'Get the VM OS template ...'
VM_OS_UUID=$(xe template-list $XCP_ID | grep -B 1 "$VM_OS" | head -1 | awk '{print $5;}')
echo " VM Template : $VM_OS"
echo " VM OS UUID : $VM_OS_UUID"
# Get the network interfaces.
echo 'Get the network interfaces ...'
VM_XENBR0_UUID=$(xe network-list bridge=xenbr0 params=uuid --minimal $XCP_ID)
VM_XENBR1_UUID=$(xe network-list bridge=xenbr1 params=uuid --minimal $XCP_ID)
echo " VM xenbr0 UUID : $VM_XENBR0_UUID"
echo " VM xenbr1 UUID : $VM_XENBR0_UUID"
# Create the VM
echo 'Create the VM ...'
VM_UUID=$(xe vm-install template="$VM_OS_UUID" new-name-label="$VM_NAME" $XCP_ID)
echo " VM UUID : $VM_UUID"
# Create the VIFs
echo 'Create the VM VIFs ...'
VM_VIF0_UUID=$(xe vif-create vm-uuid=$VM_UUID network-uuid=$VM_XENBR0_UUID mac=random device=0 --minimal $XCP_ID)
VM_VIF1_UUID=$(xe vif-create vm-uuid=$VM_UUID network-uuid=$VM_XENBR1_UUID mac=random device=1 --minimal $XCP_ID)
echo " VM VIF0 UUID : $VM_VIF0_UUID"
echo " VM VIF1 UUID : $VM_VIF1_UUID"
# Set the number vpcus
echo 'Define the number of VCPUs ...'
xe vm-param-set uuid=$VM_UUID VCPUs-max=$VM_CPUS $XCP_ID
xe vm-param-set uuid=$VM_UUID VCPUs-at-startup=$VM_CPUS $XCP_ID
# Set the RAM
echo 'Define the RAM ...'
xe vm-param-set uuid=$VM_UUID memory-static-max=$VM_RAM $XCP_ID
xe vm-param-set uuid=$VM_UUID memory-dynamic-max=$VM_RAM $XCP_ID
# Configure the network installation.
echo 'Configure to use network installation ...'
xe vm-param-set uuid=$VM_UUID other-config:install-repository="$VM_HTTP" $XCP_ID
# Start the VM
echo 'Start the VM ...'
xe vm-start uuid=$VM_UUID $XCP_ID
# Start the boot console
# This is from the script sent to me by Mike McClurg [mike.mcclurg@xxxxxxxxxx]
#echo "../bin/tcc-vmvnc.sh -h $XCP_SERVER -u $VM_UUID"
#../bin/tcc-vmvnc.sh -h $XCP_SERVER -u $VM_UUID
echo 'Start the boot console'
VM_VNC_DOMID=$(xe vm-list uuid=$VM_UUID params=dom-id --minimal $XCP_ID)
echo "VM VNC DOMID : $VM_VNC_DOMID"
VM_VNC_PORT=$(ssh $XCP_LOGIN@$XCP_SERVER xenstore-read /local/domain/${VM_VNC_DOMID}/serial/0/vnc-port)
echo "VM VNC PORT : $VM_VNC_PORT"
echo "vncviewer -via $XCP_LOGIN@$XCP_SERVER localhost::$VM_VNC_PORT"
vncviewer -via $XCP_LOGIN@$XCP_SERVER localhost::$VM_VNC_PORT
# Debug
#xe vm-list $XCP_ID
Any help would be greatly appreciated.
Thanks,
Joe