Skip to content

Instantly share code, notes, and snippets.

@patrobinson
Last active August 29, 2015 14:02
Show Gist options
  • Save patrobinson/4f57c61a497c117bd681 to your computer and use it in GitHub Desktop.
Save patrobinson/4f57c61a497c117bd681 to your computer and use it in GitHub Desktop.
@unbound_volumes = host.configManager.datastoreSystem.QueryUnresolvedVmfsVolumes
fail "No unresolved VMFS volumes found" if @unbound_volumes.empty?
@volume = nil
@unbound_volumes.each do |dstore|
next unless dstore.is_a? RbVmomi::VIM::HostUnresolvedVmfsVolume
# Unless this volume matches our vmfsLabel skip it
next unless dstore.vmfsLabel == vmfsLabel
@extpaths = []
dstore.extent.each { |ex| @extpaths.push ex.devicePath }
# Build a spec to find our volume
@res_spec = RbVmomi::VIM::HostUnresolvedVmfsResignatureSpec.new(:extentDevicePath => @extpaths)
# Resignature our volume's VMFS ID so it's unique
host.configManager.datastoreSystem.ResignatureUnresolvedVmfsVolume_Task(:resolutionSpec => @res_spec ).wait_for_completion
@volume = dstore
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment