Revision 5d3e597a snf-cyclades-app/synnefo/logic/reconciliation.py

b/snf-cyclades-app/synnefo/logic/reconciliation.py
235 235
            self.log.info("Server '%s' is '%s' in DB and '%s' in Ganeti.",
236 236
                          server_id, db_server.operstate, gnt_server["state"])
237 237
            if self.options["fix_unsynced"]:
238
                fix_opcode = \
239
                    "OP_INSTANCE_STARTUP" if gnt_server["state"] == "STARTED"\
238
                # If server is in building state, you will have first to
239
                # reconcile it's creation, to avoid wrong quotas
240
                if db_server.operstate == "BUILD":
241
                    backend_mod.process_op_status(
242
                        vm=db_server, etime=self.event_time, jobid=-0,
243
                        opcode="OP_INSTANCE_CREATE", status='success',
244
                        logmsg='Reconciliation: simulated Ganeti event')
245
                fix_opcode = "OP_INSTANCE_STARTUP"\
246
                    if gnt_server["state"] == "STARTED"\
240 247
                    else "OP_INSTANCE_SHUTDOWN"
241 248
                backend_mod.process_op_status(
242
                    vm=db_server,
243
                    etime=self.event_time,
244
                    jobid=-0,
249
                    vm=db_server, etime=self.event_time, jobid=-0,
245 250
                    opcode=fix_opcode, status='success',
246 251
                    logmsg='Reconciliation: simulated Ganeti event')
247 252
                self.log.debug("Simulated Ganeti state event for server '%s'",
......
251 256
        db_flavor = db_server.flavor
252 257
        gnt_flavor = gnt_server["flavor"]
253 258
        if (db_flavor.ram != gnt_flavor["ram"] or
254
            db_flavor.cpu != gnt_flavor["vcpus"]):
259
           db_flavor.cpu != gnt_flavor["vcpus"]):
255 260
            try:
256 261
                gnt_flavor = Flavor.objects.get(
257 262
                    ram=gnt_flavor["ram"],

Also available in: Unified diff