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