i am reconfiging a vm server using vim25 java api.
what i need to do is adding a hard disk to a vm.
i use reconfigVM_Task(virtualMachine, spec) method
then i organized the spec in which i set the para of new hard disk in,some of the fields the spec required i did not have. Such as "fileName","unitNumber" etc.
who can tell me where to find some documents to study with.
thanks in advance.
@vijaya Thanks for your reply
I had the sample code,and browsed it so many times.
But the code dosen't help.
For example the file name is generated by
String fileName = "["+dsName+"] "+ clp.get_option("vmname") + "/" + clp.get_option("value") + ".vmdk";
But i don't think it is the very format what i have already had.The disk file name of my virtual machine hard disk 1 is
[mydatastore] xbianTest3_1/xbianTest3.vmdk
"mydatastore" is the name of my data store.
"xbianTest3" is the name of my vm.
but how dose "xbianTest3_1" come?
Hi,
We used vsphere sdk in c#. In that we make a filename as follows:
string dspath = "[mydatastore] xbianTest3_1/xbianTest3.vmdk";
@vijayagce Thank you for your reply
In the logic of your code,the new vmName based on
[mydatastore] xbianTest3_1/xbianTest3.vmdk
will be
xbianTest3_1000
and then the disk file name will be
[mydatastore] xbianTest3_1/xbianTest3_1000.vmdk
but how did the xbianTest3_1 come?
And I want to know that how the logic come,from some documents by VMWare?
Hi,
It will work..u thought unitnumber as controllerkey..controllerkey will be 1000 and it will have unitnumber as 0 for first harddisk in vm which has OS in it and we can add second hard disk with name as vmname_unitnumber.vmdk. Just try and let me know the result..what it get 1000 or 1.
I think u dont have code to find unitnumber. Please find below code in c# for unitnumber calculation:
Thanks,
for better understanding..try to connect with esx as "https://ESXIP/mob" in browser using esx username and password. it will give some clarification..because i got this ideas from that oneonly... mob is managedObjects..
some info:
after connect with link..u will get homepage as follow..
then to get vm details give link name as follows
https://192.168.10.140/mob/?moid=ha-folder-vm
now u can get the page as follow
now click on number of ur VM or change link as follows "https://192.168.10.140/mob/?moid=96"
the window will be like this
from this u can go to config and then hardware then u will get list of hardware for VM.
In that page 1000 will be controllerkey. When u click on controller key it will show how many vmdk disks are added for VM. If has only one vmdk file for VM then we will get one integervalue as 2000 in below image.
then u have to go back and click the number what u seen in previous screenshot..like 2000
if u click that link then u can get unitnumbet as 0.
it may not understandable..let me know ur doubts to make clear in it..
Thanks,