So I received this request, to automate Extend disks in the OS/Add extra disk and etc.
So after doing my research, I've determine that I had to do several things, like:
- Get the UUID of the disk(so I can easily match disk in the vm and in the os)
- Get the SCSI Controller ID
- Get the unitNumber of the disk in the controller
For this I've done a script to extract that info, store it in a json, so I can easily parse the info, and I can exchange information from one scriptable task to the other.
It seemed to be a better idea than to query the vm, get the info, and then requery the vm at a later time, because I will need to go through all disk find if there's one with the UUID. If can't find any, I will have to determine which unitNumber on the SCSI Controller that I prefer, that is free.
The nice thing with my script and storing it in a json, I don't need to query the vcenter multiple times. But since stuff can happen in the vcenter at the same time, while I build my json, is it a good idea to store my data in a json, or should I just work directly with the vm in the vCenter ?
Is my question clear enough ?