Revision 4e6f9904
b/api/fixtures/api_redux_test_data.json | ||
---|---|---|
63 | 63 |
"disk": 80 |
64 | 64 |
} |
65 | 65 |
} |
66 |
] |
|
66 |
] |
b/api/fixtures/api_test_data.json | ||
---|---|---|
265 | 265 |
"charged": "2011-02-06 00:00:00", |
266 | 266 |
"sourceimage": 1, |
267 | 267 |
"hostid": "HAL-9000", |
268 |
"description": "database server", |
|
269 | 268 |
"ipfour": "192.168.2.1", |
270 | 269 |
"ipsix": "::1", |
271 | 270 |
"flavor": 1, |
... | ... | |
283 | 282 |
"charged": "2011-02-10 00:00:00", |
284 | 283 |
"sourceimage": 1, |
285 | 284 |
"hostid": "HAL-9000", |
286 |
"description": "mail server", |
|
287 | 285 |
"ipfour": "192.168.2.2", |
288 | 286 |
"ipsix": "::2", |
289 | 287 |
"flavor": 1, |
... | ... | |
301 | 299 |
"charged": "2011-02-10 00:00:00", |
302 | 300 |
"sourceimage": 1, |
303 | 301 |
"hostid": "HAL-9000", |
304 |
"description": "my server", |
|
305 | 302 |
"ipfour": "192.168.2.3", |
306 | 303 |
"ipsix": "::3", |
307 | 304 |
"flavor": 1, |
... | ... | |
319 | 316 |
"charged": "2011-02-10 00:00:00", |
320 | 317 |
"sourceimage": 1, |
321 | 318 |
"hostid": "HAL-9000", |
322 |
"description": "my 2nd server", |
|
323 | 319 |
"ipfour": "192.168.2.4", |
324 | 320 |
"ipsix": "::4", |
325 | 321 |
"flavor": 1, |
b/api/handlers.py | ||
---|---|---|
106 | 106 |
server = {'status': server.rsapi_state, |
107 | 107 |
'flavorRef': server.flavor.id, |
108 | 108 |
'name': server.name, |
109 |
'description': server.description, |
|
110 | 109 |
'id': server.id, |
111 | 110 |
'imageRef': server.sourceimage.id, |
112 | 111 |
'created': server.created, |
... | ... | |
149 | 148 |
'flavorRef': server.flavor.id, |
150 | 149 |
'name': server.name, |
151 | 150 |
'id': server.id, |
152 |
'description': server.description, |
|
153 | 151 |
'created': server.created, |
154 | 152 |
'updated': server.updated, |
155 | 153 |
'imageRef': server.sourceimage.id, |
... | ... | |
254 | 252 |
"progress" : 0, |
255 | 253 |
"status" : 'BUILD', |
256 | 254 |
"adminPass" : self.random_password(), |
257 |
"metadata" : {"My Server Name" : vm.description},
|
|
255 |
"metadata" : {"My Server Name" : vm.name},
|
|
258 | 256 |
"addresses" : { |
259 | 257 |
"public" : [ ], |
260 | 258 |
"private" : [ ], |
... | ... | |
639 | 637 |
'id': image.id, |
640 | 638 |
'name': image.name, |
641 | 639 |
'updated': image.updated.isoformat(), |
642 |
'description': image.description, |
|
643 | 640 |
'status': image.state, |
644 | 641 |
'progress': image.state == 'ACTIVE' and 100 or 0, |
645 | 642 |
'size': image.size, |
646 |
'serverId': image.sourcevm and image.sourcevm.id or "" |
|
643 |
'serverId': image.sourcevm and image.sourcevm.id or "", |
|
644 |
#'metadata':[{'meta': { 'key': {metadata.meta_key: metadata.meta_value}}} for metadata in image.imagemetadata_set.all()] |
|
645 |
'metadata':{'meta': { 'key': {'description': image.description}}}, |
|
647 | 646 |
} for image in images] |
648 | 647 |
# Images info is stored in the DB. Ganeti is not aware of this |
649 | 648 |
if id == "detail": |
... | ... | |
660 | 659 |
'status': image.state, |
661 | 660 |
'progress': image.state == 'ACTIVE' and 100 or 0, |
662 | 661 |
'size': image.size, |
663 |
'serverId': image.sourcevm and image.sourcevm.id or "" |
|
662 |
'serverId': image.sourcevm and image.sourcevm.id or "", |
|
663 |
#'metadata':[{'meta': { 'key': {metadata.meta_key: metadata.meta_value}}} for metadata in image.imagemetadata_set.all()] |
|
664 |
'metadata':{'meta': { 'key': {'description': image.description}}}, |
|
664 | 665 |
} } |
665 | 666 |
except Image.DoesNotExist: |
666 | 667 |
raise fault.itemNotFound |
b/api/servers.py | ||
---|---|---|
66 | 66 |
d['created'] = server.created.isoformat() |
67 | 67 |
d['flavorRef'] = server.flavor.id |
68 | 68 |
d['imageRef'] = server.sourceimage.id |
69 |
d['description'] = server.description # XXX Not in OpenStack docs |
|
69 |
#d['description'] = server.description # XXX Not in OpenStack docs
|
|
70 | 70 |
|
71 | 71 |
server_meta = server.virtualmachinemetadata_set.all() |
72 | 72 |
metadata = dict((meta.meta_key, meta.meta_value) for meta in server_meta) |
b/api/tests.py | ||
---|---|---|
287 | 287 |
self.assertEqual(image_from_api['serverId'], image_from_db.sourcevm and image_from_db.sourcevm.id or "") |
288 | 288 |
self.assertEqual(image_from_api['size'], image_from_db.size) |
289 | 289 |
self.assertEqual(image_from_api['status'], image_from_db.state) |
290 |
self.assertEqual(image_from_api['description'], image_from_db.description) |
|
290 |
self.assertEqual(image_from_api['metadata']['meta']['key']['description'], image_from_db.description)
|
|
291 | 291 |
self.assertTrue(response.status_code in [200,203]) |
292 | 292 |
|
293 | 293 |
|
... | ... | |
305 | 305 |
self.assertEqual(image_from_api['serverId'], image_from_db.sourcevm and image_from_db.sourcevm.id or "") |
306 | 306 |
self.assertEqual(image_from_api['size'], image_from_db.size) |
307 | 307 |
self.assertEqual(image_from_api['status'], image_from_db.state) |
308 |
self.assertEqual(image_from_api['description'], image_from_db.description) |
|
308 |
self.assertEqual(image_from_api['metadata']['meta']['key']['description'], image_from_db.description)
|
|
309 | 309 |
|
310 | 310 |
for image_from_api in images_from_api: |
311 | 311 |
image_from_db = Image.objects.get(id=image_from_api['id']) |
... | ... | |
314 | 314 |
self.assertEqual(image_from_api['serverId'], image_from_db.sourcevm and image_from_db.sourcevm.id or "") |
315 | 315 |
self.assertEqual(image_from_api['size'], image_from_db.size) |
316 | 316 |
self.assertEqual(image_from_api['status'], image_from_db.state) |
317 |
self.assertEqual(image_from_api['description'], image_from_db.description) |
|
317 |
self.assertEqual(image_from_api['metadata']['meta']['key']['description'], image_from_db.description)
|
|
318 | 318 |
|
319 | 319 |
self.assertTrue(response.status_code in [200,203]) |
320 | 320 |
|
b/db/models.py | ||
---|---|---|
314 | 314 |
charged = models.DateTimeField(default=datetime.datetime.now()) |
315 | 315 |
sourceimage = models.ForeignKey("Image", null=False) |
316 | 316 |
hostid = models.CharField(max_length=100) |
317 |
description = models.TextField() |
|
318 | 317 |
ipfour = models.IPAddressField() |
319 | 318 |
ipsix = models.CharField(max_length=100) |
320 | 319 |
flavor = models.ForeignKey(Flavor) |
b/ui/static/synnefo.js | ||
---|---|---|
182 | 182 |
var img = $('#image-template').clone().attr("id","img-"+image.id).fadeIn("slow"); |
183 | 183 |
img.find("label").attr('for',"img-radio-" + image.id); |
184 | 184 |
img.find(".image-title").text(image.name); |
185 |
img.find(".description").text(image.description); |
|
185 |
img.find(".description").text(image.metadata.meta.key.description);
|
|
186 | 186 |
img.find(".size").text(image.size); |
187 | 187 |
img.find("input.radio").attr('id',"img-radio-" + image.id); |
188 | 188 |
if (i==0) img.find("input.radio").attr("checked","checked"); |
Also available in: Unified diff