Revision 3a9b3cde snf-app/synnefo/logic/backend.py
b/snf-app/synnefo/logic/backend.py | ||
---|---|---|
218 | 218 |
|
219 | 219 |
|
220 | 220 |
def create_instance(vm, flavor, image, password, personality): |
221 |
|
|
221 |
"""`image` is a dictionary which should contain the keys: |
|
222 |
'backend_id', 'format' and 'metadata' |
|
223 |
|
|
224 |
metadata value should be a dictionary. |
|
225 |
""" |
|
222 | 226 |
nic = {'ip': 'pool', 'mode': 'routed', 'link': settings.GANETI_PUBLIC_LINK} |
223 | 227 |
|
224 | 228 |
if settings.IGNORE_FLAVOR_DISK_SIZES: |
225 |
if image.backend_id.find("windows") >= 0:
|
|
229 |
if image['backend_id'].find("windows") >= 0:
|
|
226 | 230 |
sz = 14000 |
227 | 231 |
else: |
228 | 232 |
sz = 4000 |
... | ... | |
258 | 262 |
'memory': flavor.ram} |
259 | 263 |
|
260 | 264 |
kw['osparams'] = { |
261 |
'img_id': image.backend_id,
|
|
265 |
'img_id': image['backend_id'],
|
|
262 | 266 |
'img_passwd': password, |
263 |
'img_format': image.format}
|
|
267 |
'img_format': image['format']}
|
|
264 | 268 |
if personality: |
265 | 269 |
kw['osparams']['img_personality'] = json.dumps(personality) |
266 | 270 |
|
267 |
image_meta = dict((m.meta_key, m.meta_value) for m in image.metadata.all()) |
|
268 |
kw['osparams']['img_properties'] = json.dumps(image_meta) |
|
271 |
kw['osparams']['img_properties'] = json.dumps(image['metadata']) |
|
269 | 272 |
|
270 | 273 |
# Defined in settings.GANETI_CREATEINSTANCE_KWARGS |
271 | 274 |
# kw['hvparams'] = dict(serial_console=False) |
Also available in: Unified diff