I am using vSphere CLI 6.5.0 for resetting a VM from a Perl script. This is in the context a (proprietary) STONITH plugin for Pacemaker.
Immediately after STONITH, journalctl -u pacemaker
reports a warning in vmcontrol.pl
, which belongs to vSphere CLI. The warning is reported by fence_legacy
, which belongs to Pacemaker.
Use of uninitialized value $hostname in concatenation (.) or string at
/opt/vmware-vsphere-cli-distrib/apps/vm/vmcontrol.pl line 168.
The error occurs in a call to UTIL::trace
in this context:
sub reset_vm {
foreach (@$vm_views) {
my $mor_host = $_->runtime->host;
my $hostname = Vim::get_view(mo_ref => $mor_host)->name;
eval {
$_->ResetVM();
Util::trace(0, "\nvirtual machine '" . $_->name . "' under host".
" $hostname reset successfully ");
};
I am wondering whether this is a feature or a bug. Could it be that Vim::get_view
communicates with VMware at a time where the hostname cannot be reported (and hence $hostname
cannot be initialized) because the VM is rebooting?
It sounds unlikely (e.g because the call to ResetVM
occurs after the assignment to $hostname
), but I suspect something like this is going on, in which case the warning could be ignored. I also suspect that the problem is related to vSphere CLI alone (i.e. is not caused by its use inside a Pacemaker stack).
Can you try this one instead.