Merge lp:~sandy-walsh/nova/LP699878 into lp:~hudson-openstack/nova/trunk

Proposed by Sandy Walsh
Status: Merged
Approved by: Josh Kearney
Approved revision: 952
Merged at revision: 953
Proposed branch: lp:~sandy-walsh/nova/LP699878
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 33 lines (+8/-1)
1 file modified
nova/virt/xenapi_conn.py (+8/-1)
To merge this branch: bzr merge lp:~sandy-walsh/nova/LP699878
Reviewer Review Type Date Requested Status
Josh Kearney (community) Approve
Cory Wright (community) Approve
Brian Waldon (community) Approve
Review via email: mp+56770@code.launchpad.net

Commit message

adds a timeout on session.login_with_password()

Description of the change

Adds a timeout on session.login_with_password()

To post a comment you must log in.
lp:~sandy-walsh/nova/LP699878 updated
952. By Sandy Walsh

better error message

Revision history for this message
Brian Waldon (bcwaldon) wrote :

What versions of python are we officially supporting? I ask because I think the "with timeout" would have to change to a try/except for versions < 2.5

review: Needs Information
Revision history for this message
Josh Kearney (jk0) wrote :

> What versions of python are we officially supporting? I ask because I think
> the "with timeout" would have to change to a try/except for versions < 2.5

2.6+ for now. No 2.5 support.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

> > What versions of python are we officially supporting? I ask because I think
> > the "with timeout" would have to change to a try/except for versions < 2.5
>
> 2.6+ for now. No 2.5 support.

Great. Approves all around

review: Approve
Revision history for this message
Cory Wright (corywright) wrote :

lgtm.

review: Approve
Revision history for this message
Josh Kearney (jk0) wrote :

Nice work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nova/virt/xenapi_conn.py'
2--- nova/virt/xenapi_conn.py 2011-03-24 22:39:39 +0000
3+++ nova/virt/xenapi_conn.py 2011-04-07 15:01:09 +0000
4@@ -63,6 +63,7 @@
5
6 from eventlet import event
7 from eventlet import tpool
8+from eventlet import timeout
9
10 from nova import context
11 from nova import db
12@@ -140,6 +141,9 @@
13 flags.DEFINE_string('xenapi_remap_vbd_dev_prefix', 'sd',
14 'Specify prefix to remap VBD dev to '
15 '(ex. /dev/xvdb -> /dev/sdb)')
16+flags.DEFINE_integer('xenapi_login_timeout',
17+ 10,
18+ 'Timeout in seconds for XenAPI login.')
19
20
21 def get_connection(_):
22@@ -318,7 +322,10 @@
23 def __init__(self, url, user, pw):
24 self.XenAPI = self.get_imported_xenapi()
25 self._session = self._create_session(url)
26- self._session.login_with_password(user, pw)
27+ exception = self.XenAPI.Failure(_("Unable to log in to XenAPI "
28+ "(is the Dom0 disk full?)"))
29+ with timeout.Timeout(FLAGS.xenapi_login_timeout, exception):
30+ self._session.login_with_password(user, pw)
31 self.loop = None
32
33 def get_imported_xenapi(self):