Update VMDetail's terminated_at on delete of a vm
This commit is contained in:
parent
7278a20135
commit
f2f2fc22df
1 changed files with 7 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
@ -43,7 +44,9 @@ from utils.views import (
|
||||||
from .forms import HostingUserSignupForm, HostingUserLoginForm, \
|
from .forms import HostingUserSignupForm, HostingUserLoginForm, \
|
||||||
UserHostingKeyForm, generate_ssh_key_name
|
UserHostingKeyForm, generate_ssh_key_name
|
||||||
from .mixins import ProcessVMSelectionMixin
|
from .mixins import ProcessVMSelectionMixin
|
||||||
from .models import HostingOrder, HostingBill, HostingPlan, UserHostingKey
|
from .models import (
|
||||||
|
HostingOrder, HostingBill, HostingPlan, UserHostingKey, VMDetail
|
||||||
|
)
|
||||||
from datacenterlight.models import VMTemplate
|
from datacenterlight.models import VMTemplate
|
||||||
|
|
||||||
|
|
||||||
|
@ -1043,6 +1046,9 @@ class VirtualMachineView(LoginRequiredMixin, View):
|
||||||
except WrongIdError:
|
except WrongIdError:
|
||||||
response['status'] = True
|
response['status'] = True
|
||||||
response['text'] = ugettext('Terminated')
|
response['text'] = ugettext('Terminated')
|
||||||
|
vm_detail_obj = VMDetail.objects.filter(vm_id=opennebula_vm_id).first()
|
||||||
|
vm_detail_obj.terminated_at = datetime.utcnow()
|
||||||
|
vm_detail_obj.save()
|
||||||
break
|
break
|
||||||
except BaseException:
|
except BaseException:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue