A corner case in _call_method of vmwareapi_conn.py
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Medium
|
Unassigned |
Bug Description
In nova/virt/
(Samples taken from vmwareapi/vmops.py module)
Calls are made either through vim_util's utility functions. e.g
self._session.
"Datastore", ["summary.type", "summary.name"])
Or
directly say a call like
vm_create_task = self._session.
self.
"CreateVM_Task", vm_folder_mor,
config=
Now suppose the session we held expires at the vCenter, we get an error and we create say new vim object with a new session id. But in case of the second call,
we still are referring to the old vim object as the module palceholder. We just need to make it point to the latest vim object. Just need to add a line to the
_call_method in the else part. The code would look like this after the change
if not isinstance(module, vim.Vim):
# If it is not the first try, then get the latest vim
# object
if retry_count > 0:
args = args[1:]
args = [self.vim] + args
else:
module = self.vim
I think code formatting was not proper in the bug description. What i meant was that add an else to cover up for the case when module is an instance of vim.Vim..
Add
module = self.vim
in the else part