PyVmomi: Override __deepcopy__ method of SoapStuAdapter

Currently, we cannot deepcopy managed objects because managed objects have a threading lock (in the soap stub) which is an un(deep)copyable object. Hence, overriding the __deepcopy__ to fix this
This commit is contained in:
Tianhao He
2015-10-06 10:37:31 -07:00
parent 438e5c68de
commit 4e3ad26b24

View File

@@ -1393,6 +1393,12 @@ class SoapStubAdapter(SoapStubAdapterBase):
pass
conn.connect = ConnectDisableNagle
## Need to override the depcopy method. Since, the stub is not deep copyable
# due to the thread lock and connection pool, deep copy of a managed object
# fails. Further different instances of a managed object still share the
# same soap stub. Hence, returning self here is fine.
def __deepcopy__(self, memo):
return self
HEADER_SECTION_END = '\r\n\r\n'