The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,574 other followers

Archive for the ‘Power User’ Category

ESXi: on the console/ssh, when a moved VM pauses during power-on: show which VMs have messages waiting, then answer them

Posted by jpluimers on 2022/01/27

First the script that display messages for all virtual machines, vim-cmd-display-messages-for-all-VMs.sh:

#!/bin/sh
vmids=`vim-cmd vmsvc/getallvms | sed -n -E -e "s/^([[:digit:]]+)\s+((\S.+\S)?)\s+(\[\S+\])\s+(.+\.vmx)\s+(\S+)\s+(vmx-[[:digit:]]+)\s*?((\S.+)?)$/\1/p"`
for vmid in ${vmids} ; do
    powerState=`vim-cmd vmsvc/power.getstate ${vmid} | sed '1d'`
    name=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/\(vim.vm.ConfigInfo\) \{/,/files = \(vim.vm.FileInfo\) \{/ s/^ +name = "(.*)",.*?/\1/p'`
    vmPathName=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/files = \(vim.vm.FileInfo\) \{/,/tools = \(vim.vm.ToolsConfigInfo\) \{/ s/^ +vmPathName = "(.*)",.*?/\1/p'`
    echo "Messages for VM with id ${vmid} which has power state ${powerState} (name = ${name}; vmPathName = ${vmPathName})."
    vim-cmd vmsvc/message ${vmid}
done
exit 0

It is very similar to vim-cmd-reload-all-VM-vmx-configurations.sh from Source: ESXi: reloading all virtual machines from their (potentially) vmx files.

Messages I know either equal “No message” or are about “This virtual machine may have been moved or copied.

If there is no available message, then you always get the stock message No message., so this is something you can use as a check in scripts.

The only messages I know of (and the only one I could find when searching for [Wayback] “vim-cmd vmsvc/message” – Google Search) are like these (where # is a number, like 18 , 235910112 or 6233874: they are unique messageId values so you can refer to them when answering the message):

  • ESXi 4.x era (from [Wayback] Answering a virtual machine related question from the command line (1026835)):
    Virtual machine message #:
    msg.uuid.altered:This virtual machine may have been moved or copied.
    
    To configure certain management and networking features VMware ESX needs to know which.
    
    Did you move this virtual machine, or did you copy it?
    If you don't know, answer "I copied it".
    
    0. Cancel (Cancel)
    1. I _moved it (I _moved it)
    2. I _copied it (I _copied it) [default]
  • ESXi 5.x era (from [Wayback] Starting a virtual machine from the ESXi CLI pauses forever | viktorious.nl – Virtualization & Cloud Management):
    Virtual machine message #:
    msg.uuid.altered:This virtual machine may have been moved or copied.
    
    To configure certain management and networking features VMware ESX needs to know which.
    
    Did you move this virtual machine, or did you copy it?
    If you don't know, answer "I copied it".
    
    0. Cancel (Cancel)
    1. I moved it (I moved it)
    2. I copied it (I copied it) [default]
  • ESXi 5.5 era (from [Wayback] Moving a powered off VM from CLI · RR Labs):
    Virtual machine message #:
    This virtual machine might have been moved or copied. In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied. If you don't know, answer "I Copied It".
       0. Cancel (Cancel)
       1. button.uuid.movedTheVM (I Moved It)
       2. button.uuid.copiedTheVM (I Copied It) [default]
  • ESXi 6.5 (one of my own machines):
    Virtual machine message #:
    This virtual machine might have been moved or copied. In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied. If you don't know, answer "I Copied It". 
       0. button.uuid.cancel (Cancel)
       1. button.uuid.movedTheVM (I Moved It)
       2. button.uuid.copiedTheVM (I Copied It) [default]

You get the pending message for a specific machine 25 using the vim-cmd vmsvc/message 25 like here:

# vim-cmd vmsvc/message 25
Virtual machine message 5970112:
This virtual machine might have been moved or copied. In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied. If you don't know, answer "I Copied It". 
   0. button.uuid.cancel (Cancel)
   1. button.uuid.movedTheVM (I Moved It)
   2. button.uuid.copiedTheVM (I Copied It) [default]

The “[default]” will automatically be answered on ESXi 6.5 after four (4) minutes. For this, I got two (2) identical lines of log in /var/log/hostd.log for this:

2021-05-15T13:10:27.062Z info hostd[AE81B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx] Answered question 5970112
2021-05-15T13:10:27.062Z info hostd[AE81B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx] Answered question 5970112

Intermezzo: /var/log/hostd.log extract when not answering the “moved” question

A few observations of the log file is at the bottom of this post in a gist [Archive.is].

  • each vim-cmd vmsvc invocation leads to
    • a logon event with log-entries like these where I really wonder where password comes from. as this is not a new interactive logon:
      Accepted password for user root from 127.0.0.1
      2021-05-15T13:05:58.568Z info hostd[AEC2B70] [Originator@6876 sub=Vimsvc opID=vim-cmd-56-584b] [Auth]: User root
      2021-05-15T13:05:58.568Z verbose hostd[AEC2B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-584b] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
      2021-05-15T13:05:58.568Z info hostd[AEC2B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-56-584b] Event 762 : User root@127.0.0.1 logged in as VMware-client/6.5.0
      2021-05-15T13:05:58.568Z verbose hostd[AEC2B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-584b] RecordOp ADD: sessionList["5263dcbb-1baf-7a5a-ab7b-ea07e6499e50"], ha-sessionmgr. Applied change to temp map.
      
    • a logoff event with log-entries like these (note a slightly different opID, but the same sessionList ID):
      2021-05-15T13:05:58.623Z verbose hostd[AEC2B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-5859 user=root] RecordOp ASSIGN: info, haTask--vim.ServiceInstance.retrieveContent-130896484. Applied change to temp map.
      2021-05-15T13:05:58.623Z verbose hostd[AEC2B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-5859 user=root] RecordOp ASSIGN: info, haTask--vim.ServiceInstance.retrieveContent-130896484. Applied change to temp map.
      2021-05-15T13:05:58.625Z verbose hostd[AE40B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-585a user=root] RecordOp ASSIGN: info, haTask--vim.SessionManager.logout-130896485. Applied change to temp map.
      2021-05-15T13:05:58.625Z verbose hostd[AE40B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-585a user=root] RecordOp REMOVE: sessionList["5263dcbb-1baf-7a5a-ab7b-ea07e6499e50"], ha-sessionmgr. Applied change to temp map.
      2021-05-15T13:05:58.625Z verbose hostd[AE40B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-585a user=root] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
      2021-05-15T13:05:58.625Z info hostd[AE40B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-56-585a user=root] Event 763 : User root@127.0.0.1 logged out (login time: Saturday, 15 May, 2021 13:05:58, number of API invocations: 0, user agent: VMware-client/6.5.0)
      2021-05-15T13:05:58.625Z verbose hostd[AE40B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-56-585a user=root] RecordOp ASSIGN: info, haTask--vim.SessionManager.logout-130896485. Applied change to temp map.
      
  • Reading a pending message:
    Accepted password for user root from 127.0.0.1
    2021-05-15T13:06:32.389Z verbose hostd[B040B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-588a] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:06:32.389Z info hostd[B040B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-d0-588a] Event 767 : User root@127.0.0.1 logged in as VMware-client/6.5.0
    2021-05-15T13:06:32.389Z verbose hostd[B040B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-588a] RecordOp ADD: sessionList["52967fcb-195c-96b3-429b-4762cbb5fdbd"], ha-sessionmgr. Applied change to temp map.
    2021-05-15T13:06:32.453Z verbose hostd[BBC2B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-5898 user=root] RecordOp ASSIGN: info, haTask--vim.ServiceInstance.retrieveContent-130896487. Applied change to temp map.
    2021-05-15T13:06:32.453Z verbose hostd[BBC2B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-5898 user=root] RecordOp ASSIGN: info, haTask--vim.ServiceInstance.retrieveContent-130896487. Applied change to temp map.
    2021-05-15T13:06:32.455Z verbose hostd[BB81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-5899 user=root] RecordOp ASSIGN: info, haTask--vim.SessionManager.logout-130896488. Applied change to temp map.
    2021-05-15T13:06:32.455Z verbose hostd[BB81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-5899 user=root] RecordOp REMOVE: sessionList["52967fcb-195c-96b3-429b-4762cbb5fdbd"], ha-sessionmgr. Applied change to temp map.
    2021-05-15T13:06:32.455Z verbose hostd[BB81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-5899 user=root] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:06:32.455Z info hostd[BB81B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-d0-5899 user=root] Event 768 : User root@127.0.0.1 logged out (login time: Saturday, 15 May, 2021 13:06:32, number of API invocations: 0, user agent: VMware-client/6.5.0)
    2021-05-15T13:06:32.456Z verbose hostd[BB81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-d0-5899 user=root] RecordOp ASSIGN: info, haTask--vim.SessionManager.logout-130896488. Applied change to temp map.
  • A cron event of the automatic configuration backup:
    2021-05-15T13:06:31.559Z info hostd[AE40B70] [Originator@6876 sub=SysCommandPosix] ForkExec(/sbin/backup.sh) 181092
    2021-05-15T13:06:32.798Z info hostd[AE40B70] [Originator@6876 sub=Hostsvc.HostConfigSyncManager] Backup succeeded
  • Powering up a moved virtual machine, leading up to a cancelable task and the message:
    Accepted password for user root from 127.0.0.1
    2021-05-15T13:06:26.505Z info hostd[B081B70] [Originator@6876 sub=Vimsvc opID=vim-cmd-8f-585d] [Auth]: User root
    2021-05-15T13:06:26.505Z verbose hostd[B081B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-585d] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:06:26.505Z info hostd[B081B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-8f-585d] Event 764 : User root@127.0.0.1 logged in as VMware-client/6.5.0
    2021-05-15T13:06:26.505Z verbose hostd[B081B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-585d] RecordOp ADD: sessionList["52165943-fe83-da06-513a-6c2c38b0e470"], ha-sessionmgr. Applied change to temp map.
    2021-05-15T13:06:26.548Z info hostd[AE40B70] [Originator@6876 sub=Vimsvc.TaskManager opID=vim-cmd-8f-586a user=root] Task Created : haTask-25-vim.VirtualMachine.powerOn-130896486
    2021-05-15T13:06:26.548Z verbose hostd[AE40B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ADD: recentTask["haTask-25-vim.VirtualMachine.powerOn-130896486"], 25. Sent notification immediately.
    2021-05-15T13:06:26.548Z verbose hostd[AE40B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ADD: recentTask["haTask-25-vim.VirtualMachine.powerOn-130896486"], ha-taskmgr. Applied change to temp map.
    2021-05-15T13:06:26.548Z verbose hostd[B940B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ASSIGN: info, haTask-25-vim.VirtualMachine.powerOn-130896486. Applied change to temp map.
    2021-05-15T13:06:26.551Z verbose hostd[B940B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:06:26.551Z info hostd[B940B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-8f-586a user=root] Event 765 : archiveteam-warrior-v3-20171013 on host ESXi-X10SRH-CF in ha-datacenter is starting
    2021-05-15T13:06:26.551Z info hostd[B940B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx opID=vim-cmd-8f-586a user=root] State Transition (VM_STATE_OFF -> VM_STATE_POWERING_ON)
    2021-05-15T13:06:26.551Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] SIOC: SIOC is notified not to start injector
    2021-05-15T13:06:26.552Z verbose hostd[B940B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ASSIGN: disabledMethod, 25. Sent notification immediately.
    2021-05-15T13:06:26.552Z verbose hostd[B940B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ASSIGN: info.cancelable, haTask-25-vim.VirtualMachine.powerOn-130896486. Applied change to temp map.
    2021-05-15T13:06:26.552Z verbose hostd[B940B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-586a user=root] RecordOp ASSIGN: info.cancelable, haTask-25-vim.VirtualMachine.powerOn-130896486. Applied change to temp map.
    2021-05-15T13:06:26.553Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] DictionaryLoad: Cannot open file "/usr/lib/vmware/config": No such file or directory.
    2021-05-15T13:06:26.553Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] Could not expand environment variable HOME.
    2021-05-15T13:06:26.553Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] DictionaryLoad: Cannot open file "~/.vmware/config": No such file or directory.
    2021-05-15T13:06:26.556Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] Starting vmx as /bin/vmx
    2021-05-15T13:06:26.556Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] Starting vmx as /bin/vmx
    2021-05-15T13:06:26.557Z info hostd[B940B70] [Originator@6876 sub=vm:VigorExecVMXExCommon: VM /vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx opID=vim-cmd-8f-586a user=root] in directory /vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013
    2021-05-15T13:06:26.557Z info hostd[B940B70] [Originator@6876 sub=vm:VigorExecVMXExCommon: Exec()'ing /bin/vmx /vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx opID=vim-cmd-8f-586a user=root]
    2021-05-15T13:06:26.557Z info hostd[B940B70] [Originator@6876 sub=Libs opID=vim-cmd-8f-586a user=root] Vigor: VMKernel_ForkExec(/bin/vmx, detached=1): status=0 pid=181085
    2021-05-15T13:06:26.611Z verbose hostd[B081B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: info.cancelable, haTask-25-vim.VirtualMachine.powerOn-130896486. Applied change to temp map.
    2021-05-15T13:06:26.625Z verbose hostd[A0E7B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: info.progress, haTask-25-vim.VirtualMachine.powerOn-130896486. Applied change to temp map.
    2021-05-15T13:06:26.798Z verbose hostd[BBC2B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:06:26.798Z info hostd[BBC2B70] [Originator@6876 sub=Vimsvc.ha-eventmgr] Event 766 : Message on archiveteam-warrior-v3-20171013 on ESXi-X10SRH-CF in ha-datacenter: This virtual machine might have been moved or copied.
    --> In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied.
    -->
    --> If you don't know, answer "I Co_pied It".
    -->
    -->
    2021-05-15T13:06:26.798Z verbose hostd[BBC2B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: runtime.question, 25. Sent notification immediately.
    2021-05-15T13:06:26.799Z verbose hostd[BBC2B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: summary.runtime.question, 25. Sent notification immediately.
    2021-05-15T13:06:26.799Z verbose hostd[BBC2B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: disabledMethod, 25. Sent notification immediately.
  • The time out while waiting for the answer to the message immediately leads to the actual power on state of the virtual machine:
    2021-05-15T13:10:27.043Z verbose hostd[A0E7B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: info.progress, haTask-25-vim.VirtualMachine.powerOn-130896486. Applied change to temp map.
    2021-05-15T13:10:27.053Z verbose hostd[B040B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: runtime.question, 25. Sent notification immediately.
    2021-05-15T13:10:27.053Z verbose hostd[B040B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: summary.runtime.question, 25. Sent notification immediately.
    2021-05-15T13:10:27.053Z verbose hostd[B040B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: disabledMethod, 25. Sent notification immediately.
    2021-05-15T13:10:27.053Z verbose hostd[B040B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:10:27.053Z info hostd[B040B70] [Originator@6876 sub=Vimsvc.ha-eventmgr] Event 769 : Message on archiveteam-warrior-v3-20171013 on ESXi-X10SRH-CF in ha-datacenter: This virtual machine might have been moved or copied.
    --> In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied.
    -->
    --> If you don't know, answer "I Co_pied It".
    -->
    -->
    2021-05-15T13:10:27.062Z info hostd[AE81B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx] Answered question 5970112
    2021-05-15T13:10:27.062Z info hostd[AE81B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx] Answered question 5970112
    2021-05-15T13:10:27.079Z info hostd[AE81B70] [Originator@6876 sub=Hostsvc] Decremented SIOC Injector Flag2
    2021-05-15T13:10:27.080Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:10:27.080Z info hostd[AE81B70] [Originator@6876 sub=Vimsvc.ha-eventmgr] Event 770 : archiveteam-warrior-v3-20171013 on  ESXi-X10SRH-CF in ha-datacenter is powered on
    2021-05-15T13:10:27.080Z info hostd[AE81B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx] State Transition (VM_STATE_POWERING_ON -> VM_STATE_ON)
  • The loggoff of the vim-cmd that tried to power on the moved virtual machine. It ends when the message got the default answer, and the virtual machine fully powered up:
    2021-05-15T13:10:27.116Z info hostd[AE81B70] [Originator@6876 sub=Vmsvc.vm:/vmfs/volumes/6097a4eb-6c6e4c76-46d3-0cc47aaa9742/base/archiveteam/archiveteam-warrior-v3-20171013/archiveteam-warrior-v3-20171013.vmx] Skip a duplicate transition to: VM_STATE_ON
    2021-05-15T13:10:27.116Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider] RecordOp ASSIGN: runtime.featureRequirement, 25. Sent notification immediately.
    2021-05-15T13:10:27.123Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-5d23 user=root] RecordOp ASSIGN: info, haTask--vim.ServiceInstance.retrieveContent-130896490. Applied change to temp map.
    2021-05-15T13:10:27.123Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-5d23 user=root] RecordOp ASSIGN: info, haTask--vim.ServiceInstance.retrieveContent-130896490. Applied change to temp map.
    2021-05-15T13:10:27.125Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-5d24 user=root] RecordOp ASSIGN: info, haTask--vim.SessionManager.logout-130896491. Applied change to temp map.
    2021-05-15T13:10:27.125Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-5d24 user=root] RecordOp REMOVE: sessionList["52165943-fe83-da06-513a-6c2c38b0e470"], ha-sessionmgr. Applied change to temp map.
    2021-05-15T13:10:27.125Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-5d24 user=root] RecordOp ASSIGN: latestEvent, ha-eventmgr. Applied change to temp map.
    2021-05-15T13:10:27.125Z info hostd[AE81B70] [Originator@6876 sub=Vimsvc.ha-eventmgr opID=vim-cmd-8f-5d24 user=root] Event 771 : User root@127.0.0.1 logged out (login time: Saturday, 15 May, 2021 13:06:26, number of API invocations: 0, user agent: VMware-client/6.5.0)
    2021-05-15T13:10:27.125Z verbose hostd[AE81B70] [Originator@6876 sub=PropertyProvider opID=vim-cmd-8f-5d24 user=root] RecordOp ASSIGN: info, haTask--vim.SessionManager.logout-130896491. Applied change to temp map.

Back to answering the question

Let’s first repeat the help:

# vim-cmd help vmsvc/message
Usage: message vmid [messageId] [messageChoice]

Replies to the current pending question on the vm.

Given this message for virtual machine having a vmid of 25 awaiting an answer to messageId number 6233874:

# vim-cmd vmsvc/message 25
Virtual machine message 6233874:
This virtual machine might have been moved or copied. In order to configure certain management and networking features, VMware ESX needs to know if this virtual machine was moved or copied. If you don't know, answer "I Copied It". 
   0. button.uuid.cancel (Cancel)
   1. button.uuid.movedTheVM (I Moved It)
   2. button.uuid.copiedTheVM (I Copied It) [default]

You can answer the question in a separate console/ssh session with either of these:

  • Cancel: vim-cmd vmsvc/message 25 6233874 0 where 25 is the vmid of the virtual machine and 6233874 is the messageId of the message.
    • The Virtual Machine will not power on and the power.on command fails:
      # vim-cmd vmsvc/power.on 25
      Powering on VM:
      Power on fail
  • The virtual machine was moved vim-cmd vmsvc/message 25 6233874 1 where 25 is the vmid of the virtual machine and 6233874 is the messageId of the message.
    • The Virtual Machine will power on and the power.on command succeeds:
      # vim-cmd vmsvc/power.on 25
      Powering on VM:
    • The .vmx file of the virtual machine will change these fields:
      • uuid.location
      • cleanShutdown (for running virtual machines, this always has value "FALSE"; for cleanly shutdown machines the value will be "TRUE")
      • sched.swap.derivedName with a new value for the .vswp file.
      • softPowerOff(for running virtual machines, this always has the value "FALSE"; for cleanly shutdown machines the value will be "TRUE")
  • 2, or wait for more than four (4) minutes:
    • The Virtual Machine will power on, and the power.on command succeeds::
      # vim-cmd vmsvc/power.on 25
      Powering on VM:
    • The .vmx file of the virtual machine will change these fields (you can see this below the signature or in this gist [Archive.is]):
      • uuid.location
      • uuid.bios (which for Windows system will often require a new license key)
      • ethernet0.generatedAddress
      • cleanShutdown (for running virtual machines, this always has value "FALSE"; for cleanly shutdown machines the value will be "TRUE")
      • sched.swap.derivedName with a new value for the .vswp file.
      • softPowerOff(for running virtual machines, this always has the value "FALSE"; for cleanly shutdown machines the value will be "TRUE")

Generating the “answer” command

I prefer to answer these questions manually, but use this fragment to generate an answer command that selects the “Moved” answer:

    message=`vim-cmd vmsvc/message ${vmid}`
    echo "message: $message"
    messageId=`echo "$message" | sed -n -E -e 's/^Virtual machine message (.*):$/\1/p'`
    movedAnswerId=`echo "$message" | sed -n -E -e 's/^ +([[:digit:]])\. button.uuid.* Moved.*$/\1/p'`
    if [[ "$movedAnswerId" == 1 ]]; then
        echo "vim-cmd vmsvc/message $vmid $messageId $movedAnswerId"
    fi

It is based on these regular expression experiments:

–jeroen

Read the rest of this entry »

Posted in *nix, *nix-tools, ash/dash, ash/dash development, Development, ESXi6, ESXi6.5, ESXi6.7, ESXi7, Power User, Scripting, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »

Overriding some DNS entries for internal networks

Posted by jpluimers on 2022/01/27

Based on [Wayback] domain name system – Overriding some DNS entries in BIND for internal networks – Server Fault and some further reading, there seem to be two ways used in these scenarios:

I wonder how that would interact best with Pi-Hole based solutions. Would it be best to have your local network use the Pi-Hole server, then have the Pi-Hole server obtain the DNS information it cannot resolve through one of the above solutions? Or would other solutions work better?

So here are a few links:

Pi-Hole seems not interested in RPZ: [Wayback] Implement Response Zone Policies (NXDOMAIN) for end-user performance increase – Feature Requests / Implemented – Pi-hole Userspace

Pi-Hole default blacklist is mentioned in [Wayback/Archive.is] pi-hole/basic-install.sh at master · pi-hole/pi-hole (look for adlistFile which defaults to [Wayback/Archive.is] StevenBlack/hosts: 🔒 Consolidating and extending hosts files from several well-curated sources. Optionally pick extensions for porn, social media, and other categories.).

Since I need this for ESXi: [Wayback/Archive.is] Let’s Encrypt SSL for ESXi

–jeroen

Posted in *nix, *nix-tools, bind-named, DNS, Internet, Linux, Power User | Leave a Comment »

In life, including working life “slow is smooth, and smooth is fast.”

Posted by jpluimers on 2022/01/26

I’ve been agile all my (not just programming) life, and only figured out this century that there is a vocabulary for that, containing the words agile, extreme programming, feature-driven and many more.

Now with the passing of the years, I also realise I have been trying to do “slow and smooth” all my life, and that with age (and less adrenaline) this becomes easier and easier.

I think “slow and smooth” goes well with “agile”, specially when you keep the focus on “doing things right” (and trying to do them right the first time, and keeping it right in incremental steps).

It often reminds me of the Dutch phrase “heeft u haast, gaat dan zitten” which often is attributed to be part of the many Chinese proverbs. It roughly translates to “when in a hurry, take a seat”, and suggests to take a step back and think when under pressure. Maybe this English version of a Chinese proverb comes close: “When you are in a hurry, the horse holds back”.

For is it is intriguing that mainly Chinese, but in a broader sense Asian, proverbs play such an important role, whereas Western proverbs get less and less important. Informal knowledge seems to diminish in Western culture, which I think is a pity.

Maybe all these vocabulary things that started  to make sense way after my puberty also have to do with being diagnosed autistic at 50. That too started a lot of puzzle-pieces to suddenly make sense.

Below the links that inspired me to make this blog post in the first place:

–jeroen

Read the rest of this entry »

Posted in Conferences, Event, Software Development, Development, Power User, Agile, LifeHacker, Conference Topics | Leave a Comment »

ESXi: reloading all virtual machines from their (potentially) vmx files

Posted by jpluimers on 2022/01/26

I had to reload all registered virtual machine configurations after replacing an NVMe adapter in one of my ESXi hosts (see the posts next week).

The below script is based on this series of April last year on listing, stopping, starting, hibernating and waking up VMs, especially vim-cmd-list-all-VMs.sh:

  1. VMware ESXi console: viewing all VMs, suspending and waking them up: part 1 on Busybox, sed and regular expressions (especially capture groups)
  2. VMware ESXi console: viewing all VMs, suspending and waking them up: part 2 on vim-cmd vmsvc commands, especially the on the ones accepting a vmid parameter
  3. VMware ESXi console: viewing all VMs, suspending and waking them up: part 3 digging deeper into the various vim-cmd vmsvc/power.* commands
  4. VMware ESXi console: viewing all VMs, suspending and waking them up: part 4 on amending vim-cmd vmsvc/getallvms with information from vim-cmd vmsvc/power.getstate and vim-cmd vmsvc/get.config
  5. VMware ESXi console: viewing all VMs, suspending and waking them up: part 5 on applying the various vim-cmd vmsvc/power.* commands on a list of relevant virtual machines

Here is the script vim-cmd-reload-all-VM-vmx-configurations.sh:

#!/bin/sh
vmids=`vim-cmd vmsvc/getallvms | sed -n -E -e "s/^([[:digit:]]+)\s+((\S.+\S)?)\s+(\[\S+\])\s+(.+\.vmx)\s+(\S+)\s+(vmx-[[:digit:]]+)\s*?((\S.+)?)$/\1/p"`
for vmid in ${vmids} ; do                                       
    powerState=`vim-cmd vmsvc/power.getstate ${vmid} | sed '1d'`                                                                                    
    name=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/\(vim.vm.ConfigInfo\) \{/,/files = \(vim.vm.FileInfo\) \{/ s/^ +name = "(.*)",.*?/\1/p'`                         
    vmPathName=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/files = \(vim.vm.FileInfo\) \{/,/tools = \(vim.vm.ToolsConfigInfo\) \{/ s/^ +vmPathName = "(.*)",.*?/\1/p'`
    echo "Reloading vmx of VM with id ${vmid} which has power state ${powerState} (name = ${name}; vmPathName = ${vmPathName})."
    vim-cmd vmsvc/reload ${vmid}
done
exit 0

Note that the script can throw errors, for instance the below one:

# vim-cmd vmsvc/reload 27
(vmodl.fault.SystemError) {
   faultCause = (vmodl.MethodFault) null, 
   faultMessage = , 
   reason = "Invalid fault"
   msg = "Received SOAP response fault from []: reload
vim.fault.InvalidState"
}

This particular error means that the ESXi system itself is in an invalid state (as opposed to the virtual machine being an invalid state). In this case, it can be thrown if the ESXi system is in Maintenance Mode: in that case, it is not allowed to reload any .vmx virtual machine configurations (it only shows the configuration at the time that hostd got started).

There are two ways to solve this:

  1. The blunt way: restart the hostd as this will re-read the .vmx files
  2. The not so blunt way: bring the server out of maintenance mode, then rerun the vim-cmd vmsvc/reload command.

On the many places that can throw vim.fault.InvalidState

In this case, the reason for vim.fault.InvalidState was that the server was in maintenance mode. However, be aware that there are way more places that can throw vim.fault.InvalidState.

Via [Wayback/Archive.is] 1-day-SAP-custom/InvalidState.rst at master · bcstryker/1-day-SAP-custom and [Wayback/Archive.is] bcstryker/1-day-SAP-custom, I found [Wayback/Archive.is] InvalidState – vSphere Web Services API – VMware {code} that lists about 200 API calls for this seemingly simple fault:

Fault Description

An InvalidState fault is thrown if the operation failed due to the current state of the system.

For example, at [Wayback] Failed to deploy VM: vim.fault.InvalidState – VMware Technology Network VMTN the cause of vim.fault.InvalidState was deploying an .ova file over a slow WiFi connection.

On VMware services and their names

The VMware service names are very well explained in the [Wayback] what is difference between hostd, Vpxa and vpxd. – VMware Technology Network VMTN answer by [Wayback] About AndreTheGiant – VMware Technology Network VMTN

  • hostd is the daemon for direct VIC connection (when you use VIC to connect to your ESX).
  • vpx is the original name of vCenter Center, so:
    • vpxa is the VC agent (ESX side)
    • vpxd is the VC daemon (VC side)

Since ESXi 5.0, the VIC (VMware Infrastructure Client) got gradually replaced by the vSphere Web Client which is serviced by the hostd as well, see:

–jeroen

Posted in Power User, VMware, VMware ESXi, Virtualization, ESXi6, ESXi6.5, ESXi6.7, ESXi7 | Leave a Comment »

Good scientific abstract template

Posted by jpluimers on 2022/01/25

Good Abstracts: A Template
Fabrizio Gilardi*
February 24, 2021
Abstract
Everyone agrees that this issue is really important. But we do not know much about
this specific question, although it matters a great deal, for these reasons. We approach the
problem from this perspective. Our research design focuses on these cases and relies on
these data, which we analyze using this method. Results show what we have learned about
the question. They have these broader implications.
*Department of Political Science, University of Zurich (https://fabriziogilardi.org/).
1

Source: [Wayback] fabriziogilardi.org/resources/papers/good-abstracts.pdf

Via:

–jeroen

Posted in LifeHacker, Power User | Leave a Comment »

 
%d bloggers like this: