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>
This commit is contained in:
parent
1d0fd49a33
commit
52f79fa5a4
1 changed files with 7 additions and 5 deletions
|
@ -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…
Reference in a new issue