(cross-post from vCloud forum)
Now that vCloud Director 5.1 supports snapshots, I am looking at the PowerCLI 5.1 cmdlets and cannot find a way to create/manage/revert snapshots. I see it is there in the API, but don't see a way to interface via PowerCLI. Any ideas?
Got ya covered. :smileygrin:
http://geekafterfive.com/2012/10/02/vcloud-director-snapshots-with-powercli/
I moved the thread to the vCloud Director PowerCLI community
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
vCloud Director 5.1 is not officially supported in PowerCLI 5.1 R1, having said that I have not looked to see if you can do this with the extensiondata or get-CIView as yet, might be worth looking there. I might have a look myslef now
PowerCLI 5.1 not officially supporting vCloud 5.1? I thought the whole point of the version number convergence was to provide a cohesive and compatible set of services identifying by the same version number..
Anyways.. it seems to work fine, but I've been unable to find snapshots either natively or through ExtensionData.
If you do a Get-PowerCLIVersion, you will see that the vCloud Snapin is still 1.5. PowerCLI is supported on vSphere 5.1, therefore the version number was changed to 5.1.
PS>Get-PowerCLIVersionPowerCLI Version----------------VMware vSphere PowerCLI 5.1 Release 1 build 793510---------------Snapin Versions---------------VMWare AutoDeploy PowerCLI Component 5.1 build 768137VMWare ImageBuilder PowerCLI Component 5.1 build 768137VMware vCloud Director PowerCLI Component 1.5 build 793505VMware License PowerCLI Component 5.1 build 669840VMware vSphere PowerCLI Component 5.1 build 793489
You won't see snapshots in the current version of vCloud PowerCLI, because it is connecting to the 1.5 version of the API.
If you are the impatient type, you could certainly write some Powershell to communicate directly to the 5.1 version of the vCloud API. :smileygrin:
Otherwise, I'm sure vCloud PowerCLI 5.1 will be out soon!
Cheers,
Jake
Got ya covered. :smileygrin:
http://geekafterfive.com/2012/10/02/vcloud-director-snapshots-with-powercli/
Hi Jake,
Great module!
Let me give you some hints:
1. The snapshot operations (New, Revert, Remove) are asynchronous and they return task as a result. In order to make them synchronous in your commands you need to wait the returned tasks. Here is how:
$response = $request.GetResponse()
$xmlDocument = New-Object 'System.XML.XMLDocument'
$xmlDocument.Load($response.GetResponseStream())
$taskId= $xmlDocument.ChildNodes.Item(1).id
Get-Task -Id $taskId | Wait-Task
2. The switch parameter revertToCurrent in your Set-CISnapshot adv function is not used, it always revert to the current snapshot, so you can remove it
Regards,
Dimitar Milov
PowerCLI Team
Great stuff. Thanks Jake!
I'll be looking forward to the updated PowerCLI... this is great in the interim!
PowerCLI 5.1 R2 includes vCloud API 5.1 support! Although there are still no cmdlets for snapshots, the update still makes it very easy to work with them (and you don't need my module anymore!) :smileygrin:
# Get the vApp
$vapp = Get-CIVApp "My VApp"
# CreateSnapshot(System.Nullable[bool] memory, System.Nullable[bool] quiesce, string name,string description)
$vapp.ExtensionData.CreateSnapshot($false,$true,"My Snapshot","Description")
# Now remove it
$vapp.ExtensionData.RemoveAllSnapshots()
Hi Jake,
Thanks a lot for the info here and in your blog regarding this issue.
Is there a way do retrieve the date of the snapshot taken on a vApp as can be seen when right-clicking it in the vCD gui?
I'm using PowerCLI 5.5 on vCD 5.1.2
Thanks!