VMware {code} Community
TimLawrence
Enthusiast
Enthusiast

Resize a VM in vCloud Director

Hi all,

vCloud director does not provide the function to resize Hard Disks in the GUI. It is also not recommended to do this through the vSphere client. as such I have created a workflow which does this using the vCloud REST api. The workflow required the http-rest & vcloud director plugins (vcloud 1.5)

A couple of attributes are required but could be set programatically if required:

  • HOST
    • a vCloud plugin Host (most people probably only have one)
  • RESTHOST
    • The http-rest representation of the vCloud Host

Input Parameter:

  • VM
    • selection from the vCloud plugin Inventory view

The basic principle of the workflow is as follows:

  1. get a VM object as an input parameter (vCloud plugin)
  2. get the XML representation of the object from http-rest
  3. enumerate the VM's hard disks
  4. prompt the user to select a disk to resize (only increasing size works at the moment)
  5. get the new disk size
  6. update the disk size using the rest plugin
  7. wait for the update task to complete.

the workflow is attached. Let me know if there are any issue as I only have 1 system to test it in (ie I can not import it to test the package)

Hope it works for you.

Tim

0 Kudos
4 Replies
cdecanini_
VMware Employee
VMware Employee

Great workflow bu why not using the OOTB vCD 1.5 plug-in  "Change Hard disk capacity" workflow ?

Also you may want to post this in the vCenter Orchestrator communities instead of the Plug-in SDK one.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
0 Kudos
TimLawrence
Enthusiast
Enthusiast

Dammit!! I didn’t se that one. After all that code I wrote, the following appears to be cheating ☺

"com.vmware.library.vCloud.vApp.VM").changeVirtualHardDiskCapacity(disks[i], newSize”

Ah well, At least I have the user interaction to pop up and select an existing disk!

0 Kudos
Windspirit
Hot Shot
Hot Shot

It does only work if you don't use Fast Provisioning (Linked Clones).

The workflow  "Change Hard disk capacity" doesn't work in 5.1.2 when a VM is Fast Provisioned (Chainleanth >1)

It creates the error:

The hard drives of the virtual machine "Lin" may not be modified, once created.; majorErrorCode=400; minorErrorCode=BAD_REQUEST; vendorSpecificErrorCode=null; (Workflow:Change hard disk capacity / Resize Disk # (item0)#15)

But there is a workaround.

  1. PowerOff you VM
  2. Consolidate the VM
  3. Resize the Disk

as soon as the Chain length is 1, you can resize the disk as normal

Attached a rework of the "Change Hard disk capacity" workflow that now does also the consolidation

0 Kudos
vAngelGC
Contributor
Contributor

Today I run into the same issue: " The hard drives of the virtual machine "GCI_100000000000013151" may not be modified, once created."

So, VM that is part of linked clone chain even after consolidation didn't allowed the base disk to be re-sized. The actual problem was active snapshot on the VM, after removing and consolidating the VM, the disk can be extended to desired size.

Hope this will help someone facing the same issue.

Angel

0 Kudos