VMware Cloud Community
AUTMatt
Contributor
Contributor
Jump to solution

Snapshots with vCloud Director 5.1 & PowerCLI 5.1

(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?

Reply
0 Kudos
1 Solution

Accepted Solutions
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

Got ya covered. :smileygrin:

http://geekafterfive.com/2012/10/02/vcloud-director-snapshots-with-powercli/

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson

View solution in original post

Reply
0 Kudos
10 Replies
LucD
Leadership
Leadership
Jump to solution

I moved the thread to the vCloud Director PowerCLI community


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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 Smiley Happy

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
AUTMatt
Contributor
Contributor
Jump to solution

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.

Reply
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

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-PowerCLIVersion
PowerCLI Version
----------------
   VMware vSphere PowerCLI 5.1 Release 1 build 793510
---------------
Snapin Versions
---------------
   VMWare AutoDeploy PowerCLI Component 5.1 build 768137
   VMWare ImageBuilder PowerCLI Component 5.1 build 768137
   VMware vCloud Director PowerCLI Component 1.5 build 793505
   VMware License PowerCLI Component 5.1 build 669840
   VMware vSphere PowerCLI Component 5.1 build 793489

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

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

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

Got ya covered. :smileygrin:

http://geekafterfive.com/2012/10/02/vcloud-director-snapshots-with-powercli/

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos
dmilov
VMware Employee
VMware Employee
Jump to solution

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 Smiley Wink

Regards,

Dimitar Milov

PowerCLI Team

AUTMatt
Contributor
Contributor
Jump to solution

Great stuff.  Thanks Jake!

I'll be looking forward to the updated PowerCLI... this is great in the interim!

Reply
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

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()

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos
talofir
Contributor
Contributor
Jump to solution

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!

Reply
0 Kudos