vmware / open-vm-tools

Official repository of VMware open-vm-tools project
http://sourceforge.net/projects/open-vm-tools/
2.26k stars 427 forks source link

Feature request: Enable getting disk name -> WWN mapping #548

Open dkacar-oradian opened 3 years ago

dkacar-oradian commented 3 years ago

In VmWare console disks have names like Hard disk 1, Hard disk 2, etc. On Linux most of the time these map to /dev/sda, /dev/sdb, etc. but not always because /dev/sd* names are not guaranteed to be stable across reboots.

The only names that are stable are the ones in /dev/disk/by-id. Symlinks there will be generated if the VM has disk.enableUUID option set to True. However, configuration tools like SaltStack, Ansible, etc. would then need a mapping from VmWare's disk name to WWN in /dev/disk/by-id. So, please, add a feature to Open-VM tools to get that mapping somehow. Then SaltStack could put it into its grains, Ansible could put it into its facts, etc.

If there are security concerns about the sensitivity of this information it doesn't have to be enabled by default.

My most complicated use case is an LXC server on which various containers need separate disks for their data. And those disks could be added in random order because one should be able to add LXC containers in whichever order one wants. But then /dev/sda, /dev/sdb, etc. on the LXC host cannot be used at all.

It would also be nice if one could have a script which could print VmWare disk name along with the information normally provided by the df utility. This in case one needs to quickly extend a disk and other things like that. This is for the ad-hoc administration and doesn't have much to do with the above mentioned configuration utilities.

The feature could be extended to supply other VmWare information (eg. mapping between network names in VmWare and interfaces in the OS), but I currently have no use for that, so I'm leaving that to your discretion.

lemke1458 commented 3 years ago

I think we have what you want from the management side. See the mappings in https://vdc-download.vmware.com/vmwb-repository/dcr-public/b50dcbbf-051d-4204-a3e7-e1b618c1e384/538cf2ec-b34f-4bae-a332-3820ef9e7773/vim.vm.GuestInfo.DiskInfo.html This allows you to associate a guest disk with the underlying virtual disk.

But are you wanting this inside the guest, without access to the management APIs?

dkacar-oradian commented 3 years ago

But are you wanting this inside the guest, without access to the management APIs?

That's correct. It would really be nice if the guest could get that info for itself, without needing network access and password for the management API.

I know how to get that info from the management API, but implementing that is complicated due to security reasons. I am going to go that route if there's no other option available.