Commit f2fc6c3e by Dudás Ádám

vm: track destruction status of VMs

parent a56303f9
...@@ -318,6 +318,9 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -318,6 +318,9 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
vnc_port = IntegerField(verbose_name=_('vnc_port'), vnc_port = IntegerField(verbose_name=_('vnc_port'),
help_text=_("TCP port where VNC console listens.")) help_text=_("TCP port where VNC console listens."))
owner = ForeignKey(User) owner = ForeignKey(User)
destoryed = DateTimeField(blank=True, null=True,
help_text=_("The virtual machine's time of "
"destruction."))
class Meta: class Meta:
ordering = ['pk', ] ordering = ['pk', ]
...@@ -598,6 +601,8 @@ class Instance(BaseResourceConfigModel, TimeStampedModel): ...@@ -598,6 +601,8 @@ class Instance(BaseResourceConfigModel, TimeStampedModel):
for disk in self.disks.all(): for disk in self.disks.all():
disk.destroy() disk.destroy()
self.destoryed = timezone.now()
self.save()
act.finish(result="SUCCESS") act.finish(result="SUCCESS")
def destroy_async(self, user=None): def destroy_async(self, user=None):
......
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