-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CA-388527 xsconsole: 'timed out' when creating an ISCSI SR #42
CA-388527 xsconsole: 'timed out' when creating an ISCSI SR #42
Conversation
If it fails with a 15 second timeout on one system, it seems likely that it will fail even with a 20 second timeout on another system. It seems pretty weird setting such a low timeout, not just on a specific socket but as the default timeout for all Python sockets in the program. I think it would be better to not change the default socket timeout and rather just set an appropriate timeout on certain specific operations where it is needed. |
I looked into the code, and it turned out that the default socket timeout was added in CA-69997 for a scenario that "xsconsole is already running when the master's IP is changed". I don't think we can remove I also noticed that the Any suggestion? |
That might be there for a reason but it still seems like a hack at best. I guess it might be quite a lot of work to fix it. Another option for cases where the XAPI call is expected to take a long time would be to use an async call and then poll the task at some interval until it completes. That should avoid hitting a socket timeout even if the task takes longer than 15 or 20 seconds. Polling is not the best but I expect these kinds of calls from xsconsole would be rare. |
Thanks for the advice. I'll try the polling. |
c10c58c
to
9aa8f69
Compare
if self.Completed(): | ||
result = self.completionStatus | ||
else: | ||
result= self.session.xenapi.task.get_status(self.hotOpaqueRef.OpaqueRef()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously this returned the status which seems wrong. Was that used anywhere or was it just a latent bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is a bug, and I checked that the function was not used.
else: | ||
result= self.session.xenapi.task.get_status(self.hotOpaqueRef.OpaqueRef()) | ||
return HotOpaqueRef(result, 'any') | ||
return self.result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For synchronous tasks, is it guaranteed that self.result
has already been set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caller of Result()
checks if the result is none, and raises an exception if none.
As for synchronous tasks, the result returns directly from Task.Sync(). They don't need to call Result()
86c430f
to
9448b04
Compare
The XSConsoleAuth set socket timout value to 15 seconds, and it's not enough for the SR.create. Use xenapi.Async call instead. Signed-off-by: Stephen Cheng <[email protected]>
9448b04
to
39bdb8b
Compare
The PR xapi-project#42 uses keyword-only argument which is not supported in Python2 In XS8, we still uses python2, so fix this to work both in python2 and python3 Signed-off-by: Stephen Cheng <[email protected]>
The PR #42 uses keyword-only argument which is not supported in Python2 In XS8, we still uses python2, so fix this to work both in python2 and python3 Signed-off-by: Stephen Cheng <[email protected]>
The PR xapi-project/xsconsole#42 uses keyword-only argument which is not supported in Python2 In XS8, we still uses python2, so fix this to work both in python2 and python3 Signed-off-by: Stephen Cheng <[email protected]>
The PR #42 uses keyword-only argument which is not supported in Python2 In XS8, we still uses python2, so fix this to work both in python2 and python3 Signed-off-by: Stephen Cheng <[email protected]>
The XSConsoleAuth set socket timout value to 15 seconds,
and it's not enough for the SR.create.
Use xenapi.Async call instead.
Test passed: