VMware Cloud Community
narendra8484
Contributor
Contributor

How to find Name of virtual disk of a vm in vcenter

I want to extend virtual disk size of a vm in vcenter using soap API , but in that it is asking DISK name. I need where to find the name of the disk of that VM.

Reply
0 Kudos
7 Replies
vThinkBeyondVM
VMware Employee
VMware Employee

Hi Nagendra,

I assume you are using below vSphere management API to extend the VMDK of the VM. "

ExtendVirtualDisk_Task(extendVirtualDisk)

If yes, please refer the attached screenshots for more clarity. That should solve your problem. If you want more help on this, let me know.

If you want to learn Java SDK for vSphere for automating your needs: Refer my blog : http://vthinkbeyondvm.com/getting-started-with-yavi-java-opensource-java-sdk-for-vmware-vsphere-step...


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

Reply
0 Kudos
narendra8484
Contributor
Contributor

hi vickyvision2020vickyvision,

Thanks u r reply, im not using YAVI . i'm using soap API's , i have that

ExtendVirtualDisk_Task(extendVirtualDisk)

<soapenv:Header/>

   <soapenv:Body>

      <urn:ExtendVirtualDisk_Task>

         <urn:_this type="?">?</urn:_this>

         <urn:name>?</urn:name>

         <!--Optional:-->

         <urn:datacenter type="?">?</urn:datacenter>

         <urn:newCapacityKb>?</urn:newCapacityKb>

         <!--Optional:-->

         <urn:eagerZero>?</urn:eagerZero>

      </urn:ExtendVirtualDisk_Task>

   </soapenv:Body>

In dis i need urn:name . I think it is the name of disk which we have to change size.If u know about dis do the help full.

thanks,

N narendra.

Reply
0 Kudos
vThinkBeyondVM
VMware Employee
VMware Employee

Hi Nagendra,

Try giving the same as specified in my screenshots attached (Highlighted). vSphere Management APIs are internally will be sending SOAP request. As per me , it should work. I never tried using directly through SOAP though.


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

Reply
0 Kudos
vThinkBeyondVM
VMware Employee
VMware Employee

Please also refer: https://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.VirtualDiskManager.ht...

This is API reference and <urn:datacenter type="?">?</urn:datacenter> is required to be set if you specify Disk Name the way I told you in screenshots.

To get <urn:datacenter type="?">?</urn:datacenter> value wrt to your vCenter, you can refer MOB of you vCenter.  : VMware KB: Looking up Managed Object Reference (MoRef) in vCenter Server


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

Reply
0 Kudos
narendra8484
Contributor
Contributor

thanks,that links were helpful but when i do it the got the following error.

Request====

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:vim25">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:ExtendVirtualDisk_Task>

         <urn:_this type="VirtualMachine">vm-9983</urn:_this>

         <urn:name>StorageTest/StorageTest_2.vmdk</urn:name>

         <urn:newCapacityKb>2000000</urn:newCapacityKb>

     </urn:ExtendVirtualDisk_Task>

   </soapenv:Body>

</soapenv:Envelope>

Response==

<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <soapenv:Fault>

         <faultcode>ServerFaultCode</faultcode>

         <faultstring>The request refers to an unexpected or unknown type.</faultstring>

         <detail>

            <InvalidTypeFault xsi:type="InvalidType" xmlns="urn:vim25"/>

         </detail>

      </soapenv:Fault>

   </soapenv:Body>

</soapenv:Envelope>

Reply
0 Kudos
vThinkBeyondVM
VMware Employee
VMware Employee

did not you pass this parameter as well?

  <urn:datacenter type="?">?</urn:datacenter>


----------------------------------------------------------------
Thanks & Regards
Vikas, VCP70, MCTS on AD, SCJP6.0, VCF, vSphere with Tanzu specialist.
https://vThinkBeyondVM.com/about
-----------------------------------------------------------------
Disclaimer: Any views or opinions expressed here are strictly my own. I am solely responsible for all content published here. Content published here is not read, reviewed or approved in advance by VMware and does not necessarily represent or reflect the views or opinions of VMware.

Reply
0 Kudos
narendra8484
Contributor
Contributor

Even after given passing datacenter  we are getting same error.

Reply
0 Kudos