forked from projectvacuum/vcycle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openstack_api.py
552 lines (448 loc) · 24.2 KB
/
openstack_api.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
#!/usr/bin/python
#
# openstack_api.py - an OpenStack plugin for Vcycle
#
# Andrew McNab, University of Manchester.
# Copyright (c) 2013-5. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# o Redistributions of source code must retain the above
# copyright notice, this list of conditions and the following
# disclaimer.
# o Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Contacts: [email protected] http://www.gridpp.ac.uk/vcycle/
#
import pprint
import os
import re
import sys
import stat
import time
import json
import shutil
import string
import pycurl
import random
import base64
import StringIO
import tempfile
import calendar
import vcycle.vacutils
class OpenstackError(Exception):
pass
class OpenstackSpace(vcycle.BaseSpace):
def __init__(self, api, spaceName, parser, spaceSectionName):
# Initialize data structures from configuration files
# Generic initialization
vcycle.BaseSpace.__init__(self, api, spaceName, parser, spaceSectionName)
# OpenStack-specific initialization
try:
self.tenancy_name = parser.get(spaceSectionName, 'tenancy_name')
except Exception as e:
raise OpenstackError('tenancy_name is required in OpenStack [space ' + spaceName + '] (' + str(e) + ')')
try:
self.identityURL = parser.get(spaceSectionName, 'url')
except Exception as e:
raise OpenstackError('url is required in OpenStack [space ' + spaceName + '] (' + str(e) + ')')
try:
self.username = parser.get(spaceSectionName, 'username')
except Exception as e:
self.username = None
try:
self.usercert = parser.get(spaceSectionName, 'usercert')
except Exception as e:
self.usercert = None
try:
self.userkey = parser.get(spaceSectionName, 'userkey')
except Exception as e:
self.userkey = None
if self.usercert and not self.userkey:
self.userkey = self.usercert
elif self.userkey and not self.usercert:
self.usercert = self.userkey
if not self.username and not self.usercert:
raise OpenstackError('username or usercert/userkey is required in OpenStack [space ' + spaceName + '] (' + str(e) + ')')
try:
# We use Base64 encoding so browsing around casually
# doesn't reveal passwords in a memorable way.
self.password = base64.b64decode(parser.get(spaceSectionName, 'password_base64').strip()).strip()
except Exception:
self.password = ''
def connect(self):
# Connect to the OpenStack service
try:
result = self.httpRequest(self.identityURL + '/tokens',
{ 'auth' : { 'tenantName' : self.tenancy_name,
'passwordCredentials' : { 'username' : self.username,
'password' : self.password
}
}
} )
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.identityURL + ' (' + str(e) + ')')
self.token = str(result['response']['access']['token']['id'])
self.computeURL = None
self.imageURL = None
for endpoint in result['response']['access']['serviceCatalog']:
if endpoint['type'] == 'compute':
self.computeURL = str(endpoint['endpoints'][0]['publicURL'])
elif endpoint['type'] == 'image':
self.imageURL = str(endpoint['endpoints'][0]['publicURL'])
if not self.computeURL:
raise OpenstackError('No compute service URL found from ' + self.identityURL)
if not self.imageURL:
raise OpenstackError('No image service URL found from ' + self.identityURL)
vcycle.vacutils.logLine('Connected to ' + self.identityURL + ' for space ' + self.spaceName)
vcycle.vacutils.logLine('computeURL = ' + self.computeURL)
vcycle.vacutils.logLine('imageURL = ' + self.imageURL)
def scanMachines(self):
"""Query OpenStack compute service for details of machines in this space"""
# For each machine found in the space, this method is responsible for
# either (a) ignorning non-Vcycle VMs but updating self.totalMachines
# or (b) creating a Machine object for the VM in self.spaces
try:
result = self.httpRequest(self.computeURL + '/servers/detail',
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.computeURL + ' (' + str(e) + ')')
for oneServer in result['response']['servers']:
try:
machineName = str(oneServer['metadata']['name'])
except:
machineName = oneServer['name']
# Just in case other VMs are in this space
if machineName[:7] != 'vcycle-':
# Still count VMs that we didn't create and won't manage, to avoid going above space limit
self.totalMachines += 1
continue
uuidStr = str(oneServer['id'])
# Try to get the IP address. Always use the zeroth member of the earliest network
try:
ip = str(oneServer['addresses'][ min(oneServer['addresses']) ][0]['addr'])
except:
ip = '0.0.0.0'
createdTime = calendar.timegm(time.strptime(str(oneServer['created']), "%Y-%m-%dT%H:%M:%SZ"))
updatedTime = calendar.timegm(time.strptime(str(oneServer['updated']), "%Y-%m-%dT%H:%M:%SZ"))
try:
startedTime = calendar.timegm(time.strptime(str(oneServer['OS-SRV-USG:launched_at']).split('.')[0], "%Y-%m-%dT%H:%M:%S"))
except:
startedTime = None
taskState = str(oneServer['OS-EXT-STS:task_state'])
powerState = int(oneServer['OS-EXT-STS:power_state'])
status = str(oneServer['status'])
try:
machinetypeName = str(oneServer['metadata']['machinetype'])
except:
machinetypeName = None
if taskState == 'Deleting':
state = vcycle.MachineState.deleting
elif status == 'ACTIVE' and powerState == 1:
state = vcycle.MachineState.running
elif status == 'BUILD' or status == 'ACTIVE':
state = vcycle.MachineState.starting
elif status == 'SHUTOFF':
state = vcycle.MachineState.shutdown
elif status == 'ERROR':
state = vcycle.MachineState.failed
elif status == 'DELETED':
state = vcycle.MachineState.deleting
else:
state = vcycle.MachineState.unknown
self.machines[machineName] = vcycle.shared.Machine(name = machineName,
spaceName = self.spaceName,
state = state,
ip = ip,
createdTime = createdTime,
startedTime = startedTime,
updatedTime = updatedTime,
uuidStr = uuidStr,
machinetypeName = machinetypeName)
def getFlavorID(self, machinetypeName):
"""Get the "flavor" ID"""
if hasattr(self.machinetypes[machinetypeName], '_flavorID'):
if self.machinetypes[machinetypeName]._flavorID:
return self.machinetypes[machinetypeName]._flavorID
else:
raise OpenstackError('Flavor "' + self.machinetypes[machinetypeName].flavor_name + '" for machinetype ' + machinetypeName + ' not available!')
try:
result = self.httpRequest(self.computeURL + '/flavors/detail',
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.computeURL + ' (' + str(e) + ')')
try:
for flavor in result['response']['flavors']:
if flavor['name'] == self.machinetypes[machinetypeName].flavor_name:
self.machinetypes[machinetypeName]._flavorID = flavor['id']
try:
# Record if available
self.machinetypes[machinetypeName].mb = int(flavor['ram'])
except:
pass
try:
# Record if available
self.machinetypes[machinetypeName].cpus = int(flavor['vcpus'])
except:
pass
return self.machinetypes[machinetypeName]._flavorID
except:
pass
raise OpenstackError('Flavor "' + self.machinetypes[machinetypeName].flavor_name + '" for machinetype ' + machinetypeName + ' not available!')
def getImageID(self, machinetypeName):
"""Get the image ID"""
# If we already know the image ID, then just return it
if hasattr(self.machinetypes[machinetypeName], '_imageID'):
if self.machinetypes[machinetypeName]._imageID:
return self.machinetypes[machinetypeName]._imageID
else:
# If _imageID is None, then it's not available for this cycle
raise OpenstackError('Image "' + self.machinetypes[machinetypeName].root_image + '" for machinetype ' + machinetypeName + ' not available!')
# Get the existing images for this tenancy
try:
result = self.httpRequest(self.computeURL + '/images/detail',
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.computeURL + ' (' + str(e) + ')')
# Specific image, not managed by Vcycle, lookup ID
if self.machinetypes[machinetypeName].root_image[:6] == 'image:':
for image in result['response']['images']:
if self.machinetypes[machinetypeName].root_image[6:] == image['name']:
self.machinetypes[machinetypeName]._imageID = str(image['id'])
return self.machinetypes[machinetypeName]._imageID
raise OpenstackError('Image "' + self.machinetypes[machinetypeName].root_image[6:] + '" for machinetype ' + machinetypeName + ' not available!')
# Always store/make the image name
if self.machinetypes[machinetypeName].root_image[:7] == 'http://' or \
self.machinetypes[machinetypeName].root_image[:8] == 'https://' or \
self.machinetypes[machinetypeName].root_image[0] == '/':
imageName = self.machinetypes[machinetypeName].root_image
else:
imageName = '/var/lib/vcycle/spaces/' + self.spaceName + '/machinetypes/' + machinetypeName + '/files/' + self.machinetypes[machinetypeName].root_image
# Find the local copy of the image file
if not hasattr(self.machinetypes[machinetypeName], '_imageFile'):
if self.machinetypes[machinetypeName].root_image[:7] == 'http://' or \
self.machinetypes[machinetypeName].root_image[:8] == 'https://':
try:
imageFile = vcycle.vacutils.getRemoteRootImage(self.machinetypes[machinetypeName].root_image,
'/var/lib/vcycle/imagecache',
'/var/lib/vcycle/tmp',
'Vcycle ' + vcycle.shared.vcycleVersion)
imageLastModified = int(os.stat(imageFile).st_mtime)
except Exception as e:
raise OpenstackError('Failed fetching ' + self.machinetypes[machinetypeName].root_image + ' (' + str(e) + ')')
self.machinetypes[machinetypeName]._imageFile = imageFile
elif self.machinetypes[machinetypeName].root_image[0] == '/':
try:
imageLastModified = int(os.stat(self.machinetypes[machinetypeName].root_image).st_mtime)
except Exception as e:
raise OpenstackError('Image file "' + self.machinetypes[machinetypeName].root_image + '" for machinetype ' + machinetypeName + ' does not exist!')
self.machinetypes[machinetypeName]._imageFile = self.machinetypes[machinetypeName].root_image
else: # root_image is not an absolute path, but imageName is
try:
imageLastModified = int(os.stat(imageName).st_mtime)
except Exception as e:
raise OpenstackError('Image file "' + self.machinetypes[machinetypeName].root_image +
'" does not exist in /var/lib/vcycle/spaces/' + self.spaceName + '/machinetypes/' + machinetypeName + '/files/ !')
self.machinetypes[machinetypeName]._imageFile = imageName
else:
imageLastModified = int(os.stat(self.machinetypes[machinetypeName]._imageFile).st_mtime)
# Go through the existing images looking for a name and time stamp match
# We should delete old copies of the current image name if we find them here
# pprint.pprint(response)
for image in result['response']['images']:
try:
if image['name'] == imageName and \
image['status'] == 'ACTIVE' and \
image['metadata']['last_modified'] == str(imageLastModified):
self.machinetypes[machinetypeName]._imageID = str(image['id'])
return self.machinetypes[machinetypeName]._imageID
except:
pass
vcycle.vacutils.logLine('Image "' + self.machinetypes[machinetypeName].root_image + '" not found in image service, so uploading')
if self.machinetypes[machinetypeName].cernvm_signing_dn:
cernvmDict = vac.vacutils.getCernvmImageData(self.machinetypes[machinetypeName]._imageFile)
if cernvmDict['verified'] == False:
raise OpenstackError('Failed to verify signature/cert for ' + self.machinetypes[machinetypeName].root_image)
elif re.search(self.machinetypes[machinetypeName].cernvm_signing_dn, cernvmDict['dn']) is None:
raise OpenstackError('Signing DN ' + cernvmDict['dn'] + ' does not match cernvm_signing_dn = ' + self.machinetypes[machinetypeName].cernvm_signing_dn)
else:
vac.vacutils.logLine('Verified image signed by ' + cernvmDict['dn'])
# Try to upload the image
try:
self.machinetypes[machinetypeName]._imageID = self.uploadImage(self.machinetypes[machinetypeName]._imageFile, imageName, imageLastModified)
return self.machinetypes[machinetypeName]._imageID
except Exception as e:
raise OpenstackError('Failed to upload image file ' + imageName + ' (' + str(e) + ')')
def uploadImage(self, imageFile, imageName, imageLastModified, verbose = False):
try:
f = open(imageFile, 'r')
except Exception as e:
raise OpenstackError('Failed to open image file ' + imageName + ' (' + str(e) + ')')
self.curl.setopt(pycurl.READFUNCTION, f.read)
self.curl.setopt(pycurl.UPLOAD, True)
self.curl.setopt(pycurl.CUSTOMREQUEST, 'POST')
self.curl.setopt(pycurl.URL, self.imageURL + '/v1/images')
self.curl.setopt(pycurl.USERAGENT, 'Vcycle ' + vcycle.shared.vcycleVersion)
self.curl.setopt(pycurl.TIMEOUT, 30)
self.curl.setopt(pycurl.FOLLOWLOCATION, False)
self.curl.setopt(pycurl.SSL_VERIFYPEER, 1)
self.curl.setopt(pycurl.SSL_VERIFYHOST, 2)
self.curl.setopt(pycurl.HTTPHEADER,
[ 'x-image-meta-disk_format: ' + ('iso' if imageName.endswith('.iso') else 'raw'),
# ^^^ 'raw' for hdd; 'iso' for iso
'Content-Type: application/octet-stream',
'Accept: application/json',
'Transfer-Encoding: chunked',
'x-image-meta-container_format: bare',
'x-image-meta-is_public: False',
'x-image-meta-name: ' + imageName,
'x-image-meta-property-architecture: x86_64',
'x-image-meta-property-last-modified: ' + str(imageLastModified),
'X-Auth-Token: ' + self.token
])
outputBuffer = StringIO.StringIO()
self.curl.setopt(pycurl.WRITEFUNCTION, outputBuffer.write)
if verbose:
self.curl.setopt(pycurl.VERBOSE, 2)
else:
self.curl.setopt(pycurl.VERBOSE, 0)
if os.path.isdir('/etc/grid-security/certificates'):
self.curl.setopt(pycurl.CAPATH, '/etc/grid-security/certificates')
try:
self.curl.perform()
except Exception as e:
raise OpenstackError('Failed uploadimg image to ' + url + ' (' + str(e) + ')')
# Any 2xx code is OK; otherwise raise an exception
if self.curl.getinfo(pycurl.RESPONSE_CODE) / 100 != 2:
raise OpenstackError('Upload to ' + url + ' returns HTTP error code ' + str(self.curl.getinfo(pycurl.RESPONSE_CODE)))
try:
response = json.loads(outputBuffer.getvalue())
except Exception as e:
raise OpenstackError('JSON decoding of HTTP(S) response fails (' + str(e) + ')')
try:
vcycle.vacutils.logLine('Uploaded new image ' + imageName + ' with ID ' + str(response['image']['id']))
return str(response['image']['id'])
except:
raise OpenstackError('Failed to upload image file for ' + imageName + ' (' + str(e) + ')')
def getKeyPairName(self, machinetypeName):
"""Get the key pair name from root_public_key"""
if hasattr(self.machinetypes[machinetypeName], '_keyPairName'):
if self.machinetypes[machinetypeName]._keyPairName:
return self.machinetypes[machinetypeName]._keyPairName
else:
raise OpenstackError('Key pair "' + self.machinetypes[machinetypeName].root_public_key + '" for machinetype ' + machinetypeName + ' not available!')
# Get the ssh public key from the root_public_key file
if self.machinetypes[machinetypeName].root_public_key[0] == '/':
try:
f = open(self.machinetypes[machinetypeName].root_public_key, 'r')
except Exception as e:
OpenstackError('Cannot open ' + self.machinetypes[machinetypeName].root_public_key)
else:
try:
f = open('/var/lib/vcycle/spaces/' + self.spaceName + '/machinetypes/' + self.machinetypeName + '/files/' + self.machinetypes[machinetypeName].root_public_key, 'r')
except Exception as e:
OpenstackError('Cannot open /var/lib/vcycle/spaces/' + self.spaceName + '/machinetypes/' + self.machinetypeName + '/files/' + self.machinetypes[machinetypeName].root_public_key)
while True:
try:
line = f.read()
except:
raise OpenstackError('Cannot find ssh-rsa public key line in ' + self.machinetypes[machinetypeName].root_public_key)
if line[:8] == 'ssh-rsa ':
sshPublicKey = line.split(' ')[1]
break
# Check if public key is there already
try:
result = self.httpRequest(self.computeURL + '/os-keypairs',
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.computeURL + ' (' + str(e) + ')')
for keypair in result['response']['keypairs']:
try:
if 'ssh-rsa ' + sshPublicKey + ' vcycle' == keypair['keypair']['public_key']:
self.machinetypes[machinetypeName]._keyPairName = str(keypair['keypair']['name'])
return self.machinetypes[machinetypeName]._keyPairName
except:
pass
# Not there so we try to add it
keyName = str(time.time()).replace('.','-')
try:
result = self.httpRequest(self.computeURL + '/os-keypairs',
{ 'keypair' : { 'name' : keyName,
'public_key' : 'ssh-rsa ' + sshPublicKey + ' vcycle'
}
},
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.computeURL + ' (' + str(e) + ')')
vcycle.vacutils.logLine('Created key pair ' + keyName + ' for ' + self.machinetypes[machinetypeName].root_public_key + ' in ' + self.spaceName)
self.machinetypes[machinetypeName]._keyPairName = keyName
return self.machinetypes[machinetypeName]._keyPairName
def createMachine(self, machineName, machinetypeName):
# OpenStack-specific machine creation steps
try:
if self.machinetypes[machinetypeName].remote_joboutputs_url:
joboutputsURL = self.machinetypes[machinetypeName].remote_joboutputs_url + machineName
else:
joboutputsURL = 'https://' + os.uname()[1] + ':' + str(self.https_port) + '/machines/' + machineName + '/joboutputs'
request = { 'server' :
{ 'user_data' : base64.b64encode(open('/var/lib/vcycle/machines/' + machineName + '/user_data', 'r').read()),
'name' : machineName,
'imageRef' : self.getImageID(machinetypeName),
'flavorRef' : self.getFlavorID(machinetypeName),
'metadata' : { 'cern-services' : 'false',
'name' : machineName,
'machinetype' : machinetypeName,
'machinefeatures' : 'https://' + os.uname()[1] + ':' + str(self.https_port) + '/machines/' + machineName + '/machinefeatures',
'jobfeatures' : 'https://' + os.uname()[1] + ':' + str(self.https_port) + '/machines/' + machineName + '/jobfeatures',
'machineoutputs' : joboutputsURL,
'joboutputs' : joboutputsURL }
# Changing over from machineoutputs to joboutputs, so we set both in the metadata for now,
# but point them both to the joboutputs directory that we now provide
}
}
if self.machinetypes[machinetypeName].root_public_key:
request['server']['key_name'] = self.getKeyPairName(machinetypeName)
except Exception as e:
raise OpenstackError('Failed to create new machine: ' + str(e))
try:
result = self.httpRequest(self.computeURL + '/servers',
jsonRequest = request,
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise OpenstackError('Cannot connect to ' + self.computeURL + ' (' + str(e) + ')')
vcycle.vacutils.logLine('Created ' + machineName + ' (' + str(result['response']['server']['id']) + ') for ' + machinetypeName + ' within ' + self.spaceName)
self.machines[machineName] = vcycle.shared.Machine(name = machineName,
spaceName = self.spaceName,
state = vcycle.MachineState.starting,
ip = '0.0.0.0',
createdTime = int(time.time()),
startedTime = None,
updatedTime = int(time.time()),
uuidStr = None,
machinetypeName = machinetypeName)
def deleteOneMachine(self, machineName):
try:
self.httpRequest(self.computeURL + '/servers/' + self.machines[machineName].uuidStr,
method = 'DELETE',
headers = [ 'X-Auth-Token: ' + self.token ])
except Exception as e:
raise vcycle.shared.VcycleError('Cannot delete ' + machineName + ' via ' + self.computeURL + ' (' + str(e) + ')')