Merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 4021
Proposed branch: lp:~rvb/maas/pool-size-1.8
Merge into: lp:maas/1.8
Diff against target: 193 lines (+44/-10)
6 files modified
src/maasserver/api/nodes.py (+2/-3)
src/maasserver/plugin.py (+14/-0)
src/maasserver/tests/test_plugin.py (+14/-2)
src/maasserver/websockets/handlers/node.py (+3/-4)
src/provisioningserver/drivers/power/__init__.py (+9/-0)
src/provisioningserver/rpc/power.py (+2/-1)
To merge this branch: bzr merge lp:~rvb/maas/pool-size-1.8
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+264390@code.launchpad.net

Commit message

Backport 4072: Set the maximum thread pool size to 100: this is meant as a workaround for deadlocks such as the one described in the linked bug. It's not meant to be a permanent solution but rather to buy us time to come up with a proper solution. Unify the power query timeout: use a unique timeout across the board and use a value that can accommodate seamicro's tendency to take 30s to reply to a power query.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Simple backport, self-approving. My testing in one of our lab (ivok's lab) indicates this definitely improves the situation.

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8 failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Get:3 http://security.ubuntu.com trusty-security/main Sources [87.9 kB]
Get:4 http://security.ubuntu.com trusty-security/universe Sources [28.1 kB]
Get:5 http://security.ubuntu.com trusty-security/main amd64 Packages [309 kB]
Get:6 http://security.ubuntu.com trusty-security/universe amd64 Packages [111 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:7 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [213 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [213 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:14 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:15 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Get:16 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:17 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,155 kB in 16min 35s (1,159 B/s)

W: Failed to fetch http://nova.clouds.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources Hash Sum mismatch

W: Failed to fetch http://nova.clouds.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8 failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://security.ubuntu.com trusty-security/main Sources [87.9 kB]
Get:4 http://security.ubuntu.com trusty-security/universe Sources [28.1 kB]
Get:5 http://security.ubuntu.com trusty-security/main amd64 Packages [309 kB]
Get:6 http://security.ubuntu.com trusty-security/universe amd64 Packages [111 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:7 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [213 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Get:14 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,604 kB in 11min 55s (2,243 B/s)

W: Failed to fetch http://nova.clouds.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8 failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Get:3 http://security.ubuntu.com trusty-security/main Sources [87.9 kB]
Get:4 http://security.ubuntu.com trusty-security/universe Sources [28.1 kB]
Get:5 http://security.ubuntu.com trusty-security/main amd64 Packages [309 kB]
Get:6 http://security.ubuntu.com trusty-security/universe amd64 Packages [111 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:7 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [213 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [296 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,882 kB in 9min 57s (3,151 B/s)

W: Failed to fetch http://nova.clouds.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8 failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://security.ubuntu.com trusty-security/main Sources [87.9 kB]
Get:5 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Get:6 http://security.ubuntu.com trusty-security/universe Sources [28.1 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [309 kB]
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [111 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [213 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [295 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Get:14 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [295 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,732 kB in 11min 26s (2,521 B/s)

W: Failed to fetch http://nova.clouds.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8 failed. Below is the output from the failed tests.

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

Revision history for this message
MAAS Lander (maas-lander) wrote :

The attempt to merge lp:~rvb/maas/pool-size-1.8 into lp:maas/1.8 failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Get:2 http://security.ubuntu.com trusty-security Release [63.5 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://security.ubuntu.com trusty-security/main Sources [87.9 kB]
Get:5 http://security.ubuntu.com trusty-security/universe Sources [28.1 kB]
Get:6 http://security.ubuntu.com trusty-security/main amd64 Packages [309 kB]
Get:7 http://security.ubuntu.com trusty-security/universe amd64 Packages [111 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Get:8 http://nova.clouds.archive.ubuntu.com trusty-updates Release [63.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [213 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [125 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [295 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Get:13 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [569 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,663 kB in 9min 19s (2,974 B/s)

W: Failed to fetch http://nova.clouds.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/binary-amd64/Packages Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/api/nodes.py'
--- src/maasserver/api/nodes.py 2015-05-28 09:38:40 +0000
+++ src/maasserver/api/nodes.py 2015-07-10 09:11:31 +0000
@@ -77,6 +77,7 @@
77from maasserver.utils import find_nodegroup77from maasserver.utils import find_nodegroup
78from maasserver.utils.orm import get_first78from maasserver.utils.orm import get_first
79from piston.utils import rc79from piston.utils import rc
80from provisioningserver.drivers.power import POWER_QUERY_TIMEOUT
80from provisioningserver.power.poweraction import (81from provisioningserver.power.poweraction import (
81 PowerActionFail,82 PowerActionFail,
82 UnknownPowerType,83 UnknownPowerType,
@@ -696,9 +697,7 @@
696 power_type=power_info.power_type,697 power_type=power_info.power_type,
697 context=power_info.power_parameters)698 context=power_info.power_parameters)
698 try:699 try:
699 # Allow 30 seconds for the power query max as we're holding700 state = call.wait(POWER_QUERY_TIMEOUT)
700 # up an appserver thread here.
701 state = call.wait(30)
702 except crochet.TimeoutError:701 except crochet.TimeoutError:
703 maaslog.error(702 maaslog.error(
704 "%s: Timed out waiting for power response in Node.power_state",703 "%s: Timed out waiting for power response in Node.power_state",
705704
=== modified file 'src/maasserver/plugin.py'
--- src/maasserver/plugin.py 2015-05-07 18:14:38 +0000
+++ src/maasserver/plugin.py 2015-07-10 09:11:31 +0000
@@ -24,6 +24,7 @@
24from twisted.plugin import IPlugin24from twisted.plugin import IPlugin
25from twisted.python import usage25from twisted.python import usage
26from zope.interface import implementer26from zope.interface import implementer
27from twisted.internet import reactor
2728
2829
29def serverFromString(description):30def serverFromString(description):
@@ -45,6 +46,14 @@
45 ]46 ]
4647
4748
49# The maximum number of threads used by the default twisted thread pool.
50# This value is a trade-off between a small value (such as the default: 10)
51# which can create deadlocks (see 1470013) and a huge value which can cause
52# MAAS to hit other limitations such as the number of open files or the
53# number of concurrent database connexions.
54MAX_THREADS = 100
55
56
48@implementer(IServiceMaker, IPlugin)57@implementer(IServiceMaker, IPlugin)
49class RegionServiceMaker:58class RegionServiceMaker:
50 """Create a service for the Twisted plugin."""59 """Create a service for the Twisted plugin."""
@@ -76,6 +85,10 @@
76 import crochet85 import crochet
77 crochet.no_setup()86 crochet.no_setup()
7887
88 def _configurePoolSize(self):
89 threadpool = reactor.getThreadPool()
90 threadpool.adjustPoolsize(10, MAX_THREADS)
91
79 def _makeIntrospectionService(self, endpoint):92 def _makeIntrospectionService(self, endpoint):
80 from provisioningserver.utils import introspect93 from provisioningserver.utils import introspect
81 introspect_service = (94 introspect_service = (
@@ -91,6 +104,7 @@
91 self._configureLogging()104 self._configureLogging()
92 self._configureDjango()105 self._configureDjango()
93 self._configureCrochet()106 self._configureCrochet()
107 self._configurePoolSize()
94108
95 # Populate the region's event-loop with services.109 # Populate the region's event-loop with services.
96 from maasserver import eventloop110 from maasserver import eventloop
97111
=== modified file 'src/maasserver/tests/test_plugin.py'
--- src/maasserver/tests/test_plugin.py 2015-05-07 18:14:38 +0000
+++ src/maasserver/tests/test_plugin.py 2015-07-10 09:11:31 +0000
@@ -17,6 +17,7 @@
17import crochet17import crochet
18from maasserver import eventloop18from maasserver import eventloop
19from maasserver.plugin import (19from maasserver.plugin import (
20 MAX_THREADS,
20 Options,21 Options,
21 RegionServiceMaker,22 RegionServiceMaker,
22)23)
@@ -24,11 +25,13 @@
24from maastesting.testcase import MAASTestCase25from maastesting.testcase import MAASTestCase
25from provisioningserver import logger26from provisioningserver import logger
26from provisioningserver.utils.twisted import asynchronous27from provisioningserver.utils.twisted import asynchronous
28from testtools.matchers import GreaterThan
27from twisted.application.service import MultiService29from twisted.application.service import MultiService
30from twisted.internet import reactor
2831
2932
30class TestOptions(MAASTestCase):33class TestOptions(MAASTestCase):
31 """Tests for `provisioningserver.plugin.Options`."""34 """Tests for `maasserver.plugin.Options`."""
3235
33 def test_defaults(self):36 def test_defaults(self):
34 options = Options()37 options = Options()
@@ -42,7 +45,7 @@
4245
4346
44class TestRegionServiceMaker(MAASTestCase):47class TestRegionServiceMaker(MAASTestCase):
45 """Tests for `provisioningserver.plugin.RegionServiceMaker`."""48 """Tests for `maasserver.plugin.RegionServiceMaker`."""
4649
47 def setUp(self):50 def setUp(self):
48 super(TestRegionServiceMaker, self).setUp()51 super(TestRegionServiceMaker, self).setUp()
@@ -78,3 +81,12 @@
78 "Not all services are named.")81 "Not all services are named.")
79 self.assertThat(logger.basicConfig, MockCalledOnceWith())82 self.assertThat(logger.basicConfig, MockCalledOnceWith())
80 self.assertThat(crochet.no_setup, MockCalledOnceWith())83 self.assertThat(crochet.no_setup, MockCalledOnceWith())
84
85 @asynchronous(timeout=5)
86 def test__sets_pool_size(self):
87 service_maker = RegionServiceMaker("Harry", "Hill")
88 service_maker.makeService(Options())
89 threadpool = reactor.getThreadPool()
90 self.assertEqual(MAX_THREADS, threadpool.max)
91 # Max threads is reasonable.
92 self.assertThat(threadpool.max, GreaterThan(50))
8193
=== modified file 'src/maasserver/websockets/handlers/node.py'
--- src/maasserver/websockets/handlers/node.py 2015-05-28 15:07:01 +0000
+++ src/maasserver/websockets/handlers/node.py 2015-07-10 09:11:31 +0000
@@ -48,6 +48,7 @@
48)48)
49from metadataserver.enum import RESULT_TYPE49from metadataserver.enum import RESULT_TYPE
50from metadataserver.models import NodeResult50from metadataserver.models import NodeResult
51from provisioningserver.drivers.power import POWER_QUERY_TIMEOUT
51from provisioningserver.logger import get_maas_logger52from provisioningserver.logger import get_maas_logger
52from provisioningserver.power.poweraction import (53from provisioningserver.power.poweraction import (
53 PowerActionFail,54 PowerActionFail,
@@ -547,9 +548,7 @@
547 power_type=power_info.power_type,548 power_type=power_info.power_type,
548 context=power_info.power_parameters)549 context=power_info.power_parameters)
549 try:550 try:
550 # Allow 15 seconds for the power query max as we're holding551 state = call.wait(POWER_QUERY_TIMEOUT)['state']
551 # up a thread waiting.
552 state = call.wait(15)['state']
553 except crochet.TimeoutError:552 except crochet.TimeoutError:
554 maaslog.error(553 maaslog.error(
555 "%s: Timed out waiting for power response in "554 "%s: Timed out waiting for power response in "
@@ -569,5 +568,5 @@
569 # sure the change is committed and retried if required. Not pushing568 # sure the change is committed and retried if required. Not pushing
570 # this to another thread, would result in the entire power query being569 # this to another thread, would result in the entire power query being
571 # performed again.570 # performed again.
572 update_power_state(state).wait(15)571 update_power_state(state).wait(POWER_QUERY_TIMEOUT)
573 return state572 return state
574573
=== modified file 'src/provisioningserver/drivers/power/__init__.py'
--- src/provisioningserver/drivers/power/__init__.py 2015-05-07 18:14:38 +0000
+++ src/provisioningserver/drivers/power/__init__.py 2015-07-10 09:11:31 +0000
@@ -13,6 +13,7 @@
1313
14__metaclass__ = type14__metaclass__ = type
15__all__ = [15__all__ = [
16 "POWER_QUERY_TIMEOUT",
16 "PowerActionError",17 "PowerActionError",
17 "PowerAuthError",18 "PowerAuthError",
18 "PowerConnError",19 "PowerConnError",
@@ -29,6 +30,7 @@
29 abstractmethod,30 abstractmethod,
30 abstractproperty,31 abstractproperty,
31)32)
33from datetime import timedelta
3234
33from jsonschema import validate35from jsonschema import validate
34from provisioningserver.drivers import (36from provisioningserver.drivers import (
@@ -52,6 +54,13 @@
52}54}
5355
5456
57# Timeout for the power query action. We might be holding up a thread for that
58# long but some BMCs (notably seamicro) can take a long time to respond to
59# a power query request.
60# This should be configurable per-BMC.
61POWER_QUERY_TIMEOUT = timedelta(seconds=45).total_seconds()
62
63
55class PowerError(Exception):64class PowerError(Exception):
56 """Base error for all power driver failure commands."""65 """Base error for all power driver failure commands."""
5766
5867
=== modified file 'src/provisioningserver/rpc/power.py'
--- src/provisioningserver/rpc/power.py 2015-05-14 07:22:16 +0000
+++ src/provisioningserver/rpc/power.py 2015-07-10 09:11:31 +0000
@@ -78,7 +78,8 @@
7878
7979
80# Timeout for change_power_state(). We set it to 5 minutes by default,80# Timeout for change_power_state(). We set it to 5 minutes by default,
81# but it would be lovely if this was configurable.81# but it would be lovely if this was configurable. This is only a backstop
82# meant to cope with broken BMCs.
82CHANGE_POWER_STATE_TIMEOUT = timedelta(minutes=5).total_seconds()83CHANGE_POWER_STATE_TIMEOUT = timedelta(minutes=5).total_seconds()
8384
8485

Subscribers

People subscribed via source and target branches