336 |
336 |
# In the future they could be moved to a separate caching layer
|
337 |
337 |
# and removed from the database.
|
338 |
338 |
# [vkoukis] after discussion with [faidon].
|
339 |
|
action = models.CharField(choices=ACTIONS, max_length=30, null=True)
|
340 |
|
operstate = models.CharField(choices=OPER_STATES, max_length=30, null=True)
|
|
339 |
action = models.CharField(choices=ACTIONS, max_length=30, null=True,
|
|
340 |
default=None)
|
|
341 |
operstate = models.CharField(choices=OPER_STATES, max_length=30,
|
|
342 |
null=False, default="BUILD")
|
341 |
343 |
backendjobid = models.PositiveIntegerField(null=True)
|
342 |
344 |
backendopcode = models.CharField(choices=BACKEND_OPCODES, max_length=30,
|
343 |
345 |
null=True)
|
... | ... | |
365 |
367 |
def put_client(client):
|
366 |
368 |
put_rapi_client(client)
|
367 |
369 |
|
368 |
|
def __init__(self, *args, **kw):
|
369 |
|
"""Initialize state for just created VM instances."""
|
370 |
|
super(VirtualMachine, self).__init__(*args, **kw)
|
371 |
|
# This gets called BEFORE an instance gets save()d for
|
372 |
|
# the first time.
|
373 |
|
if not self.pk:
|
374 |
|
self.action = None
|
375 |
|
self.backendjobid = None
|
376 |
|
self.backendjobstatus = None
|
377 |
|
self.backendopcode = None
|
378 |
|
self.backendlogmsg = None
|
379 |
|
self.operstate = 'BUILD'
|
380 |
|
|
381 |
370 |
def save(self, *args, **kwargs):
|
382 |
371 |
# Store hash for first time saved vm
|
383 |
372 |
if (self.id is None or self.backend_hash == '') and self.backend:
|