Revision 6afeb85d
b/snf-cyclades-app/synnefo/logic/backend.py | ||
---|---|---|
328 | 328 |
|
329 | 329 |
# Defined in settings.GANETI_CREATEINSTANCE_KWARGS |
330 | 330 |
# kw['hvparams'] = dict(serial_console=False) |
331 |
log.debug("Creating instance %s", kw)
|
|
331 |
log.debug("Creating instance %s", utils.hide_pass(kw))
|
|
332 | 332 |
with pooled_rapi_client(vm) as client: |
333 | 333 |
return client.CreateInstance(**kw) |
334 | 334 |
|
b/snf-cyclades-app/synnefo/logic/utils.py | ||
---|---|---|
30 | 30 |
# Utility functions |
31 | 31 |
|
32 | 32 |
from synnefo.db.models import VirtualMachine, Network |
33 |
|
|
34 | 33 |
from django.conf import settings |
34 |
from copy import copy |
|
35 | 35 |
|
36 | 36 |
def id_from_instance_name(name): |
37 | 37 |
"""Returns VirtualMachine's Django id, given a ganeti machine name. |
... | ... | |
105 | 105 |
return "REBOOT" |
106 | 106 |
return r |
107 | 107 |
|
108 |
|
|
108 | 109 |
def update_state(vm, new_operstate): |
109 | 110 |
"""Wrapper around updates of the VirtualMachine.operstate field""" |
110 | 111 |
|
111 | 112 |
vm.operstate = new_operstate |
113 |
|
|
114 |
|
|
115 |
def hide_pass(kw): |
|
116 |
if 'osparams' in kw and 'img_passwd' in kw['osparams']: |
|
117 |
kw1 = copy(kw) |
|
118 |
kw1['osparams']['img_passwd'] = 'x' * 8 |
|
119 |
return kw1 |
|
120 |
else: |
|
121 |
return kw |
Also available in: Unified diff