mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
The HTTPConnection object times out too soon when status is being polled. This
depends on python's internal socket implementation. Added an explicit 3m timeout. Test code MUST NOT induce sleeps longer than 3m, instead check status periodically to keep the HTTPConnection alive. reviewed-by: Chirag Jog <chirag@clogeny.com>
This commit is contained in:
parent
1c1ee6e69c
commit
94eac37d30
@ -17,7 +17,7 @@ class cloudConnection(object):
|
||||
self.apiKey = apiKey
|
||||
self.securityKey = securityKey
|
||||
self.mgtSvr = mgtSvr
|
||||
self.connection = httplib.HTTPConnection("%s:%d"%(mgtSvr,port))
|
||||
self.connection = httplib.HTTPConnection("%s:%d"%(mgtSvr,port), timeout=180)
|
||||
self.port = port
|
||||
self.logging = logging
|
||||
if port == 8096:
|
||||
@ -139,4 +139,4 @@ if __name__ == '__main__':
|
||||
xml = '<?xml version="1.0" encoding="ISO-8859-1"?><deployVirtualMachineResponse><virtualmachine><id>407</id><name>i-1-407-RS3</name><displayname>i-1-407-RS3</displayname><account>system</account><domainid>1</domainid><domain>ROOT</domain><created>2011-07-30T14:45:19-0700</created><state>Running</state><haenable>false</haenable><zoneid>1</zoneid><zonename>CA1</zonename><hostid>3</hostid><hostname>kvm-50-205</hostname><templateid>4</templateid><templatename>CentOS 5.5(64-bit) no GUI (KVM)</templatename><templatedisplaytext>CentOS 5.5(64-bit) no GUI (KVM)</templatedisplaytext><passwordenabled>false</passwordenabled><serviceofferingid>1</serviceofferingid><serviceofferingname>Small Instance</serviceofferingname><cpunumber>1</cpunumber><cpuspeed>500</cpuspeed><memory>512</memory><guestosid>112</guestosid><rootdeviceid>0</rootdeviceid><rootdevicetype>NetworkFilesystem</rootdevicetype><nic><id>380</id><networkid>203</networkid><netmask>255.255.255.0</netmask><gateway>65.19.181.1</gateway><ipaddress>65.19.181.110</ipaddress><isolationuri>vlan://65</isolationuri><broadcasturi>vlan://65</broadcasturi><traffictype>Guest</traffictype><type>Direct</type><isdefault>true</isdefault><macaddress>06:52:da:00:00:08</macaddress></nic><hypervisor>KVM</hypervisor></virtualmachine></deployVirtualMachineResponse>'
|
||||
conn = cloudConnection(None)
|
||||
|
||||
print conn.paraseReturnXML(xml, deployVirtualMachine.deployVirtualMachineResponse())
|
||||
print conn.paraseReturnXML(xml, deployVirtualMachine.deployVirtualMachineResponse())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user