VMware {code} Community
akmalh
Contributor
Contributor

How to find which user created snapshot?

Hi

I am a newbie in VMware Perl SDK. I am trying list all snapshots of a vm with description, time and user who created the snapshot. So far with the VMware provided sample snapshotmanager.pl, I can get snapshot name, description and time but I cannot get any information about the creator/initiator of the snapshot. I did some searching through the Perl API and came across VmSnapshotFileInfo data object. I am guessing if I can access that object, the "owner" property will be the user information. But I don't know how to access the object from a VirtualMachine object reference. Is this the correct way? How to get the user information using the data object?

Regards


SV

Reply
0 Kudos
4 Replies
stumpr
Virtuoso
Virtuoso

I think you'll have to query the events and tasks and match up the snapshot.  Double check my thought here, but I believe the owner is the actual file owner (may just show up as root).

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
Trondesson
Contributor
Contributor

Hi.

Could you solve your issue in the meantime?

I like to do the same, but I have no idea how to get the creator of a snapshot.

Regards

Trondesson

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

You can query for Tasks, match them up with the VirtualMachine(s).  For the username who created the snapshot, it's usually in the 'reason' property:

myTask.reason.userName

You can match up the task with VirtualMachines through 'entity' property"

myTask.entity

Then you can compare the ManagedObjectReference.  You can also filter on entity in the TaskCollector if that works for you use case as well.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
Trondesson
Contributor
Contributor

Hi.

I'm very new to Perl-Scripting and the use of the VMware SDK for Perl. Do you have a small example script, that shows how to do that?

Reply
0 Kudos