VMware: Handle exception for no snapshot while cloning (#47924)
Handle exception when there is no snapshot available in virtual machine or template while cloning using vmware_guest.
Fixes: #47920
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 487f2f25ce
)
This commit is contained in:
parent
a89cd5a30f
commit
949ffe6da7
2 changed files with 4 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- Handle exception when there is no snapshot available in virtual machine or template while cloning using vmware_guest.
|
|
@ -2051,6 +2051,8 @@ class PyVmomiHelper(PyVmomi):
|
||||||
clonespec.customization = self.customspec
|
clonespec.customization = self.customspec
|
||||||
|
|
||||||
if snapshot_src is not None:
|
if snapshot_src is not None:
|
||||||
|
if vm_obj.snapshot is None:
|
||||||
|
self.module.fail_json(msg="No snapshots present for virtual machine or template [%(template)s]" % self.params)
|
||||||
snapshot = self.get_snapshots_by_name_recursively(snapshots=vm_obj.snapshot.rootSnapshotList,
|
snapshot = self.get_snapshots_by_name_recursively(snapshots=vm_obj.snapshot.rootSnapshotList,
|
||||||
snapname=snapshot_src)
|
snapname=snapshot_src)
|
||||||
if len(snapshot) != 1:
|
if len(snapshot) != 1:
|
||||||
|
|
Loading…
Reference in a new issue