I wrote an article yesterday called Performing A Storage vMotion in vCloud Director Using vCloud REST API and at the beginning I mentioned a few alternative solution to using the vCloud REST API such as the vCloud SDKs: Java, .NET, PHP or the new vCloud Director cmdlets. Afterwards, I realized I left out one very important solution, which is using vCenter Orchestrator (vCO) with the vCloud Director plugin.
I was able to quickly put together a vCO workflow using the Query Service in the vCD plugin and with the help of this VMTN thread from Christophe Decanni. I have exported my workflow so you can easily import it into your vCO Server without any hassle.
Disclaimer: Please thoroughly test this in a non-critical environment before using it on production systems.
Download: StoragevMotionForvCloud.workflow
To start using the workflow, you will need to ensure you have the vCloud Director 1.5 vCO plugin installed and import the workflow after you have downloaded it to your local system:
Here is a quick view of what the Storage vMotion for vCloud Director workflow looks like:
Here is an example execution of the workflow where we will Storage vMotion (using vCloud "relocate" API operation) to move "vESXi-01" VM from "iSCSI-3" to "iSCSI-4" datastore.
Step 1 - Select vCloud vDC and vCloud VM that you wish to performed the Storage vMotion. As part of the initial query, user will be provided with the current datastore the vCloud VM is residing on:
Step 2 - Once the query has completed to identify the current datastore the vCloud VM is residing on, a user interaction request will be needed to select the destination datastore to perform the migration to. You will notice the workflow icon will change to a yellow color and requiring an "answer" from the user. Right click on the workflow and click on "Answer" to continue the workflow:
Step 3 - You will see a "result" field which is the query of the vCloud VM that was selected and the datastore it's currently residing on. You will now have the option to select the vCloud datastore you wish to Storage vMotion the vCloud VM to:
Step 4 - Now you are ready to kick off the Storage vMotion operation. This may take sometime to finish depending on the size of the VM and the speed of your underlying storage. You should see a message under "Log" specifying the operation has been started. If everything is successful, you should see the vCloud VM now running on the new datastore.
Now you can enjoy performing Storage vMotions in vCoud Director with just a click of a button with the help of vCenter Orchestrator! Happy workflowing 🙂
Peter says
Nice work. Have you been able to get the VclVAppTemplate.relocate() version to work yet? VM's work but templates throw an Access is Forbidden error for me so far...
Oliver says
To move a template to a different datastore I just rightklicked the template and said "move to a different catalog", there I selected the same as before. It seems to work so far, but I did not have any linked clones of that maschine, don't know if this could have any side effect.
Anonymous says
Sounds good, but download doesn't work: Cannot resolve hostname!?!?
William says
Sorry about that, link fixed.
Anonymous says
Thanks a lot. Download works fine, but to import the workflow a different format is needed. I assume it should be one file instead of 3 files. Regards Christian
William says
No, you just import the workflow into vCO.
Anonymous says
Your ZIP consist of 3 files. When I try to import either of the files to vCo does not work: "Unable to import file * Not a valid workflow file".
William says
The extension as noted in the link should be .workflow, please don't try to save it as anything else. Within the .workflow, there will be several files but that's more of the internals of it which you don't need to touch. When you export a workflow, it'll have a .workflow extension & you can just import it right in.
Johan says
Nice work dude! Is there a new version for the vCloud Director 5.1 Plug-In? I can't get this working in my environment...
Anonymous says
Bump!