VMware: Additional check for RootSnapshot (#36001)

This fix adds an additional check if there is no snapshot available
in VM. `rootSnapshotList` is None, if no snapshot is taken.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/36007/head
Abhijeet Kasurde 7 years ago committed by GitHub
parent 1d0fd49a33
commit 52f79fa5a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -241,11 +241,13 @@ class PyVmomiHelper(PyVmomi):
memory_dump = False memory_dump = False
quiesce = False quiesce = False
# Check if there is a latest snapshot already present as specified by user # Check if there is a latest snapshot already present as specified by user
if vm.snapshot is not None:
snap_obj = self.get_snapshots_by_name_recursively(vm.snapshot.rootSnapshotList, snap_obj = self.get_snapshots_by_name_recursively(vm.snapshot.rootSnapshotList,
self.module.params["snapshot_name"]) self.module.params["snapshot_name"])
if snap_obj: if snap_obj:
# Snapshot already exists, do not anything. # Snapshot already exists, do not anything.
self.module.exit_json(changed=False, msg="Snapshot named [%(snapshot_name)s] already exists." % self.module.params) self.module.exit_json(changed=False,
msg="Snapshot named [%(snapshot_name)s] already exists and is current." % self.module.params)
# Check if Virtual Machine provides capabilities for Quiesce and Memory Snapshots # Check if Virtual Machine provides capabilities for Quiesce and Memory Snapshots
if vm.capability.quiescedSnapshotsSupported: if vm.capability.quiescedSnapshotsSupported:
quiesce = self.module.params['quiesce'] quiesce = self.module.params['quiesce']

Loading…
Cancel
Save