VMware: Handle No Permission exception while clone (#33806)

This fix adds exception handling for No Permission exception
raised while clone operation.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/25180/merge
Abhijeet Kasurde 7 years ago committed by GitHub
parent a09fd80bba
commit 4391f5c094
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1451,7 +1451,13 @@ class PyVmomiHelper(PyVmomi):
clonespec.config = self.configspec
clone_method = 'Clone'
task = vm_obj.Clone(folder=destfolder, name=self.params['name'], spec=clonespec)
try:
task = vm_obj.Clone(folder=destfolder, name=self.params['name'], spec=clonespec)
except vim.fault.NoPermission as e:
self.module.fail_json(msg="Failed to clone virtual machine %s to folder %s "
"due to permission issue: %s" % (self.params['name'],
destfolder,
to_native(e.msg)))
self.change_detected = True
else:
# ConfigSpec require name for VM creation

Loading…
Cancel
Save