2 Replies Latest reply on Oct 30, 2008 10:34 AM by Alessandro Iacopetti

    Problem with updating VM_VIRTUAL_MACHINE and VM_HOST

      The servers registered in BL are using the FQDN as the server name, however in VMware the VMname is using the short (NETBIOS) name. Because of this Bladelogic is not updating the VM_VIRTUAL_MACHINE and VM_HOST properties. I tested renaming the VM in virtual center to use the FQDN and that does cause BL to update the properties but I cannot do that for the servers in VMware because we have other scripts that run and verify the VMname and VM datastore folder are the same.

       

      Is there any way to get BL to be able to update this without using the short name as the registered name in BL.

        • 1. Re: Problem with updating VM_VIRTUAL_MACHINE and VM_HOST

          stumbled on the same problem

          this really brings down BL usefulness in a VM environment

          • 2. Re: Problem with updating VM_VIRTUAL_MACHINE and VM_HOST

            written a workaround:

            scanning all VMs hosted on an ESX and checking if the VM IP belongs to one of the available servers and updating the VM_xxx properties accordingly

             

            type 2 script

            call setting target=list of esx servers to look onto

             

            --- code ---

            blcli_setoption authType SRP

            blcli_setoption appserver_host XXXXXX

            blcli_setoption appserver_port 9829

            blcli_setoption userName BLAdmin

            blcli_setoption password XXXXX

            blcli_setoption roleName BLAdmins

             

            blcli_connect

             

            #

            1. first we put all our servers name in an array by ip as index

            #

            echo Building server list

            typeset -A SERVERARRAY

            blcli_execute Server listAllServers >NUL

            blcli_storeenv SERVER_LIST

            for SERVER in $SERVER_LIST

            do

            blcli_execute Server printPropertyValue $SERVER IP_ADDRESS >NUL

            blcli_storeenv IP

             

            SERVERARRAY[$IP]=$SERVER

            done

             

            1. then we scan all ESXs from command line arguments

            #

            echo Processing ESX servers

            for ESX in $*

            do

            if

            then

            echo Processing ESX $ESX

            cd //$ESX

            #

             

            1. get vm list

            #

            VMLIST=`nexec -e vmware-cmd -l`

             

            #

             

            1. use newline as list separator because vm path can contain spaces

            #

            IFS="

            "

            for VM in $VMLIST

            do

            #

             

            1. for each vm get ip address from vmware tools

            #

            IP=`nexec -e vmware-cmd "$VM" getguestinfo ip | cut -d' ' -f 3`

             

            DISPLAYNAME=`grep -i displayname "$VM" | cut -d' ' -f 3 | cut -d \" -f 2`

             

            #

             

            1. get the server associated with that ip from previously scanned list

            #

            SERVER=$SERVERARRAY[$IP]

             

            if

            then

            echo Server IP $IP not found in Bladelogic

            else

            #

             

            1. set server properties

            #

            blcli_execute Server setPropertyValueByName $SERVER VM_VIRTUAL_MACHINE True

            blcli_execute Server setPropertyValueByName $SERVER VM_HOST $ESX

            fi

            done

            unset IFS

            else

            echo ESX Host $ESX not available

            fi

            done

            blcli_disconnect

            --- code ---