Revision c4367587
b/logic/backend.py | ||
---|---|---|
154 | 154 |
os='image+default', |
155 | 155 |
ip_check=False, |
156 | 156 |
name_check=False, |
157 |
pnode=rapi.GetNodes()[0], #TODO: use a Ganeti iallocator instead |
|
157 |
# Do not specific a node explicitly, have |
|
158 |
# Ganeti use an iallocator instead |
|
159 |
# |
|
160 |
# pnode=rapi.GetNodes()[0] |
|
158 | 161 |
dry_run=settings.TEST, |
159 | 162 |
beparams=dict(auto_balance=True, vcpus=flavor.cpu, memory=flavor.ram), |
160 | 163 |
osparams=dict(img_id=image.backend_id, img_passwd=password, |
b/logic/callbacks.py | ||
---|---|---|
139 | 139 |
try: |
140 | 140 |
msg = _parse_json(message.body) |
141 | 141 |
|
142 |
if msg["type"] != "reconcile" :
|
|
142 |
if msg["type"] != "reconcile": |
|
143 | 143 |
_logger.error("Message is of unknown type %s", msg["type"]) |
144 | 144 |
return |
145 | 145 |
|
146 |
if msg["vmid"] == "" :
|
|
146 |
if msg["vmid"] == "": |
|
147 | 147 |
_logger.error("Reconciliate message does not specify a VM id") |
148 | 148 |
return |
149 | 149 |
|
... | ... | |
156 | 156 |
except Exception as e: |
157 | 157 |
_logger.error("Unexpected error:%s", e) |
158 | 158 |
|
159 |
def status_job_finished (message) :
|
|
159 |
def status_job_finished (message): |
|
160 | 160 |
""" |
161 | 161 |
Updates VM status based on a previously sent status update request |
162 | 162 |
""" |
... | ... | |
167 | 167 |
_logger.error("Message is of unknown type %s", msg["operation"]) |
168 | 168 |
return |
169 | 169 |
|
170 |
if msg["status"] != "success" :
|
|
170 |
if msg["status"] != "success": |
|
171 | 171 |
_logger.warn("Ignoring non-success status update from job %d on VM %s", |
172 | 172 |
msg['jobId'], msg['instance']) |
173 | 173 |
message.channel.basic_ack(message.delivery_tag) |
... | ... | |
177 | 177 |
|
178 | 178 |
_logger.debug("Node status job result: %s" % status) |
179 | 179 |
|
180 |
if status['summary'][0] != u'INSTANCE_QUERY_DATA' :
|
|
180 |
if status['summary'][0] != u'INSTANCE_QUERY_DATA': |
|
181 | 181 |
_logger.error("Status update is of unknown type %s", status['summary']) |
182 | 182 |
return |
183 | 183 |
|
... | ... | |
191 | 191 |
|
192 | 192 |
if run_state == "up": |
193 | 193 |
opcode = "OP_INSTANCE_REBOOT" |
194 |
else :
|
|
194 |
else: |
|
195 | 195 |
opcode = "OP_INSTANCE_SHUTDOWN" |
196 | 196 |
|
197 | 197 |
backend.process_op_status(vm=vm, jobid=msg['jobId'],opcode=opcode, |
Also available in: Unified diff