diff options
Diffstat (limited to 'modules/private/buildbot/common')
-rw-r--r-- | modules/private/buildbot/common/libvirt.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/private/buildbot/common/libvirt.py b/modules/private/buildbot/common/libvirt.py index 85fd908..e250627 100644 --- a/modules/private/buildbot/common/libvirt.py +++ b/modules/private/buildbot/common/libvirt.py | |||
@@ -154,7 +154,19 @@ class Connection: | |||
154 | 154 | ||
155 | def __init__(self, uri): | 155 | def __init__(self, uri): |
156 | self.uri = uri | 156 | self.uri = uri |
157 | self.connection = libvirt.open(uri) | 157 | self._connection = None |
158 | |||
159 | @property | ||
160 | def connection(self): | ||
161 | if self._connection is not None: | ||
162 | try: | ||
163 | if not self._connection.isAlive(): | ||
164 | self._connection = None | ||
165 | except: | ||
166 | self._connection = None | ||
167 | if self._connection is None: | ||
168 | self._connection = libvirt.open(self.uri) | ||
169 | return self._connection | ||
158 | 170 | ||
159 | @defer.inlineCallbacks | 171 | @defer.inlineCallbacks |
160 | def create(self, xml): | 172 | def create(self, xml): |