Commit c381ac63 by Dudás Ádám

vm: add field for resultant state to instance activities

parent c86086a5
...@@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals ...@@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals
from contextlib import contextmanager from contextlib import contextmanager
from logging import getLogger from logging import getLogger
from django.db.models import ForeignKey from django.db.models import CharField, ForeignKey
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
...@@ -26,6 +26,7 @@ class InstanceActivity(ActivityModel): ...@@ -26,6 +26,7 @@ class InstanceActivity(ActivityModel):
instance = ForeignKey('Instance', related_name='activity_log', instance = ForeignKey('Instance', related_name='activity_log',
help_text=_('Instance this activity works on.'), help_text=_('Instance this activity works on.'),
verbose_name=_('instance')) verbose_name=_('instance'))
resultant_state = CharField(blank=True, max_length=20, null=True)
class Meta: class Meta:
app_label = 'vm' app_label = 'vm'
...@@ -47,16 +48,16 @@ class InstanceActivity(ActivityModel): ...@@ -47,16 +48,16 @@ class InstanceActivity(ActivityModel):
@classmethod @classmethod
def create(cls, code_suffix, instance, task_uuid=None, user=None): def create(cls, code_suffix, instance, task_uuid=None, user=None):
act = cls(activity_code='vm.Instance.' + code_suffix, act = cls(activity_code='vm.Instance.' + code_suffix,
instance=instance, parent=None, started=timezone.now(), instance=instance, parent=None, resultant_state=None,
task_uuid=task_uuid, user=user) started=timezone.now(), task_uuid=task_uuid, user=user)
act.save() act.save()
return act return act
def create_sub(self, code_suffix, task_uuid=None): def create_sub(self, code_suffix, task_uuid=None):
act = InstanceActivity( act = InstanceActivity(
activity_code=self.activity_code + '.' + code_suffix, activity_code=self.activity_code + '.' + code_suffix,
instance=self.instance, parent=self, started=timezone.now(), instance=self.instance, parent=self, resultant_state=None,
task_uuid=task_uuid, user=self.user) started=timezone.now(), task_uuid=task_uuid, user=self.user)
act.save() act.save()
return act return act
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment